WIP - add extractor, generate snippet_data
This commit is contained in:
52
node_modules/comma-separated-tokens/index.js
generated
vendored
Normal file
52
node_modules/comma-separated-tokens/index.js
generated
vendored
Normal 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()
|
||||
}
|
||||
22
node_modules/comma-separated-tokens/license
generated
vendored
Normal file
22
node_modules/comma-separated-tokens/license
generated
vendored
Normal 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.
|
||||
104
node_modules/comma-separated-tokens/package.json
generated
vendored
Normal file
104
node_modules/comma-separated-tokens/package.json
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"_from": "comma-separated-tokens@^1.0.0",
|
||||
"_id": "comma-separated-tokens@1.0.7",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-Jrx3xsP4pPv4AwJUDWY9wOXGtwPXARej6Xd99h4TUGotmf8APuquKMpK+dnD3UgyxK7OEWaisjZz+3b5jtL6xQ==",
|
||||
"_location": "/comma-separated-tokens",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "comma-separated-tokens@^1.0.0",
|
||||
"name": "comma-separated-tokens",
|
||||
"escapedName": "comma-separated-tokens",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/hast-to-hyperscript",
|
||||
"/hast-util-to-html",
|
||||
"/hastscript"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-1.0.7.tgz",
|
||||
"_shasum": "419cd7fb3258b1ed838dc0953167a25e152f5b59",
|
||||
"_spec": "comma-separated-tokens@^1.0.0",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/hastscript",
|
||||
"author": {
|
||||
"name": "Titus Wormer",
|
||||
"email": "tituswormer@gmail.com",
|
||||
"url": "https://wooorm.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/wooorm/comma-separated-tokens/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Titus Wormer",
|
||||
"email": "tituswormer@gmail.com",
|
||||
"url": "https://wooorm.com"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "Parse and stringify comma-separated tokens",
|
||||
"devDependencies": {
|
||||
"browserify": "^16.0.0",
|
||||
"nyc": "^14.0.0",
|
||||
"prettier": "^1.12.0",
|
||||
"remark-cli": "^6.0.1",
|
||||
"remark-preset-wooorm": "^4.0.0",
|
||||
"tape": "^4.0.0",
|
||||
"tinyify": "^2.5.0",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/wooorm/comma-separated-tokens#readme",
|
||||
"keywords": [
|
||||
"dom",
|
||||
"html",
|
||||
"comma",
|
||||
"separated",
|
||||
"tokens",
|
||||
"parse",
|
||||
"stringify"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "comma-separated-tokens",
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/wooorm/comma-separated-tokens.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build-bundle && npm run build-mangle",
|
||||
"build-bundle": "browserify . -s commaSeparatedTokens -o comma-separated-tokens.js",
|
||||
"build-mangle": "browserify . -s commaSeparatedTokens -p tinyify -o comma-separated-tokens.min.js",
|
||||
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
|
||||
"test": "npm run format && npm run build && npm run test-coverage",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test.js"
|
||||
},
|
||||
"version": "1.0.7",
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
"ignores": [
|
||||
"comma-separated-tokens.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
88
node_modules/comma-separated-tokens/readme.md
generated
vendored
Normal file
88
node_modules/comma-separated-tokens/readme.md
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
# 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][].
|
||||
|
||||
## Installation
|
||||
|
||||
[npm][]:
|
||||
|
||||
```bash
|
||||
npm install comma-separated-tokens
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
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 it’s not possible to specify initial or final
|
||||
white-space 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
|
||||
Reference in New Issue
Block a user