Files
sgauthier 6e64e138e2
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s
planning
2024-10-14 09:15:30 +02:00
..
2024-10-14 09:15:30 +02:00
2024-10-14 09:15:30 +02:00
2024-10-14 09:15:30 +02:00
2024-10-14 09:15:30 +02:00

space-separated-tokens

Build Coverage Downloads Size

Parse and stringify space-separated tokens according to the spec.

Install

npm:

npm install space-separated-tokens

Usage

var spaceSeparated = require('space-separated-tokens')

spaceSeparated.parse(' foo\tbar\nbaz  ')
//=> ['foo', 'bar', 'baz']

spaceSeparated.stringify(['foo', 'bar', 'baz'])
//=> 'foo bar baz'

API

spaceSeparated.parse(value)

Parse space-separated tokens to an array of strings, according to the spec.

Parameters
  • value (string) — space-separated tokens
Returns

Array.<string> — List of tokens.

spaceSeparated.stringify(values)

Serialize an array of strings to space-separated tokens. Note that its not possible to specify empty or whitespace only values.

Parameters
  • values (Array.<string>) — List of tokens
Returns

string — Space-separated tokens.

License

MIT © Titus Wormer