{"library":"npm-config-user-agent-parser","title":"npm User Agent Parser","description":"This package, `npm-config-user-agent-parser`, provides a utility to parse the `process.env.npm_config_user_agent` string, which is set by both npm and Yarn. It extracts structured information including versions for `npm`, `yarn`, and `node`, as well as the operating system `platform` and processor `arch`. The current stable version is 1.0.0, indicating a mature and stable API, and its release cadence is typically infrequent, focusing on stability given its single, well-defined purpose. Key differentiators include its focused scope on this specific environment variable and its ability to normalize the potentially varied user agent strings into a consistent JSON object, simplifying programmatic access to crucial environment details for tooling and scripts.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install npm-config-user-agent-parser"],"cli":null},"imports":["import parser from 'npm-config-user-agent-parser';","const parser = require('npm-config-user-agent-parser');","npm-config-user-agent-parser 'npm/6.1.0 node/v8.9.4 darwin x64'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import parser from 'npm-config-user-agent-parser';\n\n// Simulate the npm_config_user_agent environment variable\n// In a real environment, this would be `process.env.npm_config_user_agent`\nconst userAgentString = 'yarn/1.7.0 npm/? node/v8.9.4 darwin x64';\n\nconst parsed = parser(userAgentString);\n\nconsole.log('Parsed User Agent:', parsed);\n\n// Example of accessing specific properties\nconsole.log('Yarn Version:', parsed.yarn ? parsed.yarn.version : 'N/A');\nconsole.log('Node Major Version:', parsed.node ? parsed.node.major : 'N/A');\nconsole.log('Platform:', parsed.platform);\n","lang":"javascript","description":"Demonstrates parsing a sample `npm_config_user_agent` string using the Node API and logging the structured output.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}