WIP - add extractor, generate snippet_data
This commit is contained in:
29
node_modules/split-on-first/index.d.ts
generated
vendored
Normal file
29
node_modules/split-on-first/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
Split a string on the first occurrence of a given separator.
|
||||
|
||||
@param string - The string to split.
|
||||
@param separator - The separator to split on.
|
||||
|
||||
@example
|
||||
```
|
||||
import splitOnFirst = require('split-on-first');
|
||||
|
||||
splitOnFirst('a-b-c', '-');
|
||||
//=> ['a', 'b-c']
|
||||
|
||||
splitOnFirst('key:value:value2', ':');
|
||||
//=> ['key', 'value:value2']
|
||||
|
||||
splitOnFirst('a---b---c', '---');
|
||||
//=> ['a', 'b---c']
|
||||
|
||||
splitOnFirst('a-b-c', '+');
|
||||
//=> ['a-b-c']
|
||||
```
|
||||
*/
|
||||
declare function splitOnFirst(
|
||||
string: string,
|
||||
separator: string
|
||||
): [string, string?];
|
||||
|
||||
export = splitOnFirst;
|
||||
22
node_modules/split-on-first/index.js
generated
vendored
Normal file
22
node_modules/split-on-first/index.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = (string, separator) => {
|
||||
if (!(typeof string === 'string' && typeof separator === 'string')) {
|
||||
throw new TypeError('Expected the arguments to be of type `string`');
|
||||
}
|
||||
|
||||
if (separator === '') {
|
||||
return [string];
|
||||
}
|
||||
|
||||
const separatorIndex = string.indexOf(separator);
|
||||
|
||||
if (separatorIndex === -1) {
|
||||
return [string];
|
||||
}
|
||||
|
||||
return [
|
||||
string.slice(0, separatorIndex),
|
||||
string.slice(separatorIndex + separator.length)
|
||||
];
|
||||
};
|
||||
9
node_modules/split-on-first/license
generated
vendored
Normal file
9
node_modules/split-on-first/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
||||
68
node_modules/split-on-first/package.json
generated
vendored
Normal file
68
node_modules/split-on-first/package.json
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
"_from": "split-on-first@^1.0.0",
|
||||
"_id": "split-on-first@1.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==",
|
||||
"_location": "/split-on-first",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "split-on-first@^1.0.0",
|
||||
"name": "split-on-first",
|
||||
"escapedName": "split-on-first",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gatsby-remark-images/query-string"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz",
|
||||
"_shasum": "f610afeee3b12bce1d0c30425e76398b78249a5f",
|
||||
"_spec": "split-on-first@^1.0.0",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/gatsby-remark-images/node_modules/query-string",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/split-on-first/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Split a string on the first occurance of a given separator",
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/split-on-first#readme",
|
||||
"keywords": [
|
||||
"split",
|
||||
"string",
|
||||
"first",
|
||||
"occurrence",
|
||||
"separator",
|
||||
"delimiter",
|
||||
"text"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "split-on-first",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/split-on-first.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"version": "1.1.0"
|
||||
}
|
||||
58
node_modules/split-on-first/readme.md
generated
vendored
Normal file
58
node_modules/split-on-first/readme.md
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
# split-on-first [](https://travis-ci.com/sindresorhus/split-on-first)
|
||||
|
||||
> Split a string on the first occurrence of a given separator
|
||||
|
||||
This is similar to [`String#split()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split), but that one splits on all the occurrences, not just the first one.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install split-on-first
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const splitOnFirst = require('split-on-first');
|
||||
|
||||
splitOnFirst('a-b-c', '-');
|
||||
//=> ['a', 'b-c']
|
||||
|
||||
splitOnFirst('key:value:value2', ':');
|
||||
//=> ['key', 'value:value2']
|
||||
|
||||
splitOnFirst('a---b---c', '---');
|
||||
//=> ['a', 'b---c']
|
||||
|
||||
splitOnFirst('a-b-c', '+');
|
||||
//=> ['a-b-c']
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### splitOnFirst(string, separator)
|
||||
|
||||
#### string
|
||||
|
||||
Type: `string`
|
||||
|
||||
The string to split.
|
||||
|
||||
#### separator
|
||||
|
||||
Type: `string`
|
||||
|
||||
The separator to split on.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [split-at](https://github.com/sindresorhus/split-at) - Split a string at one or more indices
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Reference in New Issue
Block a user