剩余模块:生产入库,销售出库
This commit is contained in:
44
node_modules/string-split-by/.eslintrc.json
generated
vendored
Normal file
44
node_modules/string-split-by/.eslintrc.json
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"commonjs": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"rules": {
|
||||
"strict": 2,
|
||||
"indent": 0,
|
||||
"linebreak-style": 0,
|
||||
"quotes": 0,
|
||||
"semi": 0,
|
||||
"no-cond-assign": 1,
|
||||
"no-constant-condition": 1,
|
||||
"no-duplicate-case": 1,
|
||||
"no-empty": 1,
|
||||
"no-ex-assign": 1,
|
||||
"no-extra-boolean-cast": 1,
|
||||
"no-extra-semi": 1,
|
||||
"no-fallthrough": 1,
|
||||
"no-func-assign": 1,
|
||||
"no-global-assign": 1,
|
||||
"no-implicit-globals": 2,
|
||||
"no-inner-declarations": ["error", "functions"],
|
||||
"no-irregular-whitespace": 2,
|
||||
"no-loop-func": 1,
|
||||
"no-magic-numbers": ["warn", { "ignore": [1, 0, -1], "ignoreArrayIndexes": true}],
|
||||
"no-multi-str": 1,
|
||||
"no-mixed-spaces-and-tabs": 1,
|
||||
"no-proto": 1,
|
||||
"no-sequences": 1,
|
||||
"no-throw-literal": 1,
|
||||
"no-unmodified-loop-condition": 1,
|
||||
"no-useless-call": 1,
|
||||
"no-void": 1,
|
||||
"no-with": 2,
|
||||
"wrap-iife": 1,
|
||||
"no-redeclare": 1,
|
||||
"no-unused-vars": ["error", { "vars": "all", "args": "none" }],
|
||||
"no-sparse-arrays": 1
|
||||
}
|
||||
}
|
||||
5
node_modules/string-split-by/.travis.yml
generated
vendored
Normal file
5
node_modules/string-split-by/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- '6'
|
||||
- '5'
|
||||
- '4'
|
||||
56
node_modules/string-split-by/index.js
generated
vendored
Normal file
56
node_modules/string-split-by/index.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
'use strict'
|
||||
|
||||
var paren = require('parenthesis')
|
||||
|
||||
module.exports = function splitBy (string, separator, o) {
|
||||
if (string == null) throw Error('First argument should be a string')
|
||||
if (separator == null) throw Error('Separator should be a string or a RegExp')
|
||||
|
||||
if (!o) o = {}
|
||||
else if (typeof o === 'string' || Array.isArray(o)) {
|
||||
o = {ignore: o}
|
||||
}
|
||||
|
||||
if (o.escape == null) o.escape = true
|
||||
if (o.ignore == null) o.ignore = ['[]', '()', '{}', '<>', '""', "''", '``', '“”', '«»']
|
||||
else {
|
||||
if (typeof o.ignore === 'string') {o.ignore = [o.ignore]}
|
||||
|
||||
o.ignore = o.ignore.map(function (pair) {
|
||||
// '"' → '""'
|
||||
if (pair.length === 1) pair = pair + pair
|
||||
return pair
|
||||
})
|
||||
}
|
||||
|
||||
var tokens = paren.parse(string, {flat: true, brackets: o.ignore})
|
||||
var str = tokens[0]
|
||||
|
||||
var parts = str.split(separator)
|
||||
|
||||
// join parts separated by escape
|
||||
if (o.escape) {
|
||||
var cleanParts = []
|
||||
for (var i = 0; i < parts.length; i++) {
|
||||
var prev = parts[i]
|
||||
var part = parts[i + 1]
|
||||
|
||||
if (prev[prev.length - 1] === '\\' && prev[prev.length - 2] !== '\\') {
|
||||
cleanParts.push(prev + separator + part)
|
||||
i++
|
||||
}
|
||||
else {
|
||||
cleanParts.push(prev)
|
||||
}
|
||||
}
|
||||
parts = cleanParts
|
||||
}
|
||||
|
||||
// open parens pack & apply unquotes, if any
|
||||
for (var i = 0; i < parts.length; i++) {
|
||||
tokens[0] = parts[i]
|
||||
parts[i] = paren.stringify(tokens, {flat: true})
|
||||
}
|
||||
|
||||
return parts
|
||||
}
|
||||
33
node_modules/string-split-by/package.json
generated
vendored
Normal file
33
node_modules/string-split-by/package.json
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "string-split-by",
|
||||
"version": "1.0.0",
|
||||
"description": "Split string by any separator excluding brackets, quotes and escaped characters",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/dy/string-split-by.git"
|
||||
},
|
||||
"keywords": [
|
||||
"split-string",
|
||||
"string-split",
|
||||
"split-stirng-words",
|
||||
"space",
|
||||
"string",
|
||||
"split"
|
||||
],
|
||||
"author": "Dmitry Yv <dfcreative@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/dy/string-split-by/issues"
|
||||
},
|
||||
"homepage": "https://github.com/dy/string-split-by#readme",
|
||||
"dependencies": {
|
||||
"parenthesis": "^3.1.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tape": "^4.9.0"
|
||||
}
|
||||
}
|
||||
38
node_modules/string-split-by/readme.md
generated
vendored
Normal file
38
node_modules/string-split-by/readme.md
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# string-split-by [](http://github.com/badges/stability-badges) [](https://travis-ci.org/dy/string-split-by)
|
||||
|
||||
Split string by a separator with respect to brackets, quotes and escape markers. Optimized version of [string-split](https://github.com/jonschlinkert/split-string).
|
||||
|
||||
## Usage
|
||||
|
||||
[](https://npmjs.org/package/string-split-by/)
|
||||
|
||||
|
||||
```js
|
||||
var split = require('string-split-by')
|
||||
|
||||
split('a."b.c".d.{.e.f.g.}.h', '.')
|
||||
// ['a', '"b.c"', 'd', '{.e.f.g.}', 'h']
|
||||
|
||||
split('a."b.c".d.{.e.f.g.}.h', '.', {ignore: '""'})
|
||||
// ['a', '"b.c"', 'd', '{', 'e', 'f', 'g', '}', 'h']
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### parts = splitBy(string, separator, options?)
|
||||
|
||||
Return array with parts split from string by a separator, which can be whether _String_ or _RegExp_. Options can define:
|
||||
|
||||
Option | Default | Meaning
|
||||
---|---|---
|
||||
`ignore` | ``['"', "'", '`', '“”', '«»', '[]', '()', '{}']`` | Avoid splitting content enclosed in the character pairs. Can be a string or a list of strings.
|
||||
`escape` | `true` | Avoid splitting at the escaped separator, eg. `\.` won't be separated by `'.'` separator.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
* [parenthesis](http://npmjs.org/package/parenthesis)
|
||||
|
||||
## License
|
||||
|
||||
© 2018 Dmitry Yv. MIT License
|
||||
175
node_modules/string-split-by/test.js
generated
vendored
Normal file
175
node_modules/string-split-by/test.js
generated
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
'use strict';
|
||||
|
||||
var t = require('tape')
|
||||
var split = require('.');
|
||||
|
||||
t('should throw an error when arguments are invalid', t => {
|
||||
t.throws(() => split());
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('readme', t => {
|
||||
|
||||
t.deepEqual(
|
||||
split('a."b.c".d.{.e.f.g.}.h', '.'),
|
||||
['a', '"b.c"', 'd', '{.e.f.g.}', 'h']
|
||||
)
|
||||
|
||||
t.deepEqual(
|
||||
split('a."b.c".d.{.e.f.g.}.h', '.', {ignore: '""'}),
|
||||
['a', '"b.c"', 'd', '{', 'e', 'f', 'g', '}', 'h']
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
t('should not split on escaped dots:', t => {
|
||||
t.deepEqual(split('a.b.c\\.d', '.'), ['a', 'b', 'c\\.d']);
|
||||
t.deepEqual(split('a.b.c\\.d.e', '.'), ['a', 'b', 'c\\.d', 'e']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should keep escaping when followed by a backslash:', t => {
|
||||
t.deepEqual(split('a.b.c\\\\.d', '.'), ['a', 'b', 'c\\\\', 'd']);
|
||||
t.deepEqual(split('a.b.c\\\\d', '.'), ['a', 'b', 'c\\\\d']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should split a string on dots by default:', t => {
|
||||
t.deepEqual(split('a.b.c', '.'), ['a', 'b', 'c']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should respect double-quoted strings', t => {
|
||||
t.deepEqual(split('"b.c"', '.'), ['"b.c"']);
|
||||
t.deepEqual(split('a."b.c"', '.'), ['a', '"b.c"']);
|
||||
t.deepEqual(split('a".b.c"', '.'), ['a".b.c"']);
|
||||
t.deepEqual(split('a."b.c".d', '.'), ['a', '"b.c"', 'd']);
|
||||
t.deepEqual(split('a."b.c".d.".e.f.g.".h', '.'), ['a', '"b.c"', 'd', '".e.f.g."', 'h']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should respect singlequoted strings', t => {
|
||||
t.deepEqual(split('\'b.c\'', '.'), ['\'b.c\'']);
|
||||
t.deepEqual(split('a.\'b.c\'', '.'), ['a', '\'b.c\'']);
|
||||
t.deepEqual(split('a.\'b.c\'.d', '.'), ['a', '\'b.c\'', 'd']);
|
||||
t.deepEqual(split('a.\'b.c\'.d.\'.e.f.g.\'.h', '.'), ['a', '\'b.c\'', 'd', '\'.e.f.g.\'', 'h']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should respect strings in backticks', t => {
|
||||
t.deepEqual(split('`b.c`', '.'), ['`b.c`']);
|
||||
t.deepEqual(split('a.`b.c`', '.'), ['a', '`b.c`']);
|
||||
t.deepEqual(split('a.`b.c`.d', '.'), ['a', '`b.c`', 'd']);
|
||||
t.deepEqual(split('a.`b.c`.d.`.e.f.g.`.h', '.'), ['a', '`b.c`', 'd', '`.e.f.g.`', 'h']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should respect strings in double smart-quotes: “”', t => {
|
||||
t.deepEqual(split('“b.c”', '.'), ['“b.c”']);
|
||||
t.deepEqual(split('a.“b.c”', '.'), ['a', '“b.c”']);
|
||||
t.deepEqual(split('a.“b.c”.d', '.'), ['a', '“b.c”', 'd']);
|
||||
t.deepEqual(split('a.“b.c”.d.“.e.f.g.”.h', '.'), ['a', '“b.c”', 'd', '“.e.f.g.”', 'h']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should retain unclosed double quotes in the results', t => {
|
||||
t.deepEqual(split('a."b.c', '.'), ['a', '"b', 'c']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should retain unclosed single quotes in the results', t => {
|
||||
t.deepEqual(split('brian\'s', '.'), ['brian\'s']);
|
||||
t.deepEqual(split('a.\'b.c', '.'), ['a', '\'b', 'c']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
|
||||
|
||||
t('should split on a custom separator', t => {
|
||||
t.deepEqual(split('a/b/c', '/'), ['a', 'b', 'c']);
|
||||
t.deepEqual(split('a,b,c', ','), ['a', 'b', 'c']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should not split on an escaped custom separator:', t => {
|
||||
t.deepEqual(split('a/b/c\\/d', '/'), ['a', 'b', 'c\\/d']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should disable quotes support', t => {
|
||||
t.deepEqual(split('a.\'b.c\'."d"', '.', {ignore: '"'}), ['a', '\'b', 'c\'', '"d"']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should keep single quotes', t => {
|
||||
t.deepEqual(split('a.\'b.c\'."d"', '.', {ignore: '\''}), ['a', '\'b.c\'', '"d"']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should keep double quotes', t => {
|
||||
t.deepEqual(split('a."b.c".d', '.', '"'), ['a', '"b.c"', 'd']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should keep “” double quotes', t => {
|
||||
t.deepEqual(split('a.“b.c”.d', '.', '“”'), ['a', '“b.c”', 'd']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should keep backticks', t => {
|
||||
t.deepEqual(split('a.`b.c`.d', '.', {ignore: '`'}), ['a', '`b.c`', 'd']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should allow custom quotes object', t => {
|
||||
t.deepEqual(split('a.^b.c$', '.', {ignore: '^$'}), ['a', '^b.c$']);
|
||||
t.deepEqual(split('a.^b.c^', '.', {ignore: '^^'}), ['a', '^b.c^']);
|
||||
t.deepEqual(split('a.~b.c~', '.', {ignore: '~~'}), ['a', '~b.c~']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should keep escape characters', t => {
|
||||
t.deepEqual(split('a.b\\.c', '.', {escape: true}), ['a', 'b\\.c']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t.skip('should throw when brackets are unclosed', t => {
|
||||
t.throws(function() {
|
||||
}, /unclosed/);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should not split inside brackets', t => {
|
||||
t.deepEqual(split('a.(b.c).d', '.'), ['a', '(b.c)', 'd']);
|
||||
t.deepEqual(split('a.[(b.c)].d', '.'), ['a', '[(b.c)]', 'd']);
|
||||
t.deepEqual(split('a.[b.c].d', '.'), ['a', '[b.c]', 'd']);
|
||||
t.deepEqual(split('a.{b.c}.d', '.'), ['a', '{b.c}', 'd']);
|
||||
t.deepEqual(split('a.<b.c>.d', '.'), ['a', '<b.c>', 'd']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should support nested brackets', t => {
|
||||
t.deepEqual(split('a.{b.{c}.d}.e', '.'), ['a', '{b.{c}.d}', 'e']);
|
||||
t.deepEqual(split('a.{b.{c.d}.e}.f', '.'), ['a', '{b.{c.d}.e}', 'f']);
|
||||
t.deepEqual(split('a.{[b.{{c.d}}.e]}.f', '.'), ['a', '{[b.{{c.d}}.e]}', 'f']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t.skip('should support escaped brackets', t => {
|
||||
t.deepEqual(split('a.\\{b.{c.c}.d}.e', '.'), ['a', '{b', '{c.c}', 'd}', 'e']);
|
||||
t.deepEqual(split('a.{b.c}.\\{d.e}.f', '.'), ['a', '{b.c}', '{d', 'e}', 'f']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should support quoted brackets', t => {
|
||||
t.deepEqual(split('a.{b.c}."{d.e}".f', '.'), ['a', '{b.c}', '"{d.e}"', 'f']);
|
||||
t.deepEqual(split('a.{b.c}.{"d.e"}.f', '.'), ['a', '{b.c}', '{"d.e"}', 'f']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
t('should ignore imbalanced brackets', t => {
|
||||
t.deepEqual(split('a.{b.c', '.'), ['a', '{b', 'c']);
|
||||
t.deepEqual(split('a.{a.{b.c}.d', '.'), ['a', '{a', '{b.c}', 'd']);
|
||||
t.end()
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user