{"id":50615357,"url":"https://github.com/postcss/postcss-value-parser","last_synced_at":"2026-06-06T08:00:35.582Z","repository":{"id":36614118,"uuid":"40920306","full_name":"postcss/postcss-value-parser","owner":"postcss","description":"Transforms css values into the tree","archived":false,"fork":false,"pushed_at":"2026-06-05T12:08:39.000Z","size":172,"stargazers_count":147,"open_issues_count":14,"forks_count":22,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-06-05T13:10:30.257Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/postcss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-08-17T18:55:05.000Z","updated_at":"2026-06-05T12:08:42.000Z","dependencies_parsed_at":"2024-06-11T19:08:39.314Z","dependency_job_id":null,"html_url":"https://github.com/postcss/postcss-value-parser","commit_stats":null,"previous_names":["postcss/postcss-value-parser"],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/postcss/postcss-value-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postcss%2Fpostcss-value-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postcss%2Fpostcss-value-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postcss%2Fpostcss-value-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postcss%2Fpostcss-value-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postcss","download_url":"https://codeload.github.com/postcss/postcss-value-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postcss%2Fpostcss-value-parser/sbom","scorecard":{"id":144136,"data":{"date":"2025-08-11","repo":{"name":"github.com/TrySound/postcss-value-parser","commit":"11a4436e74930f4eaf9cbdb2063656bcce8ebf6a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.4,"checks":[{"name":"Code-Review","score":5,"reason":"Found 16/27 approved changesets -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"32 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-3gx7-xhv7-5mx3","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-fhjf-83wg-r2j9","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-6fw4-hr69-g3rv","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp","Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr","Warn: Project is vulnerable to: GHSA-3f95-r44v-8mrg","Warn: Project is vulnerable to: GHSA-28xr-mwxg-3qc8","Warn: Project is vulnerable to: GHSA-9p95-fxvg-qgq2","Warn: Project is vulnerable to: GHSA-9w5j-4mwv-2wj8","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-w5p7-h5w8-2hfq"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T08:59:41.188Z","repository_id":36614118,"created_at":"2025-08-16T08:59:41.188Z","updated_at":"2025-08-16T08:59:41.188Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33973868,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-06T02:00:07.033Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-06T08:00:24.249Z","updated_at":"2026-06-06T08:00:35.573Z","avatar_url":"https://github.com/postcss.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postcss-value-parser\n\nTransforms CSS declaration values and at-rule parameters into a tree of nodes, and provides a simple traversal API.\n\n## Usage\n\n```js\nvar valueParser = require(\"postcss-value-parser\");\nvar cssBackgroundValue = \"url(foo.png) no-repeat 40px 73%\";\nvar parsedValue = valueParser(cssBackgroundValue);\n// parsedValue exposes an API described below,\n// e.g. parsedValue.walk(..), parsedValue.toString(), etc.\n```\n\nFor example, parsing the value `rgba(233, 45, 66, .5)` will return the following:\n\n```js\n{\n  nodes: [\n    {\n      type: \"function\",\n      value: \"rgba\",\n      before: \"\",\n      after: \"\",\n      nodes: [\n        { type: \"word\", value: \"233\" },\n        { type: \"div\", value: \",\", before: \"\", after: \" \" },\n        { type: \"word\", value: \"45\" },\n        { type: \"div\", value: \",\", before: \"\", after: \" \" },\n        { type: \"word\", value: \"66\" },\n        { type: \"div\", value: \",\", before: \" \", after: \"\" },\n        { type: \"word\", value: \".5\" },\n      ],\n    },\n  ];\n}\n```\n\nIf you wanted to convert each `rgba()` value in `sourceCSS` to a hex value, you could do so like this:\n\n```js\nvar valueParser = require(\"postcss-value-parser\");\n\nvar parsed = valueParser(sourceCSS);\n\n// walk() will visit all the of the nodes in the tree,\n// invoking the callback for each.\nparsed.walk(function (node) {\n  // Since we only want to transform rgba() values,\n  // we can ignore anything else.\n  if (node.type !== \"function\" \u0026\u0026 node.value !== \"rgba\") return;\n\n  // We can make an array of the rgba() arguments to feed to a\n  // convertToHex() function\n  var color = node.nodes\n    .filter(function (node) {\n      return node.type === \"word\";\n    })\n    .map(function (node) {\n      return Number(node.value);\n    }); // [233, 45, 66, .5]\n\n  // Now we will transform the existing rgba() function node\n  // into a word node with the hex value\n  node.type = \"word\";\n  node.value = convertToHex(color);\n});\n\nparsed.toString(); // #E92D42\n```\n\n## Nodes\n\nEach node is an object with these common properties:\n\n- **type**: The type of node (`word`, `string`, `div`, `space`, `comment`, or `function`).\n  Each type is documented below.\n- **value**: Each node has a `value` property; but what exactly `value` means\n  is specific to the node type. Details are documented for each type below.\n- **sourceIndex**: The starting index of the node within the original source\n  string. For example, given the source string `10px 20px`, the `word` node\n  whose value is `20px` will have a `sourceIndex` of `5`.\n\n### word\n\nThe catch-all node type that includes keywords (e.g. `no-repeat`),\nquantities (e.g. `20px`, `75%`, `1.5`), and hex colors (e.g. `#e6e6e6`).\n\nNode-specific properties:\n\n- **value**: The \"word\" itself.\n\n### string\n\nA quoted string value, e.g. `\"something\"` in `content: \"something\";`.\n\nNode-specific properties:\n\n- **value**: The text content of the string.\n- **quote**: The quotation mark surrounding the string, either `\"` or `'`.\n- **unclosed**: `true` if the string was not closed properly. e.g. `\"unclosed string  `.\n\n### div\n\nA divider, for example\n\n- `,` in `animation-duration: 1s, 2s, 3s`\n- `/` in `border-radius: 10px / 23px`\n- `:` in `(min-width: 700px)`\n\nNode-specific properties:\n\n- **value**: The divider character. Either `,`, `/`, or `:` (see examples above).\n- **before**: Whitespace before the divider.\n- **after**: Whitespace after the divider.\n\n### space\n\nWhitespace used as a separator, e.g. ` ` occurring twice in `border: 1px solid black;`.\n\nNode-specific properties:\n\n- **value**: The whitespace itself.\n\n### comment\n\nA CSS comment starts with `/*` and ends with `*/`\n\nNode-specific properties:\n\n- **value**: The comment value without `/*` and `*/`\n- **unclosed**: `true` if the comment was not closed properly. e.g. `/* comment without an end  `.\n\n### function\n\nA CSS function, e.g. `rgb(0,0,0)` or `url(foo.bar)`.\n\nFunction nodes have nodes nested within them: the function arguments.\n\nAdditional properties:\n\n- **value**: The name of the function, e.g. `rgb` in `rgb(0,0,0)`.\n- **before**: Whitespace after the opening parenthesis and before the first argument,\n  e.g. `  ` in `rgb(  0,0,0)`.\n- **after**: Whitespace before the closing parenthesis and after the last argument,\n  e.g. `  ` in `rgb(0,0,0  )`.\n- **nodes**: More nodes representing the arguments to the function.\n- **unclosed**: `true` if the parentheses was not closed properly. e.g. `( unclosed-function  `.\n\nMedia features surrounded by parentheses are considered functions with an\nempty value. For example, `(min-width: 700px)` parses to these nodes:\n\n```js\n[\n  {\n    type: \"function\",\n    value: \"\",\n    before: \"\",\n    after: \"\",\n    nodes: [\n      { type: \"word\", value: \"min-width\" },\n      { type: \"div\", value: \":\", before: \"\", after: \" \" },\n      { type: \"word\", value: \"700px\" },\n    ],\n  },\n];\n```\n\n`url()` functions can be parsed a little bit differently depending on\nwhether the first character in the argument is a quotation mark.\n\n`url( /gfx/img/bg.jpg )` parses to:\n\n```js\n{ type: 'function', sourceIndex: 0, value: 'url', before: ' ', after: ' ', nodes: [\n    { type: 'word', sourceIndex: 5, value: '/gfx/img/bg.jpg' }\n] }\n```\n\n`url( \"/gfx/img/bg.jpg\" )`, on the other hand, parses to:\n\n```js\n{ type: 'function', sourceIndex: 0, value: 'url', before: ' ', after: ' ', nodes: [\n    { type: 'string', sourceIndex: 5, quote: '\"', value: '/gfx/img/bg.jpg' },\n] }\n```\n\n### unicode-range\n\nThe unicode-range CSS descriptor sets the specific range of characters to be\nused from a font defined by @font-face and made available\nfor use on the current page (`unicode-range: U+0025-00FF`).\n\nNode-specific properties:\n\n- **value**: The \"unicode-range\" itself.\n\n## API\n\n```js\nvar valueParser = require(\"postcss-value-parser\");\n```\n\n### valueParser.unit(quantity)\n\nParses `quantity`, distinguishing the number from the unit. Returns an object like the following:\n\n```js\n// Given 2rem\n{\n  number: '2',\n  unit: 'rem'\n}\n```\n\nIf the `quantity` argument cannot be parsed as a number, returns `false`.\n\n_This function does not parse complete values_: you cannot pass it `1px solid black` and expect `px` as\nthe unit. Instead, you should pass it single quantities only. Parse `1px solid black`, then pass it\nthe stringified `1px` node (a `word` node) to parse the number and unit.\n\n### valueParser.stringify(nodes[, custom])\n\nStringifies a node or array of nodes.\n\nThe `custom` function is called for each `node`; return a string to override the default behaviour.\n\n### valueParser.walk(nodes, callback[, bubble])\n\nWalks each provided node, recursively walking all descendent nodes within functions.\n\nReturning `false` in the `callback` will prevent traversal of descendent nodes (within functions).\nYou can use this feature to for shallow iteration, walking over only the _immediate_ children.\n_Note: This only applies if `bubble` is `false` (which is the default)._\n\nBy default, the tree is walked from the outermost node inwards.\nTo reverse the direction, pass `true` for the `bubble` argument.\n\nThe `callback` is invoked with three arguments: `callback(node, index, nodes)`.\n\n- `node`: The current node.\n- `index`: The index of the current node.\n- `nodes`: The complete nodes array passed to `walk()`.\n\nReturns the `valueParser` instance.\n\n### var parsed = valueParser(value)\n\nReturns the parsed node tree.\n\n### parsed.nodes\n\nThe array of nodes.\n\n### parsed.toString()\n\nStringifies the node tree.\n\n### parsed.walk(callback[, bubble])\n\nWalks each node inside `parsed.nodes`. See the documentation for `valueParser.walk()` above.\n\n## License\n\nMIT © [Bogdan Chadkin](mailto:trysound@yandex.ru)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostcss%2Fpostcss-value-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostcss%2Fpostcss-value-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostcss%2Fpostcss-value-parser/lists"}