PageSourceSearch

https://pika.page/assets/comma-separated-tokens-2db00a6fdf2e5fdbab…85369fd3dbf26c10a0b12c6fb9aee9fa3d4b6d8c.js

js pika.page collected 2026-10-03 21:43:19 UTC 1,298 bytes, 37 lines download raw bytes

1// [email protected] downloaded from https://ga.jspm.io/npm:[email protected]/index.js
2
3/**
4 * @typedef Options
5 *   Configuration for `stringify`.
6 * @property {boolean} [padLeft=true]
7 *   Whether to pad a space before a token.
8 * @property {boolean} [padRight=false]
9 *   Whether to pad a space after a token.
10 */
11/**
12 * @typedef {Options} StringifyOptions
13 *   Please use `StringifyOptions` instead.
14 */
15/**
16 * Parse comma-separated tokens to an array.
17 *
18 * @param {string} value
19 *   Comma-separated tokens.
20 * @returns {Array<string>}
21 *   List of tokens.
22 */
23function parse(t){
24/** @type {Array<string>} */
25const n=[];const e=String(t||"");let i=e.indexOf(",");let r=0;
26/** @type {boolean} */let s=false;while(!s){if(-1===i){i=e.length;s=true}const t=e.slice(r,i).trim();!t&&s||n.push(t);r=i+1;i=e.indexOf(",",r)}return n}
27/**
28 * Serialize an array of strings or numbers to comma-separated tokens.
29 *
30 * @param {Array<string|number>} values
31 *   List of tokens.
32 * @param {Options} [options]
33 *   Configuration for `stringify` (optional).
34 * @returns {string}
35 *   Comma-separated tokens.
36 */function stringify(t,n){const e=n||{};const i=""===t[t.length-1]?[...t,""]:t;return i.join((e.padRight?" ":"")+","+(false===e.padLeft?"":" ")).trim()}export{parse,stringify};
37

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.