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
99.3
Supply Chain
99.4
Quality
75.7
Maintenance
100
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
11 Stars
75 Commits
1 Forks
3 Watching
1 Branches
3 Contributors
Updated on 01 Jul 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-8%
1,403,889
Compared to previous day
Last week
2.5%
8,128,112
Compared to previous week
Last month
10.1%
34,338,149
Compared to previous month
Last year
6.1%
355,286,615
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.
MIT Β© Titus Wormer
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
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 2024-11-18
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