Initial commit with Advoware proxy

This commit is contained in:
root
2025-10-19 14:57:07 +00:00
commit 273aa8b549
45771 changed files with 5534555 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
'use strict'
exports.parse = parse
exports.stringify = stringify
var comma = ','
var space = ' '
var empty = ''
// Parse comma-separated tokens to an array.
function parse(value) {
var values = []
var input = String(value || empty)
var index = input.indexOf(comma)
var lastIndex = 0
var end = false
var val
while (!end) {
if (index === -1) {
index = input.length
end = true
}
val = input.slice(lastIndex, index).trim()
if (val || !end) {
values.push(val)
}
lastIndex = index + 1
index = input.indexOf(comma, lastIndex)
}
return values
}
// Compile an array to comma-separated tokens.
// `options.padLeft` (default: `true`) pads a space left of each token, and
// `options.padRight` (default: `false`) pads a space to the right of each token.
function stringify(values, options) {
var settings = options || {}
var left = settings.padLeft === false ? empty : space
var right = settings.padRight ? space : empty
// Ensure the last empty entry is seen.
if (values[values.length - 1] === empty) {
values = values.concat(empty)
}
return values.join(right + comma + left).trim()
}

View File

@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,67 @@
{
"name": "comma-separated-tokens",
"version": "1.0.8",
"description": "Parse and stringify comma-separated tokens",
"license": "MIT",
"keywords": [
"dom",
"html",
"comma",
"separated",
"tokens",
"parse",
"stringify"
],
"repository": "wooorm/comma-separated-tokens",
"bugs": "https://github.com/wooorm/comma-separated-tokens/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
"prettier": "^1.0.0",
"remark-cli": "^7.0.0",
"remark-preset-wooorm": "^6.0.0",
"tape": "^4.0.0",
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s commaSeparatedTokens -o comma-separated-tokens.js",
"build-mangle": "browserify . -s commaSeparatedTokens -p tinyify -o comma-separated-tokens.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"comma-separated-tokens.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}

View File

@@ -0,0 +1,87 @@
# comma-separated-tokens
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
Parse and stringify comma-separated tokens according to the [spec][].
## Install
[npm][]:
```sh
npm install comma-separated-tokens
```
## Use
```js
var commaSeparated = require('comma-separated-tokens')
commaSeparated.parse(' a ,b,,d d ') //=> ['a', 'b', '', 'd d']
commaSeparated.stringify(['a', 'b', '', 'd d']) //=> 'a, b, , d d'
```
## API
### `commaSeparated.parse(value)`
Parse comma-separated tokens (`string`) to an array of strings, according
to the [spec][].
### `commaSeparated.stringify(values[, options])`
Compile an array of strings to comma-separated tokens (`string`).
Handles empty items at start or end correctly.
Note that its not possible to specify initial or final whitespace per value.
##### `options`
###### `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`).
## Related
* [`collapse-white-space`](https://github.com/wooorm/collapse-white-space)
— Replace multiple white-space characters with a single space
* [`property-information`](https://github.com/wooorm/property-information)
— Information on HTML properties
* [`space-separated-tokens`](https://github.com/wooorm/space-separated-tokens)
— Parse/stringify space-separated tokens
## License
[MIT][license] © [Titus Wormer][author]
<!-- Definitions -->
[build-badge]: https://img.shields.io/travis/wooorm/comma-separated-tokens.svg
[build]: https://travis-ci.org/wooorm/comma-separated-tokens
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/comma-separated-tokens.svg
[coverage]: https://codecov.io/github/wooorm/comma-separated-tokens
[downloads-badge]: https://img.shields.io/npm/dm/comma-separated-tokens.svg
[downloads]: https://www.npmjs.com/package/comma-separated-tokens
[size-badge]: https://img.shields.io/bundlephobia/minzip/comma-separated-tokens.svg
[size]: https://bundlephobia.com/result?p=comma-separated-tokens
[npm]: https://docs.npmjs.com/cli/install
[license]: license
[author]: https://wooorm.com
[spec]: https://html.spec.whatwg.org/#comma-separated-tokens