Gathering detailed insights and metrics for comma-separated-tokens
Gathering detailed insights and metrics for comma-separated-tokens
Gathering detailed insights and metrics for comma-separated-tokens
Gathering detailed insights and metrics for comma-separated-tokens
Parse and stringify comma-separated tokens
npm install comma-separated-tokens
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
1,486,868,413
Last Day
542,053
Last Week
9,970,519
Last Month
43,361,992
Last Year
406,743,744
MIT License
11 Stars
75 Commits
1 Forks
2 Watchers
1 Branches
3 Contributors
Updated on Jul 01, 2024
Minified
Minified + Gzipped
Latest Version
2.0.3
Package Id
comma-separated-tokens@2.0.3
Unpacked Size
9.74 kB
Size
3.73 kB
File Count
5
NPM Version
8.19.2
Node Version
19.0.0
Cumulative downloads
Total Downloads
Last Day
-6.2%
542,053
Compared to previous day
Last Week
-8.7%
9,970,519
Compared to previous week
Last Month
3.1%
43,361,992
Compared to previous month
Last Year
21.5%
406,743,744
Compared to previous year
Parse and stringify comma-separated tokens.
This is a tiny package that can parse and stringify comma-separated tokens, as
used for example in the HTML accept
attribute, according to the
WHATWG spec.
This package is rather niche, it’s low-level and particularly useful when working with hast.
This package is ESM only. In Node.js (version 14.14+, 16.0+), install with npm:
1npm install comma-separated-tokens
In Deno with esm.sh
:
1import {parse, stringify} from 'https://esm.sh/comma-separated-tokens@2'
In browsers with esm.sh
:
1<script type="module"> 2 import {parse, stringify} from 'https://esm.sh/comma-separated-tokens@2?bundle' 3</script>
1import {parse, stringify} from 'comma-separated-tokens' 2 3parse(' a ,b,,d d ') //=> ['a', 'b', '', 'd d'] 4stringify(['a', 'b', '', 'd d']) //=> 'a, b, , d d'
This package exports the identifier parse
and stringify
.
There is no default export.
parse(value)
Parse commma-separated tokens (string
) to an array of strings
(Array<string>
), according to the WHATWG spec.
stringify(values[, options])
Serialize an array of strings or numbers (Array<string|number>
) to
comma-separated tokens (string
).
Handles empty items at start or end correctly.
👉 Note: it’s not possible to specify initial or final whitespace per value.
options
Configuration (optional).
options.padLeft
Whether to pad a space before a token (boolean
, default: true
).
options.padRight
Whether to pad a space after a token (boolean
, default: false
).
This package is fully typed with TypeScript.
It exports the additional type Options
.
This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 14.14+ and 16.0+. It also works in Deno and modern browsers.
space-separated-tokens
— parse/stringify space-separated tokenscollapse-white-space
— replace multiple white-space characters with a single spaceproperty-information
— info on HTML propertiesYes please! See How to Contribute to Open Source.
This package is safe.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More