blog menu page & blog article page
This commit is contained in:
1
node_modules/.bin/gulp
generated
vendored
Symbolic link
1
node_modules/.bin/gulp
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../gulp/bin/gulp.js
|
||||
1
node_modules/.bin/mkdirp
generated
vendored
Symbolic link
1
node_modules/.bin/mkdirp
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../mkdirp/bin/cmd.js
|
||||
1
node_modules/.bin/semver
generated
vendored
Symbolic link
1
node_modules/.bin/semver
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../semver/bin/semver
|
||||
1
node_modules/.bin/strip-bom
generated
vendored
Symbolic link
1
node_modules/.bin/strip-bom
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../strip-bom/cli.js
|
||||
1
node_modules/.bin/strip-indent
generated
vendored
Symbolic link
1
node_modules/.bin/strip-indent
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../strip-indent/cli.js
|
||||
1
node_modules/.bin/uglifyjs
generated
vendored
Symbolic link
1
node_modules/.bin/uglifyjs
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../uglify-js/bin/uglifyjs
|
||||
1
node_modules/.bin/user-home
generated
vendored
Symbolic link
1
node_modules/.bin/user-home
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../user-home/cli.js
|
||||
1
node_modules/.bin/which
generated
vendored
Symbolic link
1
node_modules/.bin/which
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../which/bin/which
|
||||
4
node_modules/ansi-regex/index.js
generated
vendored
Normal file
4
node_modules/ansi-regex/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
module.exports = function () {
|
||||
return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g;
|
||||
};
|
||||
21
node_modules/ansi-regex/license
generated
vendored
Normal file
21
node_modules/ansi-regex/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
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.
|
||||
109
node_modules/ansi-regex/package.json
generated
vendored
Normal file
109
node_modules/ansi-regex/package.json
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
{
|
||||
"_from": "ansi-regex@^2.0.0",
|
||||
"_id": "ansi-regex@2.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
|
||||
"_location": "/ansi-regex",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "ansi-regex@^2.0.0",
|
||||
"name": "ansi-regex",
|
||||
"escapedName": "ansi-regex",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/has-ansi",
|
||||
"/strip-ansi"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
||||
"_shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df",
|
||||
"_spec": "ansi-regex@^2.0.0",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/has-ansi",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/chalk/ansi-regex/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Regular expression for matching ANSI escape codes",
|
||||
"devDependencies": {
|
||||
"ava": "0.17.0",
|
||||
"xo": "0.16.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/chalk/ansi-regex#readme",
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"text",
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"match",
|
||||
"test",
|
||||
"find",
|
||||
"pattern"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
{
|
||||
"name": "Joshua Appelman",
|
||||
"email": "jappelman@xebia.com",
|
||||
"url": "jbnicolai.com"
|
||||
},
|
||||
{
|
||||
"name": "JD Ballard",
|
||||
"email": "i.am.qix@gmail.com",
|
||||
"url": "github.com/qix-"
|
||||
}
|
||||
],
|
||||
"name": "ansi-regex",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/chalk/ansi-regex.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava --verbose",
|
||||
"view-supported": "node fixtures/view-codes.js"
|
||||
},
|
||||
"version": "2.1.1",
|
||||
"xo": {
|
||||
"rules": {
|
||||
"guard-for-in": 0,
|
||||
"no-loop-func": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
39
node_modules/ansi-regex/readme.md
generated
vendored
Normal file
39
node_modules/ansi-regex/readme.md
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# ansi-regex [](https://travis-ci.org/chalk/ansi-regex)
|
||||
|
||||
> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save ansi-regex
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const ansiRegex = require('ansi-regex');
|
||||
|
||||
ansiRegex().test('\u001b[4mcake\u001b[0m');
|
||||
//=> true
|
||||
|
||||
ansiRegex().test('cake');
|
||||
//=> false
|
||||
|
||||
'\u001b[4mcake\u001b[0m'.match(ansiRegex());
|
||||
//=> ['\u001b[4m', '\u001b[0m']
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why do you test for codes not in the ECMA 48 standard?
|
||||
|
||||
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
|
||||
|
||||
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
65
node_modules/ansi-styles/index.js
generated
vendored
Normal file
65
node_modules/ansi-styles/index.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
'use strict';
|
||||
|
||||
function assembleStyles () {
|
||||
var styles = {
|
||||
modifiers: {
|
||||
reset: [0, 0],
|
||||
bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29]
|
||||
},
|
||||
colors: {
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
gray: [90, 39]
|
||||
},
|
||||
bgColors: {
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49]
|
||||
}
|
||||
};
|
||||
|
||||
// fix humans
|
||||
styles.colors.grey = styles.colors.gray;
|
||||
|
||||
Object.keys(styles).forEach(function (groupName) {
|
||||
var group = styles[groupName];
|
||||
|
||||
Object.keys(group).forEach(function (styleName) {
|
||||
var style = group[styleName];
|
||||
|
||||
styles[styleName] = group[styleName] = {
|
||||
open: '\u001b[' + style[0] + 'm',
|
||||
close: '\u001b[' + style[1] + 'm'
|
||||
};
|
||||
});
|
||||
|
||||
Object.defineProperty(styles, groupName, {
|
||||
value: group,
|
||||
enumerable: false
|
||||
});
|
||||
});
|
||||
|
||||
return styles;
|
||||
}
|
||||
|
||||
Object.defineProperty(module, 'exports', {
|
||||
enumerable: true,
|
||||
get: assembleStyles
|
||||
});
|
||||
21
node_modules/ansi-styles/license
generated
vendored
Normal file
21
node_modules/ansi-styles/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
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.
|
||||
90
node_modules/ansi-styles/package.json
generated
vendored
Normal file
90
node_modules/ansi-styles/package.json
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
{
|
||||
"_from": "ansi-styles@^2.2.1",
|
||||
"_id": "ansi-styles@2.2.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
|
||||
"_location": "/ansi-styles",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "ansi-styles@^2.2.1",
|
||||
"name": "ansi-styles",
|
||||
"escapedName": "ansi-styles",
|
||||
"rawSpec": "^2.2.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.2.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/chalk"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
|
||||
"_shasum": "b432dd3358b634cf75e1e4664368240533c1ddbe",
|
||||
"_spec": "ansi-styles@^2.2.1",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/chalk",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/chalk/ansi-styles/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "ANSI escape codes for styling strings in the terminal",
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/chalk/ansi-styles#readme",
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
{
|
||||
"name": "Joshua Appelman",
|
||||
"email": "jappelman@xebia.com",
|
||||
"url": "jbnicolai.com"
|
||||
}
|
||||
],
|
||||
"name": "ansi-styles",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/chalk/ansi-styles.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "2.2.1"
|
||||
}
|
||||
86
node_modules/ansi-styles/readme.md
generated
vendored
Normal file
86
node_modules/ansi-styles/readme.md
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
# ansi-styles [](https://travis-ci.org/chalk/ansi-styles)
|
||||
|
||||
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
||||
|
||||
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
||||
|
||||

|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save ansi-styles
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var ansi = require('ansi-styles');
|
||||
|
||||
console.log(ansi.green.open + 'Hello world!' + ansi.green.close);
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
Each style has an `open` and `close` property.
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(not widely supported)*
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `gray`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
|
||||
|
||||
## Advanced usage
|
||||
|
||||
By default you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
|
||||
|
||||
- `ansi.modifiers`
|
||||
- `ansi.colors`
|
||||
- `ansi.bgColors`
|
||||
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(ansi.colors.green.open);
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
4
node_modules/archy/.travis.yml
generated
vendored
Normal file
4
node_modules/archy/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.6
|
||||
- 0.8
|
||||
18
node_modules/archy/LICENSE
generated
vendored
Normal file
18
node_modules/archy/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
This software is released under the MIT license:
|
||||
|
||||
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.
|
||||
24
node_modules/archy/examples/beep.js
generated
vendored
Normal file
24
node_modules/archy/examples/beep.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
var archy = require('../');
|
||||
var s = archy({
|
||||
label : 'beep',
|
||||
nodes : [
|
||||
'ity',
|
||||
{
|
||||
label : 'boop',
|
||||
nodes : [
|
||||
{
|
||||
label : 'o_O',
|
||||
nodes : [
|
||||
{
|
||||
label : 'oh',
|
||||
nodes : [ 'hello', 'puny' ]
|
||||
},
|
||||
'human'
|
||||
]
|
||||
},
|
||||
'party\ntime!'
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
console.log(s);
|
||||
25
node_modules/archy/examples/multi_line.js
generated
vendored
Normal file
25
node_modules/archy/examples/multi_line.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
var archy = require('../');
|
||||
|
||||
var s = archy({
|
||||
label : 'beep\none\ntwo',
|
||||
nodes : [
|
||||
'ity',
|
||||
{
|
||||
label : 'boop',
|
||||
nodes : [
|
||||
{
|
||||
label : 'o_O\nwheee',
|
||||
nodes : [
|
||||
{
|
||||
label : 'oh',
|
||||
nodes : [ 'hello', 'puny\nmeat' ]
|
||||
},
|
||||
'creature'
|
||||
]
|
||||
},
|
||||
'party\ntime!'
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
console.log(s);
|
||||
35
node_modules/archy/index.js
generated
vendored
Normal file
35
node_modules/archy/index.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
module.exports = function archy (obj, prefix, opts) {
|
||||
if (prefix === undefined) prefix = '';
|
||||
if (!opts) opts = {};
|
||||
var chr = function (s) {
|
||||
var chars = {
|
||||
'│' : '|',
|
||||
'└' : '`',
|
||||
'├' : '+',
|
||||
'─' : '-',
|
||||
'┬' : '-'
|
||||
};
|
||||
return opts.unicode === false ? chars[s] : s;
|
||||
};
|
||||
|
||||
if (typeof obj === 'string') obj = { label : obj };
|
||||
|
||||
var nodes = obj.nodes || [];
|
||||
var lines = (obj.label || '').split('\n');
|
||||
var splitter = '\n' + prefix + (nodes.length ? chr('│') : ' ') + ' ';
|
||||
|
||||
return prefix
|
||||
+ lines.join(splitter) + '\n'
|
||||
+ nodes.map(function (node, ix) {
|
||||
var last = ix === nodes.length - 1;
|
||||
var more = node.nodes && node.nodes.length;
|
||||
var prefix_ = prefix + (last ? ' ' : chr('│')) + ' ';
|
||||
|
||||
return prefix
|
||||
+ (last ? chr('└') : chr('├')) + chr('─')
|
||||
+ (more ? chr('┬') : chr('─')) + ' '
|
||||
+ archy(node, prefix_, opts).slice(prefix.length + 2)
|
||||
;
|
||||
}).join('')
|
||||
;
|
||||
};
|
||||
83
node_modules/archy/package.json
generated
vendored
Normal file
83
node_modules/archy/package.json
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"_from": "archy@^1.0.0",
|
||||
"_id": "archy@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=",
|
||||
"_location": "/archy",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "archy@^1.0.0",
|
||||
"name": "archy",
|
||||
"escapedName": "archy",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gulp"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz",
|
||||
"_shasum": "f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40",
|
||||
"_spec": "archy@^1.0.0",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/gulp",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/node-archy/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "render nested hierarchies `npm ls` style with unicode pipes",
|
||||
"devDependencies": {
|
||||
"tap": "~0.3.3",
|
||||
"tape": "~0.1.1"
|
||||
},
|
||||
"homepage": "https://github.com/substack/node-archy#readme",
|
||||
"keywords": [
|
||||
"hierarchy",
|
||||
"npm ls",
|
||||
"unicode",
|
||||
"pretty",
|
||||
"print"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "archy",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/substack/node-archy.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": {
|
||||
"iexplore": [
|
||||
"6.0",
|
||||
"7.0",
|
||||
"8.0",
|
||||
"9.0"
|
||||
],
|
||||
"chrome": [
|
||||
"20.0"
|
||||
],
|
||||
"firefox": [
|
||||
"10.0",
|
||||
"15.0"
|
||||
],
|
||||
"safari": [
|
||||
"5.1"
|
||||
],
|
||||
"opera": [
|
||||
"12.0"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
88
node_modules/archy/readme.markdown
generated
vendored
Normal file
88
node_modules/archy/readme.markdown
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
# archy
|
||||
|
||||
Render nested hierarchies `npm ls` style with unicode pipes.
|
||||
|
||||
[](http://ci.testling.com/substack/node-archy)
|
||||
|
||||
[](http://travis-ci.org/substack/node-archy)
|
||||
|
||||
# example
|
||||
|
||||
``` js
|
||||
var archy = require('archy');
|
||||
var s = archy({
|
||||
label : 'beep',
|
||||
nodes : [
|
||||
'ity',
|
||||
{
|
||||
label : 'boop',
|
||||
nodes : [
|
||||
{
|
||||
label : 'o_O',
|
||||
nodes : [
|
||||
{
|
||||
label : 'oh',
|
||||
nodes : [ 'hello', 'puny' ]
|
||||
},
|
||||
'human'
|
||||
]
|
||||
},
|
||||
'party\ntime!'
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
console.log(s);
|
||||
```
|
||||
|
||||
output
|
||||
|
||||
```
|
||||
beep
|
||||
├── ity
|
||||
└─┬ boop
|
||||
├─┬ o_O
|
||||
│ ├─┬ oh
|
||||
│ │ ├── hello
|
||||
│ │ └── puny
|
||||
│ └── human
|
||||
└── party
|
||||
time!
|
||||
```
|
||||
|
||||
# methods
|
||||
|
||||
var archy = require('archy')
|
||||
|
||||
## archy(obj, prefix='', opts={})
|
||||
|
||||
Return a string representation of `obj` with unicode pipe characters like how
|
||||
`npm ls` looks.
|
||||
|
||||
`obj` should be a tree of nested objects with `'label'` and `'nodes'` fields.
|
||||
`'label'` is a string of text to display at a node level and `'nodes'` is an
|
||||
array of the descendents of the current node.
|
||||
|
||||
If a node is a string, that string will be used as the `'label'` and an empty
|
||||
array of `'nodes'` will be used.
|
||||
|
||||
`prefix` gets prepended to all the lines and is used by the algorithm to
|
||||
recursively update.
|
||||
|
||||
If `'label'` has newlines they will be indented at the present indentation level
|
||||
with the current prefix.
|
||||
|
||||
To disable unicode results in favor of all-ansi output set `opts.unicode` to
|
||||
`false`.
|
||||
|
||||
# install
|
||||
|
||||
With [npm](http://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install archy
|
||||
```
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
||||
40
node_modules/archy/test/beep.js
generated
vendored
Normal file
40
node_modules/archy/test/beep.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
var test = require('tape');
|
||||
var archy = require('../');
|
||||
|
||||
test('beep', function (t) {
|
||||
var s = archy({
|
||||
label : 'beep',
|
||||
nodes : [
|
||||
'ity',
|
||||
{
|
||||
label : 'boop',
|
||||
nodes : [
|
||||
{
|
||||
label : 'o_O',
|
||||
nodes : [
|
||||
{
|
||||
label : 'oh',
|
||||
nodes : [ 'hello', 'puny' ]
|
||||
},
|
||||
'human'
|
||||
]
|
||||
},
|
||||
'party!'
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
t.equal(s, [
|
||||
'beep',
|
||||
'├── ity',
|
||||
'└─┬ boop',
|
||||
' ├─┬ o_O',
|
||||
' │ ├─┬ oh',
|
||||
' │ │ ├── hello',
|
||||
' │ │ └── puny',
|
||||
' │ └── human',
|
||||
' └── party!',
|
||||
''
|
||||
].join('\n'));
|
||||
t.end();
|
||||
});
|
||||
45
node_modules/archy/test/multi_line.js
generated
vendored
Normal file
45
node_modules/archy/test/multi_line.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
var test = require('tape');
|
||||
var archy = require('../');
|
||||
|
||||
test('multi-line', function (t) {
|
||||
var s = archy({
|
||||
label : 'beep\none\ntwo',
|
||||
nodes : [
|
||||
'ity',
|
||||
{
|
||||
label : 'boop',
|
||||
nodes : [
|
||||
{
|
||||
label : 'o_O\nwheee',
|
||||
nodes : [
|
||||
{
|
||||
label : 'oh',
|
||||
nodes : [ 'hello', 'puny\nmeat' ]
|
||||
},
|
||||
'creature'
|
||||
]
|
||||
},
|
||||
'party\ntime!'
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
t.equal(s, [
|
||||
'beep',
|
||||
'│ one',
|
||||
'│ two',
|
||||
'├── ity',
|
||||
'└─┬ boop',
|
||||
' ├─┬ o_O',
|
||||
' │ │ wheee',
|
||||
' │ ├─┬ oh',
|
||||
' │ │ ├── hello',
|
||||
' │ │ └── puny',
|
||||
' │ │ meat',
|
||||
' │ └── creature',
|
||||
' └── party',
|
||||
' time!',
|
||||
''
|
||||
].join('\n'));
|
||||
t.end();
|
||||
});
|
||||
40
node_modules/archy/test/non_unicode.js
generated
vendored
Normal file
40
node_modules/archy/test/non_unicode.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
var test = require('tape');
|
||||
var archy = require('../');
|
||||
|
||||
test('beep', function (t) {
|
||||
var s = archy({
|
||||
label : 'beep',
|
||||
nodes : [
|
||||
'ity',
|
||||
{
|
||||
label : 'boop',
|
||||
nodes : [
|
||||
{
|
||||
label : 'o_O',
|
||||
nodes : [
|
||||
{
|
||||
label : 'oh',
|
||||
nodes : [ 'hello', 'puny' ]
|
||||
},
|
||||
'human'
|
||||
]
|
||||
},
|
||||
'party!'
|
||||
]
|
||||
}
|
||||
]
|
||||
}, '', { unicode : false });
|
||||
t.equal(s, [
|
||||
'beep',
|
||||
'+-- ity',
|
||||
'`-- boop',
|
||||
' +-- o_O',
|
||||
' | +-- oh',
|
||||
' | | +-- hello',
|
||||
' | | `-- puny',
|
||||
' | `-- human',
|
||||
' `-- party!',
|
||||
''
|
||||
].join('\n'));
|
||||
t.end();
|
||||
});
|
||||
21
node_modules/arr-diff/LICENSE
generated
vendored
Executable file
21
node_modules/arr-diff/LICENSE
generated
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2015, Jon Schlinkert.
|
||||
|
||||
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.
|
||||
74
node_modules/arr-diff/README.md
generated
vendored
Normal file
74
node_modules/arr-diff/README.md
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
# arr-diff [](https://www.npmjs.com/package/arr-diff) [](https://travis-ci.org/jonschlinkert/base)
|
||||
|
||||
> Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/)
|
||||
|
||||
```sh
|
||||
$ npm i arr-diff --save
|
||||
```
|
||||
Install with [bower](http://bower.io/)
|
||||
|
||||
```sh
|
||||
$ bower install arr-diff --save
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### [diff](index.js#L33)
|
||||
|
||||
Return the difference between the first array and additional arrays.
|
||||
|
||||
**Params**
|
||||
|
||||
* `a` **{Array}**
|
||||
* `b` **{Array}**
|
||||
* `returns` **{Array}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var diff = require('arr-diff');
|
||||
|
||||
var a = ['a', 'b', 'c', 'd'];
|
||||
var b = ['b', 'c'];
|
||||
|
||||
console.log(diff(a, b))
|
||||
//=> ['a', 'd']
|
||||
```
|
||||
|
||||
## Related projects
|
||||
|
||||
* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten)
|
||||
* [array-filter](https://www.npmjs.com/package/array-filter): Array#filter for older browsers. | [homepage](https://github.com/juliangruber/array-filter)
|
||||
* [array-intersection](https://www.npmjs.com/package/array-intersection): Return an array with the unique values present in _all_ given arrays using strict equality… [more](https://www.npmjs.com/package/array-intersection) | [homepage](https://github.com/jonschlinkert/array-intersection)
|
||||
|
||||
## Running tests
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```sh
|
||||
$ npm i -d && npm test
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/arr-diff/issues/new).
|
||||
|
||||
## Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert)
|
||||
Released under the MIT license.
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb](https://github.com/verbose/verb) on Sat Dec 05 2015 23:24:53 GMT-0500 (EST)._
|
||||
58
node_modules/arr-diff/index.js
generated
vendored
Normal file
58
node_modules/arr-diff/index.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
/*!
|
||||
* arr-diff <https://github.com/jonschlinkert/arr-diff>
|
||||
*
|
||||
* Copyright (c) 2014 Jon Schlinkert, contributors.
|
||||
* Licensed under the MIT License
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var flatten = require('arr-flatten');
|
||||
var slice = [].slice;
|
||||
|
||||
/**
|
||||
* Return the difference between the first array and
|
||||
* additional arrays.
|
||||
*
|
||||
* ```js
|
||||
* var diff = require('{%= name %}');
|
||||
*
|
||||
* var a = ['a', 'b', 'c', 'd'];
|
||||
* var b = ['b', 'c'];
|
||||
*
|
||||
* console.log(diff(a, b))
|
||||
* //=> ['a', 'd']
|
||||
* ```
|
||||
*
|
||||
* @param {Array} `a`
|
||||
* @param {Array} `b`
|
||||
* @return {Array}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function diff(arr, arrays) {
|
||||
var argsLen = arguments.length;
|
||||
var len = arr.length, i = -1;
|
||||
var res = [], arrays;
|
||||
|
||||
if (argsLen === 1) {
|
||||
return arr;
|
||||
}
|
||||
|
||||
if (argsLen > 2) {
|
||||
arrays = flatten(slice.call(arguments, 1));
|
||||
}
|
||||
|
||||
while (++i < len) {
|
||||
if (!~arrays.indexOf(arr[i])) {
|
||||
res.push(arr[i]);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose `diff`
|
||||
*/
|
||||
|
||||
module.exports = diff;
|
||||
80
node_modules/arr-diff/package.json
generated
vendored
Normal file
80
node_modules/arr-diff/package.json
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"_from": "arr-diff@^2.0.0",
|
||||
"_id": "arr-diff@2.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=",
|
||||
"_location": "/arr-diff",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "arr-diff@^2.0.0",
|
||||
"name": "arr-diff",
|
||||
"escapedName": "arr-diff",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/micromatch"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz",
|
||||
"_shasum": "8f3b827f955a8bd669697e4a4256ac3ceae356cf",
|
||||
"_spec": "arr-diff@^2.0.0",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/micromatch",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/arr-diff/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"arr-flatten": "^1.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.",
|
||||
"devDependencies": {
|
||||
"array-differ": "^1.0.0",
|
||||
"array-slice": "^0.2.3",
|
||||
"benchmarked": "^0.1.4",
|
||||
"chalk": "^1.1.1",
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jonschlinkert/arr-diff",
|
||||
"keywords": [
|
||||
"arr",
|
||||
"array",
|
||||
"diff",
|
||||
"differ",
|
||||
"difference"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "arr-diff",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/arr-diff.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"verb": {
|
||||
"related": {
|
||||
"list": [
|
||||
"arr-flatten",
|
||||
"array-filter",
|
||||
"array-intersection"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": "2.0.0"
|
||||
}
|
||||
21
node_modules/arr-flatten/LICENSE
generated
vendored
Executable file
21
node_modules/arr-flatten/LICENSE
generated
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
|
||||
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.
|
||||
86
node_modules/arr-flatten/README.md
generated
vendored
Executable file
86
node_modules/arr-flatten/README.md
generated
vendored
Executable file
@@ -0,0 +1,86 @@
|
||||
# arr-flatten [](https://www.npmjs.com/package/arr-flatten) [](https://npmjs.org/package/arr-flatten) [](https://npmjs.org/package/arr-flatten) [](https://travis-ci.org/jonschlinkert/arr-flatten) [](https://ci.appveyor.com/project/jonschlinkert/arr-flatten)
|
||||
|
||||
> Recursively flatten an array or arrays.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save arr-flatten
|
||||
```
|
||||
|
||||
## Install
|
||||
|
||||
Install with [bower](https://bower.io/)
|
||||
|
||||
```sh
|
||||
$ bower install arr-flatten --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var flatten = require('arr-flatten');
|
||||
|
||||
flatten(['a', ['b', ['c']], 'd', ['e']]);
|
||||
//=> ['a', 'b', 'c', 'd', 'e']
|
||||
```
|
||||
|
||||
## Why another flatten utility?
|
||||
|
||||
I wanted the fastest implementation I could find, with implementation choices that should work for 95% of use cases, but no cruft to cover the other 5%.
|
||||
|
||||
## About
|
||||
|
||||
### Related projects
|
||||
|
||||
* [arr-filter](https://www.npmjs.com/package/arr-filter): Faster alternative to javascript's native filter method. | [homepage](https://github.com/jonschlinkert/arr-filter "Faster alternative to javascript's native filter method.")
|
||||
* [arr-union](https://www.npmjs.com/package/arr-union): Combines a list of arrays, returning a single array with unique values, using strict equality… [more](https://github.com/jonschlinkert/arr-union) | [homepage](https://github.com/jonschlinkert/arr-union "Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.")
|
||||
* [array-each](https://www.npmjs.com/package/array-each): Loop over each item in an array and call the given function on every element. | [homepage](https://github.com/jonschlinkert/array-each "Loop over each item in an array and call the given function on every element.")
|
||||
* [array-unique](https://www.npmjs.com/package/array-unique): Remove duplicate values from an array. Fastest ES5 implementation. | [homepage](https://github.com/jonschlinkert/array-unique "Remove duplicate values from an array. Fastest ES5 implementation.")
|
||||
|
||||
### Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 20 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 1 | [lukeed](https://github.com/lukeed) |
|
||||
|
||||
### Building docs
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
### Running tests
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 05, 2017._
|
||||
22
node_modules/arr-flatten/index.js
generated
vendored
Normal file
22
node_modules/arr-flatten/index.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*!
|
||||
* arr-flatten <https://github.com/jonschlinkert/arr-flatten>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = function (arr) {
|
||||
return flat(arr, []);
|
||||
};
|
||||
|
||||
function flat(arr, res) {
|
||||
var i = 0, cur;
|
||||
var len = arr.length;
|
||||
for (; i < len; i++) {
|
||||
cur = arr[i];
|
||||
Array.isArray(cur) ? flat(cur, res) : res.push(cur);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
113
node_modules/arr-flatten/package.json
generated
vendored
Normal file
113
node_modules/arr-flatten/package.json
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"_from": "arr-flatten@^1.0.1",
|
||||
"_id": "arr-flatten@1.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==",
|
||||
"_location": "/arr-flatten",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "arr-flatten@^1.0.1",
|
||||
"name": "arr-flatten",
|
||||
"escapedName": "arr-flatten",
|
||||
"rawSpec": "^1.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/arr-diff"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
|
||||
"_shasum": "36048bbff4e7b47e136644316c99669ea5ae91f1",
|
||||
"_spec": "arr-flatten@^1.0.1",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/arr-diff",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/arr-flatten/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "http://twitter.com/jonschlinkert"
|
||||
},
|
||||
{
|
||||
"name": "Luke Edwards",
|
||||
"url": "https://lukeed.com"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "Recursively flatten an array or arrays.",
|
||||
"devDependencies": {
|
||||
"ansi-bold": "^0.1.1",
|
||||
"array-flatten": "^2.1.1",
|
||||
"array-slice": "^1.0.0",
|
||||
"benchmarked": "^1.0.0",
|
||||
"compute-flatten": "^1.0.0",
|
||||
"flatit": "^1.1.1",
|
||||
"flatten": "^1.0.2",
|
||||
"flatten-array": "^1.0.0",
|
||||
"glob": "^7.1.1",
|
||||
"gulp-format-md": "^0.1.12",
|
||||
"just-flatten-it": "^1.1.23",
|
||||
"lodash.flattendeep": "^4.4.0",
|
||||
"m_flattened": "^1.0.1",
|
||||
"mocha": "^3.2.0",
|
||||
"utils-flatten": "^1.0.0",
|
||||
"write": "^0.3.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jonschlinkert/arr-flatten",
|
||||
"keywords": [
|
||||
"arr",
|
||||
"array",
|
||||
"elements",
|
||||
"flat",
|
||||
"flatten",
|
||||
"nested",
|
||||
"recurse",
|
||||
"recursive",
|
||||
"recursively"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "arr-flatten",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/arr-flatten.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"verb": {
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"arr-filter",
|
||||
"arr-union",
|
||||
"array-each",
|
||||
"array-unique"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
},
|
||||
"version": "1.1.0"
|
||||
}
|
||||
7
node_modules/array-differ/index.js
generated
vendored
Normal file
7
node_modules/array-differ/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
module.exports = function (arr) {
|
||||
var rest = [].concat.apply([], [].slice.call(arguments, 1));
|
||||
return arr.filter(function (el) {
|
||||
return rest.indexOf(el) === -1;
|
||||
});
|
||||
};
|
||||
64
node_modules/array-differ/package.json
generated
vendored
Normal file
64
node_modules/array-differ/package.json
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"_from": "array-differ@^1.0.0",
|
||||
"_id": "array-differ@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=",
|
||||
"_location": "/array-differ",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "array-differ@^1.0.0",
|
||||
"name": "array-differ",
|
||||
"escapedName": "array-differ",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gulp-util"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz",
|
||||
"_shasum": "eff52e3758249d33be402b8bb8e564bb2b5d4031",
|
||||
"_spec": "array-differ@^1.0.0",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/gulp-util",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/array-differ/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Create an array with values that are present in the first input array but not additional ones",
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/array-differ#readme",
|
||||
"keywords": [
|
||||
"array",
|
||||
"difference",
|
||||
"diff",
|
||||
"differ",
|
||||
"filter",
|
||||
"exclude"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "array-differ",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/array-differ.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
41
node_modules/array-differ/readme.md
generated
vendored
Normal file
41
node_modules/array-differ/readme.md
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
# array-differ [](https://travis-ci.org/sindresorhus/array-differ)
|
||||
|
||||
> Create an array with values that are present in the first input array but not additional ones
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save array-differ
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var arrayDiffer = require('array-differ');
|
||||
|
||||
arrayDiffer([2, 3, 4], [3, 50]);
|
||||
//=> [2, 4]
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### arrayDiffer(input, values, [values, ...])
|
||||
|
||||
Returns the new array.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `array`
|
||||
|
||||
#### values
|
||||
|
||||
Type: `array`
|
||||
|
||||
Arrays of values to exclude.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
21
node_modules/array-each/LICENSE
generated
vendored
Normal file
21
node_modules/array-each/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015, 2017, Jon Schlinkert
|
||||
|
||||
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.
|
||||
84
node_modules/array-each/README.md
generated
vendored
Normal file
84
node_modules/array-each/README.md
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
# array-each [](https://www.npmjs.com/package/array-each) [](https://npmjs.org/package/array-each) [](https://npmjs.org/package/array-each) [](https://travis-ci.org/jonschlinkert/array-each)
|
||||
|
||||
> Loop over each item in an array and call the given function on every element.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save array-each
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### [each](index.js#L34)
|
||||
|
||||
Loop over each item in an array and call the given function on every element.
|
||||
|
||||
**Params**
|
||||
|
||||
* `array` **{Array}**
|
||||
* `fn` **{Function}**
|
||||
* `thisArg` **{Object}**: (optional) pass a `thisArg` to be used as the context in which to call the function.
|
||||
* `returns` **{undefined}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
each(['a', 'b', 'c'], function(ele) {
|
||||
return ele + ele;
|
||||
});
|
||||
//=> ['aa', 'bb', 'cc']
|
||||
|
||||
each(['a', 'b', 'c'], function(ele, i) {
|
||||
return i + ele;
|
||||
});
|
||||
//=> ['0a', '1b', '2c']
|
||||
```
|
||||
|
||||
## About
|
||||
|
||||
### Related projects
|
||||
|
||||
* [arr-filter](https://www.npmjs.com/package/arr-filter): Faster alternative to javascript's native filter method. | [homepage](https://github.com/jonschlinkert/arr-filter "Faster alternative to javascript's native filter method.")
|
||||
* [arr-map](https://www.npmjs.com/package/arr-map): Faster, node.js focused alternative to JavaScript's native array map. | [homepage](https://github.com/jonschlinkert/arr-map "Faster, node.js focused alternative to JavaScript's native array map.")
|
||||
* [collection-map](https://www.npmjs.com/package/collection-map): Returns an array of mapped values from an array or object. | [homepage](https://github.com/jonschlinkert/collection-map "Returns an array of mapped values from an array or object.")
|
||||
|
||||
### Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
### Building docs
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
### Running tests
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.2, on February 26, 2017._
|
||||
46
node_modules/array-each/index.js
generated
vendored
Normal file
46
node_modules/array-each/index.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/*!
|
||||
* array-each <https://github.com/jonschlinkert/array-each>
|
||||
*
|
||||
* Copyright (c) 2015, 2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Loop over each item in an array and call the given function on every element.
|
||||
*
|
||||
* ```js
|
||||
* each(['a', 'b', 'c'], function(ele) {
|
||||
* return ele + ele;
|
||||
* });
|
||||
* //=> ['aa', 'bb', 'cc']
|
||||
*
|
||||
* each(['a', 'b', 'c'], function(ele, i) {
|
||||
* return i + ele;
|
||||
* });
|
||||
* //=> ['0a', '1b', '2c']
|
||||
* ```
|
||||
*
|
||||
* @name each
|
||||
* @alias forEach
|
||||
* @param {Array} `array`
|
||||
* @param {Function} `fn`
|
||||
* @param {Object} `thisArg` (optional) pass a `thisArg` to be used as the context in which to call the function.
|
||||
* @return {undefined}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function each(arr, cb, thisArg) {
|
||||
if (arr == null) return;
|
||||
|
||||
var len = arr.length;
|
||||
var idx = -1;
|
||||
|
||||
while (++idx < len) {
|
||||
var ele = arr[idx];
|
||||
if (cb.call(thisArg, ele, idx, arr) === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
81
node_modules/array-each/package.json
generated
vendored
Normal file
81
node_modules/array-each/package.json
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"_from": "array-each@^1.0.1",
|
||||
"_id": "array-each@1.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=",
|
||||
"_location": "/array-each",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "array-each@^1.0.1",
|
||||
"name": "array-each",
|
||||
"escapedName": "array-each",
|
||||
"rawSpec": "^1.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/object.defaults"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz",
|
||||
"_shasum": "a794af0c05ab1752846ee753a1f211a05ba0c44f",
|
||||
"_spec": "array-each@^1.0.1",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/object.defaults",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/array-each/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Loop over each item in an array and call the given function on every element.",
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^0.1.11",
|
||||
"mocha": "^3.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jonschlinkert/array-each",
|
||||
"keywords": [
|
||||
"array",
|
||||
"each"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "array-each",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/array-each.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"verb": {
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"collection-map",
|
||||
"arr-filter",
|
||||
"arr-map"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
||||
25
node_modules/array-find-index/index.js
generated
vendored
Normal file
25
node_modules/array-find-index/index.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
module.exports = function (arr, predicate, ctx) {
|
||||
if (typeof Array.prototype.findIndex === 'function') {
|
||||
return arr.findIndex(predicate, ctx);
|
||||
}
|
||||
|
||||
if (typeof predicate !== 'function') {
|
||||
throw new TypeError('predicate must be a function');
|
||||
}
|
||||
|
||||
var list = Object(arr);
|
||||
var len = list.length;
|
||||
|
||||
if (len === 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (predicate.call(ctx, list[i], i, list)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
21
node_modules/array-find-index/license
generated
vendored
Normal file
21
node_modules/array-find-index/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
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.
|
||||
67
node_modules/array-find-index/package.json
generated
vendored
Normal file
67
node_modules/array-find-index/package.json
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"_from": "array-find-index@^1.0.1",
|
||||
"_id": "array-find-index@1.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=",
|
||||
"_location": "/array-find-index",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "array-find-index@^1.0.1",
|
||||
"name": "array-find-index",
|
||||
"escapedName": "array-find-index",
|
||||
"rawSpec": "^1.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/currently-unhandled"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz",
|
||||
"_shasum": "df010aa1287e164bbda6f9723b0a96a1ec4187a1",
|
||||
"_spec": "array-find-index@^1.0.1",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/currently-unhandled",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/array-find-index/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "ES2015 `Array#findIndex()` ponyfill",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/array-find-index#readme",
|
||||
"keywords": [
|
||||
"es2015",
|
||||
"ponyfill",
|
||||
"polyfill",
|
||||
"shim",
|
||||
"find",
|
||||
"index",
|
||||
"findindex",
|
||||
"array"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "array-find-index",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/array-find-index.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "1.0.2"
|
||||
}
|
||||
30
node_modules/array-find-index/readme.md
generated
vendored
Normal file
30
node_modules/array-find-index/readme.md
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
# array-find-index [](https://travis-ci.org/sindresorhus/array-find-index)
|
||||
|
||||
> ES2015 [`Array#findIndex()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex) [ponyfill](https://ponyfill.com)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save array-find-index
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const arrayFindIndex = require('array-find-index');
|
||||
|
||||
arrayFindIndex(['rainbow', 'unicorn', 'pony'], x => x === 'unicorn');
|
||||
//=> 1
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
Same as `Array#findIndex()`, but with the input array as the first argument.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
21
node_modules/array-slice/LICENSE
generated
vendored
Executable file
21
node_modules/array-slice/LICENSE
generated
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2015, 2017, Jon Schlinkert
|
||||
|
||||
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.
|
||||
69
node_modules/array-slice/README.md
generated
vendored
Executable file
69
node_modules/array-slice/README.md
generated
vendored
Executable file
@@ -0,0 +1,69 @@
|
||||
# array-slice [](https://www.npmjs.com/package/array-slice) [](https://npmjs.org/package/array-slice) [](https://npmjs.org/package/array-slice) [](https://travis-ci.org/jonschlinkert/array-slice)
|
||||
|
||||
> Array-slice method. Slices `array` from the `start` index up to, but not including, the `end` index.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save array-slice
|
||||
```
|
||||
|
||||
This function is used instead of `Array#slice` to support node lists in IE < 9 and to ensure dense arrays are returned. This is also faster than native slice in some cases.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var slice = require('array-slice');
|
||||
var arr = ['a', 'b', 'd', 'e', 'f', 'g', 'h', 'i', 'j'];
|
||||
|
||||
slice(arr, 3, 6);
|
||||
//=> ['e', 'f', 'g']
|
||||
```
|
||||
|
||||
## About
|
||||
|
||||
### Related projects
|
||||
|
||||
* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten "Recursively flatten an array or arrays. This is the fastest implementation of array flatten.")
|
||||
* [array-unique](https://www.npmjs.com/package/array-unique): Remove duplicate values from an array. Fastest ES5 implementation. | [homepage](https://github.com/jonschlinkert/array-unique "Remove duplicate values from an array. Fastest ES5 implementation.")
|
||||
* [array-xor](https://www.npmjs.com/package/array-xor): Returns the symmetric difference (exclusive-or) of an array of elements (elements that are present in… [more](https://github.com/jonschlinkert/array-xor) | [homepage](https://github.com/jonschlinkert/array-xor "Returns the symmetric difference (exclusive-or) of an array of elements (elements that are present in all given arrays and not in their intersections).")
|
||||
|
||||
### Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
### Building docs
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
### Running tests
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
$ npm install && npm test
|
||||
```
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.3, on March 02, 2017._
|
||||
35
node_modules/array-slice/index.js
generated
vendored
Executable file
35
node_modules/array-slice/index.js
generated
vendored
Executable file
@@ -0,0 +1,35 @@
|
||||
/*!
|
||||
* array-slice <https://github.com/jonschlinkert/array-slice>
|
||||
*
|
||||
* Copyright (c) 2014-2015, 2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = function slice(arr, start, end) {
|
||||
var len = arr.length;
|
||||
var range = [];
|
||||
|
||||
start = idx(arr, start);
|
||||
end = idx(arr, end, len);
|
||||
|
||||
while (start < end) {
|
||||
range.push(arr[start++]);
|
||||
}
|
||||
return range;
|
||||
};
|
||||
|
||||
function idx(arr, pos, end) {
|
||||
var len = arr.length;
|
||||
|
||||
if (pos == null) {
|
||||
pos = end || 0;
|
||||
} else if (pos < 0) {
|
||||
pos = Math.max(len + pos, 0);
|
||||
} else {
|
||||
pos = Math.min(pos, len);
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
85
node_modules/array-slice/package.json
generated
vendored
Normal file
85
node_modules/array-slice/package.json
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
{
|
||||
"_from": "array-slice@^1.0.0",
|
||||
"_id": "array-slice@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-5zA08A3MH0CHYAj9IP6ud71LfC8=",
|
||||
"_location": "/array-slice",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "array-slice@^1.0.0",
|
||||
"name": "array-slice",
|
||||
"escapedName": "array-slice",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/object.defaults"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.0.0.tgz",
|
||||
"_shasum": "e73034f00dcc1f40876008fd20feae77bd4b7c2f",
|
||||
"_spec": "array-slice@^1.0.0",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/object.defaults",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/array-slice/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Array-slice method. Slices `array` from the `start` index up to, but not including, the `end` index.",
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^0.1.11",
|
||||
"mocha": "^3.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jonschlinkert/array-slice",
|
||||
"keywords": [
|
||||
"array",
|
||||
"javascript",
|
||||
"js",
|
||||
"slice",
|
||||
"util",
|
||||
"utils"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "array-slice",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/array-slice.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"verb": {
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"arr-flatten",
|
||||
"array-unique",
|
||||
"array-xor"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
62
node_modules/array-uniq/index.js
generated
vendored
Normal file
62
node_modules/array-uniq/index.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
'use strict';
|
||||
|
||||
// there's 3 implementations written in increasing order of efficiency
|
||||
|
||||
// 1 - no Set type is defined
|
||||
function uniqNoSet(arr) {
|
||||
var ret = [];
|
||||
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (ret.indexOf(arr[i]) === -1) {
|
||||
ret.push(arr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// 2 - a simple Set type is defined
|
||||
function uniqSet(arr) {
|
||||
var seen = new Set();
|
||||
return arr.filter(function (el) {
|
||||
if (!seen.has(el)) {
|
||||
seen.add(el);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
// 3 - a standard Set type is defined and it has a forEach method
|
||||
function uniqSetWithForEach(arr) {
|
||||
var ret = [];
|
||||
|
||||
(new Set(arr)).forEach(function (el) {
|
||||
ret.push(el);
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// V8 currently has a broken implementation
|
||||
// https://github.com/joyent/node/issues/8449
|
||||
function doesForEachActuallyWork() {
|
||||
var ret = false;
|
||||
|
||||
(new Set([true])).forEach(function (el) {
|
||||
ret = el;
|
||||
});
|
||||
|
||||
return ret === true;
|
||||
}
|
||||
|
||||
if ('Set' in global) {
|
||||
if (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) {
|
||||
module.exports = uniqSetWithForEach;
|
||||
} else {
|
||||
module.exports = uniqSet;
|
||||
}
|
||||
} else {
|
||||
module.exports = uniqNoSet;
|
||||
}
|
||||
21
node_modules/array-uniq/license
generated
vendored
Normal file
21
node_modules/array-uniq/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
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.
|
||||
69
node_modules/array-uniq/package.json
generated
vendored
Normal file
69
node_modules/array-uniq/package.json
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"_from": "array-uniq@^1.0.2",
|
||||
"_id": "array-uniq@1.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=",
|
||||
"_location": "/array-uniq",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "array-uniq@^1.0.2",
|
||||
"name": "array-uniq",
|
||||
"escapedName": "array-uniq",
|
||||
"rawSpec": "^1.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gulp-util"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
|
||||
"_shasum": "af6ac877a25cc7f74e058894753858dfdb24fdb6",
|
||||
"_spec": "array-uniq@^1.0.2",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/gulp-util",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/array-uniq/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Create an array without duplicates",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"es6-set": "^0.1.0",
|
||||
"require-uncached": "^1.0.2",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/array-uniq#readme",
|
||||
"keywords": [
|
||||
"array",
|
||||
"arr",
|
||||
"set",
|
||||
"uniq",
|
||||
"unique",
|
||||
"es6",
|
||||
"duplicate",
|
||||
"remove"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "array-uniq",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/array-uniq.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "1.0.3"
|
||||
}
|
||||
30
node_modules/array-uniq/readme.md
generated
vendored
Normal file
30
node_modules/array-uniq/readme.md
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
# array-uniq [](https://travis-ci.org/sindresorhus/array-uniq)
|
||||
|
||||
> Create an array without duplicates
|
||||
|
||||
It's already pretty fast, but will be much faster when [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) becomes available in V8 (especially with large arrays).
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save array-uniq
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const arrayUniq = require('array-uniq');
|
||||
|
||||
arrayUniq([1, 1, 2, 3, 3]);
|
||||
//=> [1, 2, 3]
|
||||
|
||||
arrayUniq(['foo', 'foo', 'bar', 'foo']);
|
||||
//=> ['foo', 'bar']
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
21
node_modules/array-unique/LICENSE
generated
vendored
Executable file
21
node_modules/array-unique/LICENSE
generated
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2015, Jon Schlinkert.
|
||||
|
||||
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.
|
||||
51
node_modules/array-unique/README.md
generated
vendored
Executable file
51
node_modules/array-unique/README.md
generated
vendored
Executable file
@@ -0,0 +1,51 @@
|
||||
# array-unique [](http://badge.fury.io/js/array-unique) [](https://travis-ci.org/jonschlinkert/array-unique)
|
||||
|
||||
> Return an array free of duplicate values. Fastest ES5 implementation.
|
||||
|
||||
## Install with [npm](npmjs.org)
|
||||
|
||||
```bash
|
||||
npm i array-unique --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var unique = require('array-unique');
|
||||
|
||||
unique(['a', 'b', 'c', 'c']);
|
||||
//=> ['a', 'b', 'c']
|
||||
```
|
||||
|
||||
## Related
|
||||
* [arr-diff](https://github.com/jonschlinkert/arr-diff): Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.
|
||||
* [arr-union](https://github.com/jonschlinkert/arr-union): Returns an array of unique values using strict equality for comparisons.
|
||||
* [arr-flatten](https://github.com/jonschlinkert/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten.
|
||||
* [arr-reduce](https://github.com/jonschlinkert/arr-reduce): Fast array reduce that also loops over sparse elements.
|
||||
* [arr-map](https://github.com/jonschlinkert/arr-map): Faster, node.js focused alternative to JavaScript's native array map.
|
||||
* [arr-pluck](https://github.com/jonschlinkert/arr-pluck): Retrieves the value of a specified property from all elements in the collection.
|
||||
|
||||
## Run tests
|
||||
Install dev dependencies.
|
||||
|
||||
```bash
|
||||
npm i -d && npm test
|
||||
```
|
||||
|
||||
## Contributing
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/array-unique/issues)
|
||||
|
||||
## Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
## License
|
||||
Copyright (c) 2015 Jon Schlinkert
|
||||
Released under the MIT license
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 24, 2015._
|
||||
28
node_modules/array-unique/index.js
generated
vendored
Executable file
28
node_modules/array-unique/index.js
generated
vendored
Executable file
@@ -0,0 +1,28 @@
|
||||
/*!
|
||||
* array-unique <https://github.com/jonschlinkert/array-unique>
|
||||
*
|
||||
* Copyright (c) 2014-2015, Jon Schlinkert.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = function unique(arr) {
|
||||
if (!Array.isArray(arr)) {
|
||||
throw new TypeError('array-unique expects an array.');
|
||||
}
|
||||
|
||||
var len = arr.length;
|
||||
var i = -1;
|
||||
|
||||
while (i++ < len) {
|
||||
var j = i + 1;
|
||||
|
||||
for (; j < arr.length; ++j) {
|
||||
if (arr[i] === arr[j]) {
|
||||
arr.splice(j--, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
};
|
||||
62
node_modules/array-unique/package.json
generated
vendored
Executable file
62
node_modules/array-unique/package.json
generated
vendored
Executable file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"_from": "array-unique@^0.2.1",
|
||||
"_id": "array-unique@0.2.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=",
|
||||
"_location": "/array-unique",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "array-unique@^0.2.1",
|
||||
"name": "array-unique",
|
||||
"escapedName": "array-unique",
|
||||
"rawSpec": "^0.2.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.2.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/micromatch"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz",
|
||||
"_shasum": "a1d97ccafcbc2625cc70fadceb36a50c58b01a53",
|
||||
"_spec": "array-unique@^0.2.1",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/micromatch",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/array-unique/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Return an array free of duplicate values. Fastest ES5 implementation.",
|
||||
"devDependencies": {
|
||||
"array-uniq": "^1.0.2",
|
||||
"benchmarked": "^0.1.3",
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jonschlinkert/array-unique",
|
||||
"license": {
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/jonschlinkert/array-unique/blob/master/LICENSE"
|
||||
},
|
||||
"main": "index.js",
|
||||
"name": "array-unique",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jonschlinkert/array-unique.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "0.2.1"
|
||||
}
|
||||
5
node_modules/balanced-match/.npmignore
generated
vendored
Normal file
5
node_modules/balanced-match/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
test
|
||||
.gitignore
|
||||
.travis.yml
|
||||
Makefile
|
||||
example.js
|
||||
21
node_modules/balanced-match/LICENSE.md
generated
vendored
Normal file
21
node_modules/balanced-match/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||
91
node_modules/balanced-match/README.md
generated
vendored
Normal file
91
node_modules/balanced-match/README.md
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
# balanced-match
|
||||
|
||||
Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
|
||||
|
||||
[](http://travis-ci.org/juliangruber/balanced-match)
|
||||
[](https://www.npmjs.org/package/balanced-match)
|
||||
|
||||
[](https://ci.testling.com/juliangruber/balanced-match)
|
||||
|
||||
## Example
|
||||
|
||||
Get the first matching pair of braces:
|
||||
|
||||
```js
|
||||
var balanced = require('balanced-match');
|
||||
|
||||
console.log(balanced('{', '}', 'pre{in{nested}}post'));
|
||||
console.log(balanced('{', '}', 'pre{first}between{second}post'));
|
||||
console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'));
|
||||
```
|
||||
|
||||
The matches are:
|
||||
|
||||
```bash
|
||||
$ node example.js
|
||||
{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
|
||||
{ start: 3,
|
||||
end: 9,
|
||||
pre: 'pre',
|
||||
body: 'first',
|
||||
post: 'between{second}post' }
|
||||
{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### var m = balanced(a, b, str)
|
||||
|
||||
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||
object with those keys:
|
||||
|
||||
* **start** the index of the first match of `a`
|
||||
* **end** the index of the matching `b`
|
||||
* **pre** the preamble, `a` and `b` not included
|
||||
* **body** the match, `a` and `b` not included
|
||||
* **post** the postscript, `a` and `b` not included
|
||||
|
||||
If there's no match, `undefined` will be returned.
|
||||
|
||||
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.
|
||||
|
||||
### var r = balanced.range(a, b, str)
|
||||
|
||||
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||
array with indexes: `[ <a index>, <b index> ]`.
|
||||
|
||||
If there's no match, `undefined` will be returned.
|
||||
|
||||
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```bash
|
||||
npm install balanced-match
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||
59
node_modules/balanced-match/index.js
generated
vendored
Normal file
59
node_modules/balanced-match/index.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
'use strict';
|
||||
module.exports = balanced;
|
||||
function balanced(a, b, str) {
|
||||
if (a instanceof RegExp) a = maybeMatch(a, str);
|
||||
if (b instanceof RegExp) b = maybeMatch(b, str);
|
||||
|
||||
var r = range(a, b, str);
|
||||
|
||||
return r && {
|
||||
start: r[0],
|
||||
end: r[1],
|
||||
pre: str.slice(0, r[0]),
|
||||
body: str.slice(r[0] + a.length, r[1]),
|
||||
post: str.slice(r[1] + b.length)
|
||||
};
|
||||
}
|
||||
|
||||
function maybeMatch(reg, str) {
|
||||
var m = str.match(reg);
|
||||
return m ? m[0] : null;
|
||||
}
|
||||
|
||||
balanced.range = range;
|
||||
function range(a, b, str) {
|
||||
var begs, beg, left, right, result;
|
||||
var ai = str.indexOf(a);
|
||||
var bi = str.indexOf(b, ai + 1);
|
||||
var i = ai;
|
||||
|
||||
if (ai >= 0 && bi > 0) {
|
||||
begs = [];
|
||||
left = str.length;
|
||||
|
||||
while (i >= 0 && !result) {
|
||||
if (i == ai) {
|
||||
begs.push(i);
|
||||
ai = str.indexOf(a, i + 1);
|
||||
} else if (begs.length == 1) {
|
||||
result = [ begs.pop(), bi ];
|
||||
} else {
|
||||
beg = begs.pop();
|
||||
if (beg < left) {
|
||||
left = beg;
|
||||
right = bi;
|
||||
}
|
||||
|
||||
bi = str.indexOf(b, i + 1);
|
||||
}
|
||||
|
||||
i = ai < bi && ai >= 0 ? ai : bi;
|
||||
}
|
||||
|
||||
if (begs.length) {
|
||||
result = [ left, right ];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
77
node_modules/balanced-match/package.json
generated
vendored
Normal file
77
node_modules/balanced-match/package.json
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"_from": "balanced-match@^1.0.0",
|
||||
"_id": "balanced-match@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"_location": "/balanced-match",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "balanced-match@^1.0.0",
|
||||
"name": "balanced-match",
|
||||
"escapedName": "balanced-match",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/brace-expansion"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"_shasum": "89b4d199ab2bee49de164ea02b89ce462d71b767",
|
||||
"_spec": "balanced-match@^1.0.0",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/brace-expansion",
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/juliangruber/balanced-match/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
||||
"devDependencies": {
|
||||
"matcha": "^0.7.0",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"homepage": "https://github.com/juliangruber/balanced-match",
|
||||
"keywords": [
|
||||
"match",
|
||||
"regexp",
|
||||
"test",
|
||||
"balanced",
|
||||
"parse"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "balanced-match",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/balanced-match.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "make bench",
|
||||
"test": "make test"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"firefox/20..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/25..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
60
node_modules/beeper/index.js
generated
vendored
Normal file
60
node_modules/beeper/index.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
'use strict';
|
||||
|
||||
var BEEP_DELAY = 500;
|
||||
|
||||
function beep() {
|
||||
process.stdout.write('\u0007');
|
||||
}
|
||||
|
||||
function melodicalBeep(val, cb) {
|
||||
if (val.length === 0) {
|
||||
cb();
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
if (val.shift() === '*') {
|
||||
beep();
|
||||
}
|
||||
|
||||
melodicalBeep(val, cb);
|
||||
}, BEEP_DELAY);
|
||||
}
|
||||
|
||||
module.exports = function (val, cb) {
|
||||
if (!process.stdout.isTTY ||
|
||||
process.argv.indexOf('--no-beep') !== -1 ||
|
||||
process.argv.indexOf('--beep=false') !== -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
cb = cb || function () {};
|
||||
|
||||
if (val === parseInt(val)) {
|
||||
if (val < 0) {
|
||||
throw new TypeError('Negative numbers are not accepted');
|
||||
}
|
||||
|
||||
if (val === 0) {
|
||||
cb();
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < val; i++) {
|
||||
setTimeout(function (i) {
|
||||
beep();
|
||||
|
||||
if (i === val - 1) {
|
||||
cb();
|
||||
}
|
||||
}, BEEP_DELAY * i, i);
|
||||
}
|
||||
} else if (!val) {
|
||||
beep();
|
||||
cb();
|
||||
} else if (typeof val === 'string') {
|
||||
melodicalBeep(val.split(''), cb);
|
||||
} else {
|
||||
throw new TypeError('Not an accepted type');
|
||||
}
|
||||
};
|
||||
21
node_modules/beeper/license
generated
vendored
Normal file
21
node_modules/beeper/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
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.
|
||||
70
node_modules/beeper/package.json
generated
vendored
Normal file
70
node_modules/beeper/package.json
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"_from": "beeper@^1.0.0",
|
||||
"_id": "beeper@1.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=",
|
||||
"_location": "/beeper",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "beeper@^1.0.0",
|
||||
"name": "beeper",
|
||||
"escapedName": "beeper",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gulp-util"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.1.tgz",
|
||||
"_shasum": "e6d5ea8c5dad001304a70b22638447f69cb2f809",
|
||||
"_spec": "beeper@^1.0.0",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/gulp-util",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/beeper/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Make your terminal beep",
|
||||
"devDependencies": {
|
||||
"hooker": "^0.2.3",
|
||||
"tape": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/beeper#readme",
|
||||
"keywords": [
|
||||
"beep",
|
||||
"beeper",
|
||||
"boop",
|
||||
"terminal",
|
||||
"term",
|
||||
"cli",
|
||||
"console",
|
||||
"ding",
|
||||
"ping",
|
||||
"alert",
|
||||
"gulpfriendly"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "beeper",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/beeper.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"version": "1.1.1"
|
||||
}
|
||||
55
node_modules/beeper/readme.md
generated
vendored
Normal file
55
node_modules/beeper/readme.md
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
# beeper [](https://travis-ci.org/sindresorhus/beeper)
|
||||
|
||||
> Make your terminal beep
|
||||
|
||||

|
||||
|
||||
Useful as an attention grabber e.g. when an error happens.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save beeper
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var beeper = require('beeper');
|
||||
|
||||
beeper();
|
||||
// beep one time
|
||||
|
||||
beeper(3);
|
||||
// beep three times
|
||||
|
||||
beeper('****-*-*');
|
||||
// beep, beep, beep, beep, pause, beep, pause, beep
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
It will not beep if stdout is not TTY or if the user supplies the `--no-beep` flag.
|
||||
|
||||
### beeper([count|melody], [callback])
|
||||
|
||||
#### count
|
||||
|
||||
Type: `number`
|
||||
Default: `1`
|
||||
|
||||
How many times you want it to beep.
|
||||
|
||||
#### melody
|
||||
|
||||
Type: `string`
|
||||
|
||||
Construct your own melody by supplying a string of `*` for beep `-` for pause.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
123
node_modules/brace-expansion/README.md
generated
vendored
Normal file
123
node_modules/brace-expansion/README.md
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
# brace-expansion
|
||||
|
||||
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
|
||||
as known from sh/bash, in JavaScript.
|
||||
|
||||
[](http://travis-ci.org/juliangruber/brace-expansion)
|
||||
[](https://www.npmjs.org/package/brace-expansion)
|
||||
[](https://greenkeeper.io/)
|
||||
|
||||
[](https://ci.testling.com/juliangruber/brace-expansion)
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
|
||||
expand('file-{a,b,c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('-v{,,}')
|
||||
// => ['-v', '-v', '-v']
|
||||
|
||||
expand('file{0..2}.jpg')
|
||||
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
|
||||
|
||||
expand('file-{a..c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('file{2..0}.jpg')
|
||||
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
|
||||
|
||||
expand('file{0..4..2}.jpg')
|
||||
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
|
||||
|
||||
expand('file-{a..e..2}.jpg')
|
||||
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
|
||||
|
||||
expand('file{00..10..5}.jpg')
|
||||
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
|
||||
|
||||
expand('{{A..C},{a..c}}')
|
||||
// => ['A', 'B', 'C', 'a', 'b', 'c']
|
||||
|
||||
expand('ppp{,config,oe{,conf}}')
|
||||
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
```
|
||||
|
||||
### var expanded = expand(str)
|
||||
|
||||
Return an array of all possible and valid expansions of `str`. If none are
|
||||
found, `[str]` is returned.
|
||||
|
||||
Valid expansions are:
|
||||
|
||||
```js
|
||||
/^(.*,)+(.+)?$/
|
||||
// {a,b,...}
|
||||
```
|
||||
|
||||
A comma seperated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
A numeric sequence from `x` to `y` inclusive, with optional increment.
|
||||
If `x` or `y` start with a leading `0`, all the numbers will be padded
|
||||
to have equal length. Negative numbers and backwards iteration work too.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
An alphabetic sequence from `x` to `y` inclusive, with optional increment.
|
||||
`x` and `y` must be exactly one character, and if given, `incr` must be a
|
||||
number.
|
||||
|
||||
For compatibility reasons, the string `${` is not eligible for brace expansion.
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```bash
|
||||
npm install brace-expansion
|
||||
```
|
||||
|
||||
## Contributors
|
||||
|
||||
- [Julian Gruber](https://github.com/juliangruber)
|
||||
- [Isaac Z. Schlueter](https://github.com/isaacs)
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||
201
node_modules/brace-expansion/index.js
generated
vendored
Normal file
201
node_modules/brace-expansion/index.js
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
var concatMap = require('concat-map');
|
||||
var balanced = require('balanced-match');
|
||||
|
||||
module.exports = expandTop;
|
||||
|
||||
var escSlash = '\0SLASH'+Math.random()+'\0';
|
||||
var escOpen = '\0OPEN'+Math.random()+'\0';
|
||||
var escClose = '\0CLOSE'+Math.random()+'\0';
|
||||
var escComma = '\0COMMA'+Math.random()+'\0';
|
||||
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
||||
|
||||
function numeric(str) {
|
||||
return parseInt(str, 10) == str
|
||||
? parseInt(str, 10)
|
||||
: str.charCodeAt(0);
|
||||
}
|
||||
|
||||
function escapeBraces(str) {
|
||||
return str.split('\\\\').join(escSlash)
|
||||
.split('\\{').join(escOpen)
|
||||
.split('\\}').join(escClose)
|
||||
.split('\\,').join(escComma)
|
||||
.split('\\.').join(escPeriod);
|
||||
}
|
||||
|
||||
function unescapeBraces(str) {
|
||||
return str.split(escSlash).join('\\')
|
||||
.split(escOpen).join('{')
|
||||
.split(escClose).join('}')
|
||||
.split(escComma).join(',')
|
||||
.split(escPeriod).join('.');
|
||||
}
|
||||
|
||||
|
||||
// Basically just str.split(","), but handling cases
|
||||
// where we have nested braced sections, which should be
|
||||
// treated as individual members, like {a,{b,c},d}
|
||||
function parseCommaParts(str) {
|
||||
if (!str)
|
||||
return [''];
|
||||
|
||||
var parts = [];
|
||||
var m = balanced('{', '}', str);
|
||||
|
||||
if (!m)
|
||||
return str.split(',');
|
||||
|
||||
var pre = m.pre;
|
||||
var body = m.body;
|
||||
var post = m.post;
|
||||
var p = pre.split(',');
|
||||
|
||||
p[p.length-1] += '{' + body + '}';
|
||||
var postParts = parseCommaParts(post);
|
||||
if (post.length) {
|
||||
p[p.length-1] += postParts.shift();
|
||||
p.push.apply(p, postParts);
|
||||
}
|
||||
|
||||
parts.push.apply(parts, p);
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
function expandTop(str) {
|
||||
if (!str)
|
||||
return [];
|
||||
|
||||
// I don't know why Bash 4.3 does this, but it does.
|
||||
// Anything starting with {} will have the first two bytes preserved
|
||||
// but *only* at the top level, so {},a}b will not expand to anything,
|
||||
// but a{},b}c will be expanded to [a}c,abc].
|
||||
// One could argue that this is a bug in Bash, but since the goal of
|
||||
// this module is to match Bash's rules, we escape a leading {}
|
||||
if (str.substr(0, 2) === '{}') {
|
||||
str = '\\{\\}' + str.substr(2);
|
||||
}
|
||||
|
||||
return expand(escapeBraces(str), true).map(unescapeBraces);
|
||||
}
|
||||
|
||||
function identity(e) {
|
||||
return e;
|
||||
}
|
||||
|
||||
function embrace(str) {
|
||||
return '{' + str + '}';
|
||||
}
|
||||
function isPadded(el) {
|
||||
return /^-?0\d/.test(el);
|
||||
}
|
||||
|
||||
function lte(i, y) {
|
||||
return i <= y;
|
||||
}
|
||||
function gte(i, y) {
|
||||
return i >= y;
|
||||
}
|
||||
|
||||
function expand(str, isTop) {
|
||||
var expansions = [];
|
||||
|
||||
var m = balanced('{', '}', str);
|
||||
if (!m || /\$$/.test(m.pre)) return [str];
|
||||
|
||||
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isSequence = isNumericSequence || isAlphaSequence;
|
||||
var isOptions = m.body.indexOf(',') >= 0;
|
||||
if (!isSequence && !isOptions) {
|
||||
// {a},b}
|
||||
if (m.post.match(/,.*\}/)) {
|
||||
str = m.pre + '{' + m.body + escClose + m.post;
|
||||
return expand(str);
|
||||
}
|
||||
return [str];
|
||||
}
|
||||
|
||||
var n;
|
||||
if (isSequence) {
|
||||
n = m.body.split(/\.\./);
|
||||
} else {
|
||||
n = parseCommaParts(m.body);
|
||||
if (n.length === 1) {
|
||||
// x{{a,b}}y ==> x{a}y x{b}y
|
||||
n = expand(n[0], false).map(embrace);
|
||||
if (n.length === 1) {
|
||||
var post = m.post.length
|
||||
? expand(m.post, false)
|
||||
: [''];
|
||||
return post.map(function(p) {
|
||||
return m.pre + n[0] + p;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// at this point, n is the parts, and we know it's not a comma set
|
||||
// with a single entry.
|
||||
|
||||
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
||||
var pre = m.pre;
|
||||
var post = m.post.length
|
||||
? expand(m.post, false)
|
||||
: [''];
|
||||
|
||||
var N;
|
||||
|
||||
if (isSequence) {
|
||||
var x = numeric(n[0]);
|
||||
var y = numeric(n[1]);
|
||||
var width = Math.max(n[0].length, n[1].length)
|
||||
var incr = n.length == 3
|
||||
? Math.abs(numeric(n[2]))
|
||||
: 1;
|
||||
var test = lte;
|
||||
var reverse = y < x;
|
||||
if (reverse) {
|
||||
incr *= -1;
|
||||
test = gte;
|
||||
}
|
||||
var pad = n.some(isPadded);
|
||||
|
||||
N = [];
|
||||
|
||||
for (var i = x; test(i, y); i += incr) {
|
||||
var c;
|
||||
if (isAlphaSequence) {
|
||||
c = String.fromCharCode(i);
|
||||
if (c === '\\')
|
||||
c = '';
|
||||
} else {
|
||||
c = String(i);
|
||||
if (pad) {
|
||||
var need = width - c.length;
|
||||
if (need > 0) {
|
||||
var z = new Array(need + 1).join('0');
|
||||
if (i < 0)
|
||||
c = '-' + z + c.slice(1);
|
||||
else
|
||||
c = z + c;
|
||||
}
|
||||
}
|
||||
}
|
||||
N.push(c);
|
||||
}
|
||||
} else {
|
||||
N = concatMap(n, function(el) { return expand(el, false) });
|
||||
}
|
||||
|
||||
for (var j = 0; j < N.length; j++) {
|
||||
for (var k = 0; k < post.length; k++) {
|
||||
var expansion = pre + N[j] + post[k];
|
||||
if (!isTop || isSequence || expansion)
|
||||
expansions.push(expansion);
|
||||
}
|
||||
}
|
||||
|
||||
return expansions;
|
||||
}
|
||||
|
||||
75
node_modules/brace-expansion/package.json
generated
vendored
Normal file
75
node_modules/brace-expansion/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"_from": "brace-expansion@^1.0.0",
|
||||
"_id": "brace-expansion@1.1.8",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=",
|
||||
"_location": "/brace-expansion",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "brace-expansion@^1.0.0",
|
||||
"name": "brace-expansion",
|
||||
"escapedName": "brace-expansion",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/minimatch"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz",
|
||||
"_shasum": "c07b211c7c952ec1f8efd51a77ef0d1d3990a292",
|
||||
"_spec": "brace-expansion@^1.0.0",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/minimatch",
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/juliangruber/brace-expansion/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Brace expansion as known from sh/bash",
|
||||
"devDependencies": {
|
||||
"matcha": "^0.7.0",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"homepage": "https://github.com/juliangruber/brace-expansion",
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "brace-expansion",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/brace-expansion.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "matcha test/perf/bench.js",
|
||||
"gentest": "bash test/generate.sh",
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"firefox/20..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/25..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
},
|
||||
"version": "1.1.8"
|
||||
}
|
||||
21
node_modules/braces/LICENSE
generated
vendored
Normal file
21
node_modules/braces/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2016, Jon Schlinkert.
|
||||
|
||||
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.
|
||||
248
node_modules/braces/README.md
generated
vendored
Normal file
248
node_modules/braces/README.md
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
# braces [](https://www.npmjs.com/package/braces) [](https://npmjs.org/package/braces) [](https://travis-ci.org/jonschlinkert/braces)
|
||||
|
||||
Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces specification.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install braces --save
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
* Complete support for the braces part of the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/). Braces passes [all of the relevant unit tests](#bash-4-3-support) from the spec.
|
||||
* Expands comma-separated values: `a/{b,c}/d` => `['a/b/d', 'a/c/d']`
|
||||
* Expands alphabetical or numerical ranges: `{1..3}` => `['1', '2', '3']`
|
||||
* [Very fast](#benchmarks)
|
||||
* [Special characters](./patterns.md) can be used to generate interesting patterns.
|
||||
|
||||
## Example usage
|
||||
|
||||
```js
|
||||
var braces = require('braces');
|
||||
|
||||
braces('a/{x,y}/c{d}e')
|
||||
//=> ['a/x/cde', 'a/y/cde']
|
||||
|
||||
braces('a/b/c/{x,y}')
|
||||
//=> ['a/b/c/x', 'a/b/c/y']
|
||||
|
||||
braces('a/{x,{1..5},y}/c{d}e')
|
||||
//=> ['a/x/cde', 'a/1/cde', 'a/y/cde', 'a/2/cde', 'a/3/cde', 'a/4/cde', 'a/5/cde']
|
||||
```
|
||||
|
||||
### Use case: fixtures
|
||||
|
||||
> Use braces to generate test fixtures!
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var braces = require('./');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
braces('blah/{a..z}.js').forEach(function(fp) {
|
||||
if (!fs.existsSync(path.dirname(fp))) {
|
||||
fs.mkdirSync(path.dirname(fp));
|
||||
}
|
||||
fs.writeFileSync(fp, '');
|
||||
});
|
||||
```
|
||||
|
||||
See the [tests](./test/test.js) for more examples and use cases (also see the [bash spec tests](./test/bash-mm-adjusted.js));
|
||||
|
||||
### Range expansion
|
||||
|
||||
Uses [expand-range](https://github.com/jonschlinkert/expand-range) for range expansion.
|
||||
|
||||
```js
|
||||
braces('a{1..3}b')
|
||||
//=> ['a1b', 'a2b', 'a3b']
|
||||
|
||||
braces('a{5..8}b')
|
||||
//=> ['a5b', 'a6b', 'a7b', 'a8b']
|
||||
|
||||
braces('a{00..05}b')
|
||||
//=> ['a00b', 'a01b', 'a02b', 'a03b', 'a04b', 'a05b']
|
||||
|
||||
braces('a{01..03}b')
|
||||
//=> ['a01b', 'a02b', 'a03b']
|
||||
|
||||
braces('a{000..005}b')
|
||||
//=> ['a000b', 'a001b', 'a002b', 'a003b', 'a004b', 'a005b']
|
||||
|
||||
braces('a{a..e}b')
|
||||
//=> ['aab', 'abb', 'acb', 'adb', 'aeb']
|
||||
|
||||
braces('a{A..E}b')
|
||||
//=> ['aAb', 'aBb', 'aCb', 'aDb', 'aEb']
|
||||
```
|
||||
|
||||
Pass a function as the last argument to customize range expansions:
|
||||
|
||||
```js
|
||||
var range = braces('x{a..e}y', function (str, i) {
|
||||
return String.fromCharCode(str) + i;
|
||||
});
|
||||
|
||||
console.log(range);
|
||||
//=> ['xa0y', 'xb1y', 'xc2y', 'xd3y', 'xe4y']
|
||||
```
|
||||
|
||||
See [expand-range](https://github.com/jonschlinkert/expand-range) for benchmarks, tests and the full list of range expansion features.
|
||||
|
||||
## Options
|
||||
|
||||
### options.makeRe
|
||||
|
||||
Type: `Boolean`
|
||||
|
||||
Deafault: `false`
|
||||
|
||||
Return a regex-optimal string. If you're using braces to generate regex, this will result in dramatically faster performance.
|
||||
|
||||
**Examples**
|
||||
|
||||
With the default settings (`{makeRe: false}`):
|
||||
|
||||
```js
|
||||
braces('{1..5}');
|
||||
//=> ['1', '2', '3', '4', '5']
|
||||
```
|
||||
|
||||
With `{makeRe: true}`:
|
||||
|
||||
```js
|
||||
braces('{1..5}', {makeRe: true});
|
||||
//=> ['[1-5]']
|
||||
|
||||
braces('{3..9..3}', {makeRe: true});
|
||||
//=> ['(3|6|9)']
|
||||
```
|
||||
|
||||
### options.bash
|
||||
|
||||
Type: `Boolean`
|
||||
|
||||
Default: `false`
|
||||
|
||||
Enables complete support for the Bash specification. The downside is a 20-25% speed decrease.
|
||||
|
||||
**Example**
|
||||
|
||||
Using the default setting (`{bash: false}`):
|
||||
|
||||
```js
|
||||
braces('a{b}c');
|
||||
//=> ['abc']
|
||||
```
|
||||
|
||||
In bash (and minimatch), braces with one item are not expanded. To get the same result with braces, set `{bash: true}`:
|
||||
|
||||
```js
|
||||
braces('a{b}c', {bash: true});
|
||||
//=> ['a{b}c']
|
||||
```
|
||||
|
||||
### options.nodupes
|
||||
|
||||
Type: `Boolean`
|
||||
|
||||
Deafault: `true`
|
||||
|
||||
Duplicates are removed by default. To keep duplicates, pass `{nodupes: false}` on the options
|
||||
|
||||
## Bash 4.3 Support
|
||||
|
||||
> Better support for Bash 4.3 than minimatch
|
||||
|
||||
This project has comprehensive unit tests, including tests coverted from [Bash 4.3](www.gnu.org/software/bash/). Currently only 8 of 102 unit tests fail, and
|
||||
|
||||
## Run benchmarks
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```bash
|
||||
npm i -d && npm benchmark
|
||||
```
|
||||
|
||||
### Latest results
|
||||
|
||||
```bash
|
||||
#1: escape.js
|
||||
brace-expansion.js x 114,934 ops/sec ±1.24% (93 runs sampled)
|
||||
braces.js x 342,254 ops/sec ±0.84% (90 runs sampled)
|
||||
|
||||
#2: exponent.js
|
||||
brace-expansion.js x 12,359 ops/sec ±0.86% (96 runs sampled)
|
||||
braces.js x 20,389 ops/sec ±0.71% (97 runs sampled)
|
||||
|
||||
#3: multiple.js
|
||||
brace-expansion.js x 114,469 ops/sec ±1.44% (94 runs sampled)
|
||||
braces.js x 401,621 ops/sec ±0.87% (91 runs sampled)
|
||||
|
||||
#4: nested.js
|
||||
brace-expansion.js x 102,769 ops/sec ±1.55% (92 runs sampled)
|
||||
braces.js x 314,088 ops/sec ±0.71% (98 runs sampled)
|
||||
|
||||
#5: normal.js
|
||||
brace-expansion.js x 157,577 ops/sec ±1.65% (91 runs sampled)
|
||||
braces.js x 1,115,950 ops/sec ±0.74% (94 runs sampled)
|
||||
|
||||
#6: range.js
|
||||
brace-expansion.js x 138,822 ops/sec ±1.71% (91 runs sampled)
|
||||
braces.js x 1,108,353 ops/sec ±0.85% (94 runs sampled)
|
||||
```
|
||||
|
||||
## Related projects
|
||||
|
||||
You might also be interested in these projects:
|
||||
|
||||
* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. See… [more](https://www.npmjs.com/package/expand-range) | [homepage](https://github.com/jonschlinkert/expand-range)
|
||||
* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or multiplier to… [more](https://www.npmjs.com/package/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range)
|
||||
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch)
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/braces/issues/new).
|
||||
|
||||
## Building docs
|
||||
|
||||
Generate readme and API documentation with [verb](https://github.com/verbose/verb):
|
||||
|
||||
```sh
|
||||
$ npm install verb && npm run docs
|
||||
```
|
||||
|
||||
Or, if [verb](https://github.com/verbose/verb) is installed globally:
|
||||
|
||||
```sh
|
||||
$ verb
|
||||
```
|
||||
|
||||
## Running tests
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```sh
|
||||
$ npm install -d && npm test
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT license](https://github.com/jonschlinkert/braces/blob/master/LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on May 21, 2016._
|
||||
399
node_modules/braces/index.js
generated
vendored
Normal file
399
node_modules/braces/index.js
generated
vendored
Normal file
@@ -0,0 +1,399 @@
|
||||
/*!
|
||||
* braces <https://github.com/jonschlinkert/braces>
|
||||
*
|
||||
* Copyright (c) 2014-2015, Jon Schlinkert.
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var expand = require('expand-range');
|
||||
var repeat = require('repeat-element');
|
||||
var tokens = require('preserve');
|
||||
|
||||
/**
|
||||
* Expose `braces`
|
||||
*/
|
||||
|
||||
module.exports = function(str, options) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new Error('braces expects a string');
|
||||
}
|
||||
return braces(str, options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Expand `{foo,bar}` or `{1..5}` braces in the
|
||||
* given `string`.
|
||||
*
|
||||
* @param {String} `str`
|
||||
* @param {Array} `arr`
|
||||
* @param {Object} `options`
|
||||
* @return {Array}
|
||||
*/
|
||||
|
||||
function braces(str, arr, options) {
|
||||
if (str === '') {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (!Array.isArray(arr)) {
|
||||
options = arr;
|
||||
arr = [];
|
||||
}
|
||||
|
||||
var opts = options || {};
|
||||
arr = arr || [];
|
||||
|
||||
if (typeof opts.nodupes === 'undefined') {
|
||||
opts.nodupes = true;
|
||||
}
|
||||
|
||||
var fn = opts.fn;
|
||||
var es6;
|
||||
|
||||
if (typeof opts === 'function') {
|
||||
fn = opts;
|
||||
opts = {};
|
||||
}
|
||||
|
||||
if (!(patternRe instanceof RegExp)) {
|
||||
patternRe = patternRegex();
|
||||
}
|
||||
|
||||
var matches = str.match(patternRe) || [];
|
||||
var m = matches[0];
|
||||
|
||||
switch(m) {
|
||||
case '\\,':
|
||||
return escapeCommas(str, arr, opts);
|
||||
case '\\.':
|
||||
return escapeDots(str, arr, opts);
|
||||
case '\/.':
|
||||
return escapePaths(str, arr, opts);
|
||||
case ' ':
|
||||
return splitWhitespace(str);
|
||||
case '{,}':
|
||||
return exponential(str, opts, braces);
|
||||
case '{}':
|
||||
return emptyBraces(str, arr, opts);
|
||||
case '\\{':
|
||||
case '\\}':
|
||||
return escapeBraces(str, arr, opts);
|
||||
case '${':
|
||||
if (!/\{[^{]+\{/.test(str)) {
|
||||
return arr.concat(str);
|
||||
} else {
|
||||
es6 = true;
|
||||
str = tokens.before(str, es6Regex());
|
||||
}
|
||||
}
|
||||
|
||||
if (!(braceRe instanceof RegExp)) {
|
||||
braceRe = braceRegex();
|
||||
}
|
||||
|
||||
var match = braceRe.exec(str);
|
||||
if (match == null) {
|
||||
return [str];
|
||||
}
|
||||
|
||||
var outter = match[1];
|
||||
var inner = match[2];
|
||||
if (inner === '') { return [str]; }
|
||||
|
||||
var segs, segsLength;
|
||||
|
||||
if (inner.indexOf('..') !== -1) {
|
||||
segs = expand(inner, opts, fn) || inner.split(',');
|
||||
segsLength = segs.length;
|
||||
|
||||
} else if (inner[0] === '"' || inner[0] === '\'') {
|
||||
return arr.concat(str.split(/['"]/).join(''));
|
||||
|
||||
} else {
|
||||
segs = inner.split(',');
|
||||
if (opts.makeRe) {
|
||||
return braces(str.replace(outter, wrap(segs, '|')), opts);
|
||||
}
|
||||
|
||||
segsLength = segs.length;
|
||||
if (segsLength === 1 && opts.bash) {
|
||||
segs[0] = wrap(segs[0], '\\');
|
||||
}
|
||||
}
|
||||
|
||||
var len = segs.length;
|
||||
var i = 0, val;
|
||||
|
||||
while (len--) {
|
||||
var path = segs[i++];
|
||||
|
||||
if (/(\.[^.\/])/.test(path)) {
|
||||
if (segsLength > 1) {
|
||||
return segs;
|
||||
} else {
|
||||
return [str];
|
||||
}
|
||||
}
|
||||
|
||||
val = splice(str, outter, path);
|
||||
|
||||
if (/\{[^{}]+?\}/.test(val)) {
|
||||
arr = braces(val, arr, opts);
|
||||
} else if (val !== '') {
|
||||
if (opts.nodupes && arr.indexOf(val) !== -1) { continue; }
|
||||
arr.push(es6 ? tokens.after(val) : val);
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.strict) { return filter(arr, filterEmpty); }
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expand exponential ranges
|
||||
*
|
||||
* `a{,}{,}` => ['a', 'a', 'a', 'a']
|
||||
*/
|
||||
|
||||
function exponential(str, options, fn) {
|
||||
if (typeof options === 'function') {
|
||||
fn = options;
|
||||
options = null;
|
||||
}
|
||||
|
||||
var opts = options || {};
|
||||
var esc = '__ESC_EXP__';
|
||||
var exp = 0;
|
||||
var res;
|
||||
|
||||
var parts = str.split('{,}');
|
||||
if (opts.nodupes) {
|
||||
return fn(parts.join(''), opts);
|
||||
}
|
||||
|
||||
exp = parts.length - 1;
|
||||
res = fn(parts.join(esc), opts);
|
||||
var len = res.length;
|
||||
var arr = [];
|
||||
var i = 0;
|
||||
|
||||
while (len--) {
|
||||
var ele = res[i++];
|
||||
var idx = ele.indexOf(esc);
|
||||
|
||||
if (idx === -1) {
|
||||
arr.push(ele);
|
||||
|
||||
} else {
|
||||
ele = ele.split('__ESC_EXP__').join('');
|
||||
if (!!ele && opts.nodupes !== false) {
|
||||
arr.push(ele);
|
||||
|
||||
} else {
|
||||
var num = Math.pow(2, exp);
|
||||
arr.push.apply(arr, repeat(ele, num));
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a value with parens, brackets or braces,
|
||||
* based on the given character/separator.
|
||||
*
|
||||
* @param {String|Array} `val`
|
||||
* @param {String} `ch`
|
||||
* @return {String}
|
||||
*/
|
||||
|
||||
function wrap(val, ch) {
|
||||
if (ch === '|') {
|
||||
return '(' + val.join(ch) + ')';
|
||||
}
|
||||
if (ch === ',') {
|
||||
return '{' + val.join(ch) + '}';
|
||||
}
|
||||
if (ch === '-') {
|
||||
return '[' + val.join(ch) + ']';
|
||||
}
|
||||
if (ch === '\\') {
|
||||
return '\\{' + val + '\\}';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle empty braces: `{}`
|
||||
*/
|
||||
|
||||
function emptyBraces(str, arr, opts) {
|
||||
return braces(str.split('{}').join('\\{\\}'), arr, opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter out empty-ish values
|
||||
*/
|
||||
|
||||
function filterEmpty(ele) {
|
||||
return !!ele && ele !== '\\';
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle patterns with whitespace
|
||||
*/
|
||||
|
||||
function splitWhitespace(str) {
|
||||
var segs = str.split(' ');
|
||||
var len = segs.length;
|
||||
var res = [];
|
||||
var i = 0;
|
||||
|
||||
while (len--) {
|
||||
res.push.apply(res, braces(segs[i++]));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle escaped braces: `\\{foo,bar}`
|
||||
*/
|
||||
|
||||
function escapeBraces(str, arr, opts) {
|
||||
if (!/\{[^{]+\{/.test(str)) {
|
||||
return arr.concat(str.split('\\').join(''));
|
||||
} else {
|
||||
str = str.split('\\{').join('__LT_BRACE__');
|
||||
str = str.split('\\}').join('__RT_BRACE__');
|
||||
return map(braces(str, arr, opts), function(ele) {
|
||||
ele = ele.split('__LT_BRACE__').join('{');
|
||||
return ele.split('__RT_BRACE__').join('}');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle escaped dots: `{1\\.2}`
|
||||
*/
|
||||
|
||||
function escapeDots(str, arr, opts) {
|
||||
if (!/[^\\]\..+\\\./.test(str)) {
|
||||
return arr.concat(str.split('\\').join(''));
|
||||
} else {
|
||||
str = str.split('\\.').join('__ESC_DOT__');
|
||||
return map(braces(str, arr, opts), function(ele) {
|
||||
return ele.split('__ESC_DOT__').join('.');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle escaped dots: `{1\\.2}`
|
||||
*/
|
||||
|
||||
function escapePaths(str, arr, opts) {
|
||||
str = str.split('\/.').join('__ESC_PATH__');
|
||||
return map(braces(str, arr, opts), function(ele) {
|
||||
return ele.split('__ESC_PATH__').join('\/.');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle escaped commas: `{a\\,b}`
|
||||
*/
|
||||
|
||||
function escapeCommas(str, arr, opts) {
|
||||
if (!/\w,/.test(str)) {
|
||||
return arr.concat(str.split('\\').join(''));
|
||||
} else {
|
||||
str = str.split('\\,').join('__ESC_COMMA__');
|
||||
return map(braces(str, arr, opts), function(ele) {
|
||||
return ele.split('__ESC_COMMA__').join(',');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Regex for common patterns
|
||||
*/
|
||||
|
||||
function patternRegex() {
|
||||
return /\${|( (?=[{,}])|(?=[{,}]) )|{}|{,}|\\,(?=.*[{}])|\/\.(?=.*[{}])|\\\.(?={)|\\{|\\}/;
|
||||
}
|
||||
|
||||
/**
|
||||
* Braces regex.
|
||||
*/
|
||||
|
||||
function braceRegex() {
|
||||
return /.*(\\?\{([^}]+)\})/;
|
||||
}
|
||||
|
||||
/**
|
||||
* es6 delimiter regex.
|
||||
*/
|
||||
|
||||
function es6Regex() {
|
||||
return /\$\{([^}]+)\}/;
|
||||
}
|
||||
|
||||
var braceRe;
|
||||
var patternRe;
|
||||
|
||||
/**
|
||||
* Faster alternative to `String.replace()` when the
|
||||
* index of the token to be replaces can't be supplied
|
||||
*/
|
||||
|
||||
function splice(str, token, replacement) {
|
||||
var i = str.indexOf(token);
|
||||
return str.substr(0, i) + replacement
|
||||
+ str.substr(i + token.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fast array map
|
||||
*/
|
||||
|
||||
function map(arr, fn) {
|
||||
if (arr == null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
var len = arr.length;
|
||||
var res = new Array(len);
|
||||
var i = -1;
|
||||
|
||||
while (++i < len) {
|
||||
res[i] = fn(arr[i], i, arr);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fast array filter
|
||||
*/
|
||||
|
||||
function filter(arr, cb) {
|
||||
if (arr == null) return [];
|
||||
if (typeof cb !== 'function') {
|
||||
throw new TypeError('braces: filter expects a callback function.');
|
||||
}
|
||||
|
||||
var len = arr.length;
|
||||
var res = arr.slice();
|
||||
var i = 0;
|
||||
|
||||
while (len--) {
|
||||
if (!cb(arr[len], i++)) {
|
||||
res.splice(len, 1);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
114
node_modules/braces/package.json
generated
vendored
Normal file
114
node_modules/braces/package.json
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
{
|
||||
"_from": "braces@^1.8.2",
|
||||
"_id": "braces@1.8.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=",
|
||||
"_location": "/braces",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "braces@^1.8.2",
|
||||
"name": "braces",
|
||||
"escapedName": "braces",
|
||||
"rawSpec": "^1.8.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.8.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/micromatch"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz",
|
||||
"_shasum": "ba77962e12dff969d6b76711e914b737857bf6a7",
|
||||
"_spec": "braces@^1.8.2",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/micromatch",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/braces/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"expand-range": "^1.8.1",
|
||||
"preserve": "^0.2.0",
|
||||
"repeat-element": "^1.1.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces specification.",
|
||||
"devDependencies": {
|
||||
"benchmarked": "^0.1.5",
|
||||
"brace-expansion": "^1.1.3",
|
||||
"chalk": "^1.1.3",
|
||||
"gulp-format-md": "^0.1.8",
|
||||
"minimatch": "^3.0.0",
|
||||
"minimist": "^1.2.0",
|
||||
"mocha": "^2.4.5",
|
||||
"should": "^8.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jonschlinkert/braces",
|
||||
"keywords": [
|
||||
"alpha",
|
||||
"alphabetical",
|
||||
"bash",
|
||||
"brace",
|
||||
"expand",
|
||||
"expansion",
|
||||
"filepath",
|
||||
"fill",
|
||||
"fs",
|
||||
"glob",
|
||||
"globbing",
|
||||
"letter",
|
||||
"match",
|
||||
"matches",
|
||||
"matching",
|
||||
"number",
|
||||
"numerical",
|
||||
"path",
|
||||
"range",
|
||||
"ranges",
|
||||
"sh"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "braces",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonschlinkert/braces.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"verb": {
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"reflinks": [
|
||||
"verb"
|
||||
],
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
},
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"micromatch",
|
||||
"expand-range",
|
||||
"fill-range"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": "1.8.5"
|
||||
}
|
||||
35
node_modules/builtin-modules/builtin-modules.json
generated
vendored
Normal file
35
node_modules/builtin-modules/builtin-modules.json
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
[
|
||||
"assert",
|
||||
"buffer",
|
||||
"child_process",
|
||||
"cluster",
|
||||
"console",
|
||||
"constants",
|
||||
"crypto",
|
||||
"dgram",
|
||||
"dns",
|
||||
"domain",
|
||||
"events",
|
||||
"fs",
|
||||
"http",
|
||||
"https",
|
||||
"module",
|
||||
"net",
|
||||
"os",
|
||||
"path",
|
||||
"process",
|
||||
"punycode",
|
||||
"querystring",
|
||||
"readline",
|
||||
"repl",
|
||||
"stream",
|
||||
"string_decoder",
|
||||
"timers",
|
||||
"tls",
|
||||
"tty",
|
||||
"url",
|
||||
"util",
|
||||
"v8",
|
||||
"vm",
|
||||
"zlib"
|
||||
]
|
||||
10
node_modules/builtin-modules/index.js
generated
vendored
Normal file
10
node_modules/builtin-modules/index.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var blacklist = [
|
||||
'freelist',
|
||||
'sys'
|
||||
];
|
||||
|
||||
module.exports = Object.keys(process.binding('natives')).filter(function (el) {
|
||||
return !/^_|^internal|\//.test(el) && blacklist.indexOf(el) === -1;
|
||||
}).sort();
|
||||
21
node_modules/builtin-modules/license
generated
vendored
Normal file
21
node_modules/builtin-modules/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
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.
|
||||
72
node_modules/builtin-modules/package.json
generated
vendored
Normal file
72
node_modules/builtin-modules/package.json
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"_from": "builtin-modules@^1.0.0",
|
||||
"_id": "builtin-modules@1.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
|
||||
"_location": "/builtin-modules",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "builtin-modules@^1.0.0",
|
||||
"name": "builtin-modules",
|
||||
"escapedName": "builtin-modules",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/is-builtin-module"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
|
||||
"_shasum": "270f076c5a72c02f5b65a47df94c5fe3a278892f",
|
||||
"_spec": "builtin-modules@^1.0.0",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/is-builtin-module",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/builtin-modules/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "List of the Node.js builtin modules",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"static.js",
|
||||
"builtin-modules.json"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/builtin-modules#readme",
|
||||
"keywords": [
|
||||
"builtin",
|
||||
"built-in",
|
||||
"builtins",
|
||||
"node",
|
||||
"modules",
|
||||
"core",
|
||||
"bundled",
|
||||
"list",
|
||||
"array",
|
||||
"names"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "builtin-modules",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/builtin-modules.git"
|
||||
},
|
||||
"scripts": {
|
||||
"make": "node make.js",
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "1.1.1"
|
||||
}
|
||||
41
node_modules/builtin-modules/readme.md
generated
vendored
Normal file
41
node_modules/builtin-modules/readme.md
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
# builtin-modules [](https://travis-ci.org/sindresorhus/builtin-modules)
|
||||
|
||||
> List of the Node.js builtin modules
|
||||
|
||||
The list is just a [JSON file](builtin-modules.json) and can be used wherever.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save builtin-modules
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var builtinModules = require('builtin-modules');
|
||||
|
||||
console.log(builinModules);
|
||||
//=> ['assert', 'buffer', ...]
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
Returns an array of builtin modules fetched from the running Node.js version.
|
||||
|
||||
### Static list
|
||||
|
||||
This module also comes bundled with a static array of builtin modules generated from the latest Node.js version. You can get it with `require('builtin-modules/static');`
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [is-builtin-module](https://github.com/sindresorhus/is-builtin-module) - Check if a string matches the name of a Node.js builtin module
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
2
node_modules/builtin-modules/static.js
generated
vendored
Normal file
2
node_modules/builtin-modules/static.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = require('./builtin-modules.json');
|
||||
12
node_modules/camelcase-keys/index.js
generated
vendored
Normal file
12
node_modules/camelcase-keys/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
var mapObj = require('map-obj');
|
||||
var camelCase = require('camelcase');
|
||||
|
||||
module.exports = function (input, options) {
|
||||
options = options || {};
|
||||
var exclude = options.exclude || [];
|
||||
return mapObj(input, function (key, val) {
|
||||
key = exclude.indexOf(key) === -1 ? camelCase(key) : key;
|
||||
return [key, val];
|
||||
});
|
||||
};
|
||||
21
node_modules/camelcase-keys/license
generated
vendored
Normal file
21
node_modules/camelcase-keys/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
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.
|
||||
84
node_modules/camelcase-keys/package.json
generated
vendored
Normal file
84
node_modules/camelcase-keys/package.json
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"_from": "camelcase-keys@^2.0.0",
|
||||
"_id": "camelcase-keys@2.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=",
|
||||
"_location": "/camelcase-keys",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "camelcase-keys@^2.0.0",
|
||||
"name": "camelcase-keys",
|
||||
"escapedName": "camelcase-keys",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/meow"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz",
|
||||
"_shasum": "308beeaffdf28119051efa1d932213c91b8f92e7",
|
||||
"_spec": "camelcase-keys@^2.0.0",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/meow",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/camelcase-keys/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"camelcase": "^2.0.0",
|
||||
"map-obj": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Convert object keys to camelCase",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/camelcase-keys#readme",
|
||||
"keywords": [
|
||||
"map",
|
||||
"obj",
|
||||
"object",
|
||||
"key",
|
||||
"keys",
|
||||
"value",
|
||||
"values",
|
||||
"val",
|
||||
"iterate",
|
||||
"camelcase",
|
||||
"camel-case",
|
||||
"camel",
|
||||
"case",
|
||||
"dash",
|
||||
"hyphen",
|
||||
"dot",
|
||||
"underscore",
|
||||
"separator",
|
||||
"string",
|
||||
"text",
|
||||
"convert"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "camelcase-keys",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/camelcase-keys.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "2.1.0"
|
||||
}
|
||||
54
node_modules/camelcase-keys/readme.md
generated
vendored
Normal file
54
node_modules/camelcase-keys/readme.md
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
# camelcase-keys [](https://travis-ci.org/sindresorhus/camelcase-keys)
|
||||
|
||||
> Convert object keys to camelCase using [`camelcase`](https://github.com/sindresorhus/camelcase)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save camelcase-keys
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const camelcaseKeys = require('camelcase-keys');
|
||||
|
||||
camelcaseKeys({'foo-bar': true});
|
||||
//=> {fooBar: true}
|
||||
|
||||
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
//=> {_: [], 'foo-bar': true}
|
||||
|
||||
camelcaseKeys(argv);
|
||||
//=> {_: [], fooBar: true}
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### camelcaseKeys(input, [options])
|
||||
|
||||
#### input
|
||||
|
||||
Type: `object`
|
||||
|
||||
Object to camelCase.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### exclude
|
||||
|
||||
Type: `array`
|
||||
Default: `[]`
|
||||
|
||||
Exclude keys from being camelCased.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
56
node_modules/camelcase/index.js
generated
vendored
Normal file
56
node_modules/camelcase/index.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
'use strict';
|
||||
|
||||
function preserveCamelCase(str) {
|
||||
var isLastCharLower = false;
|
||||
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
var c = str.charAt(i);
|
||||
|
||||
if (isLastCharLower && (/[a-zA-Z]/).test(c) && c.toUpperCase() === c) {
|
||||
str = str.substr(0, i) + '-' + str.substr(i);
|
||||
isLastCharLower = false;
|
||||
i++;
|
||||
} else {
|
||||
isLastCharLower = (c.toLowerCase() === c);
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
module.exports = function () {
|
||||
var str = [].map.call(arguments, function (str) {
|
||||
return str.trim();
|
||||
}).filter(function (str) {
|
||||
return str.length;
|
||||
}).join('-');
|
||||
|
||||
if (!str.length) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (str.length === 1) {
|
||||
return str;
|
||||
}
|
||||
|
||||
if (!(/[_.\- ]+/).test(str)) {
|
||||
if (str === str.toUpperCase()) {
|
||||
return str.toLowerCase();
|
||||
}
|
||||
|
||||
if (str[0] !== str[0].toLowerCase()) {
|
||||
return str[0].toLowerCase() + str.slice(1);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
str = preserveCamelCase(str);
|
||||
|
||||
return str
|
||||
.replace(/^[_.\- ]+/, '')
|
||||
.toLowerCase()
|
||||
.replace(/[_.\- ]+(\w|$)/g, function (m, p1) {
|
||||
return p1.toUpperCase();
|
||||
});
|
||||
};
|
||||
21
node_modules/camelcase/license
generated
vendored
Normal file
21
node_modules/camelcase/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
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.
|
||||
71
node_modules/camelcase/package.json
generated
vendored
Normal file
71
node_modules/camelcase/package.json
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"_from": "camelcase@^2.0.0",
|
||||
"_id": "camelcase@2.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=",
|
||||
"_location": "/camelcase",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "camelcase@^2.0.0",
|
||||
"name": "camelcase",
|
||||
"escapedName": "camelcase",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/camelcase-keys"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz",
|
||||
"_shasum": "7c1d16d679a1bbe59ca02cacecfb011e201f5a1f",
|
||||
"_spec": "camelcase@^2.0.0",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/camelcase-keys",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/camelcase/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/camelcase#readme",
|
||||
"keywords": [
|
||||
"camelcase",
|
||||
"camel-case",
|
||||
"camel",
|
||||
"case",
|
||||
"dash",
|
||||
"hyphen",
|
||||
"dot",
|
||||
"underscore",
|
||||
"separator",
|
||||
"string",
|
||||
"text",
|
||||
"convert"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "camelcase",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/camelcase.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "2.1.1"
|
||||
}
|
||||
57
node_modules/camelcase/readme.md
generated
vendored
Normal file
57
node_modules/camelcase/readme.md
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
# camelcase [](https://travis-ci.org/sindresorhus/camelcase)
|
||||
|
||||
> Convert a dash/dot/underscore/space separated string to camelCase: `foo-bar` → `fooBar`
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save camelcase
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const camelCase = require('camelcase');
|
||||
|
||||
camelCase('foo-bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('foo_bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('Foo-Bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('--foo.bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('__foo__bar__');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('foo bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
console.log(process.argv[3]);
|
||||
//=> '--foo-bar'
|
||||
camelCase(process.argv[3]);
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('foo', 'bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('__foo__', '--bar');
|
||||
//=> 'fooBar'
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
|
||||
- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
116
node_modules/chalk/index.js
generated
vendored
Normal file
116
node_modules/chalk/index.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
'use strict';
|
||||
var escapeStringRegexp = require('escape-string-regexp');
|
||||
var ansiStyles = require('ansi-styles');
|
||||
var stripAnsi = require('strip-ansi');
|
||||
var hasAnsi = require('has-ansi');
|
||||
var supportsColor = require('supports-color');
|
||||
var defineProps = Object.defineProperties;
|
||||
var isSimpleWindowsTerm = process.platform === 'win32' && !/^xterm/i.test(process.env.TERM);
|
||||
|
||||
function Chalk(options) {
|
||||
// detect mode if not set manually
|
||||
this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled;
|
||||
}
|
||||
|
||||
// use bright blue on Windows as the normal blue color is illegible
|
||||
if (isSimpleWindowsTerm) {
|
||||
ansiStyles.blue.open = '\u001b[94m';
|
||||
}
|
||||
|
||||
var styles = (function () {
|
||||
var ret = {};
|
||||
|
||||
Object.keys(ansiStyles).forEach(function (key) {
|
||||
ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
|
||||
|
||||
ret[key] = {
|
||||
get: function () {
|
||||
return build.call(this, this._styles.concat(key));
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
return ret;
|
||||
})();
|
||||
|
||||
var proto = defineProps(function chalk() {}, styles);
|
||||
|
||||
function build(_styles) {
|
||||
var builder = function () {
|
||||
return applyStyle.apply(builder, arguments);
|
||||
};
|
||||
|
||||
builder._styles = _styles;
|
||||
builder.enabled = this.enabled;
|
||||
// __proto__ is used because we must return a function, but there is
|
||||
// no way to create a function with a different prototype.
|
||||
/* eslint-disable no-proto */
|
||||
builder.__proto__ = proto;
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
function applyStyle() {
|
||||
// support varags, but simply cast to string in case there's only one arg
|
||||
var args = arguments;
|
||||
var argsLen = args.length;
|
||||
var str = argsLen !== 0 && String(arguments[0]);
|
||||
|
||||
if (argsLen > 1) {
|
||||
// don't slice `arguments`, it prevents v8 optimizations
|
||||
for (var a = 1; a < argsLen; a++) {
|
||||
str += ' ' + args[a];
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.enabled || !str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
var nestedStyles = this._styles;
|
||||
var i = nestedStyles.length;
|
||||
|
||||
// Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
|
||||
// see https://github.com/chalk/chalk/issues/58
|
||||
// If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
|
||||
var originalDim = ansiStyles.dim.open;
|
||||
if (isSimpleWindowsTerm && (nestedStyles.indexOf('gray') !== -1 || nestedStyles.indexOf('grey') !== -1)) {
|
||||
ansiStyles.dim.open = '';
|
||||
}
|
||||
|
||||
while (i--) {
|
||||
var code = ansiStyles[nestedStyles[i]];
|
||||
|
||||
// Replace any instances already present with a re-opening code
|
||||
// otherwise only the part of the string until said closing code
|
||||
// will be colored, and the rest will simply be 'plain'.
|
||||
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
||||
}
|
||||
|
||||
// Reset the original 'dim' if we changed it to work around the Windows dimmed gray issue.
|
||||
ansiStyles.dim.open = originalDim;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function init() {
|
||||
var ret = {};
|
||||
|
||||
Object.keys(styles).forEach(function (name) {
|
||||
ret[name] = {
|
||||
get: function () {
|
||||
return build.call(this, [name]);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
defineProps(Chalk.prototype, init());
|
||||
|
||||
module.exports = new Chalk();
|
||||
module.exports.styles = ansiStyles;
|
||||
module.exports.hasColor = hasAnsi;
|
||||
module.exports.stripColor = stripAnsi;
|
||||
module.exports.supportsColor = supportsColor;
|
||||
21
node_modules/chalk/license
generated
vendored
Normal file
21
node_modules/chalk/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
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.
|
||||
116
node_modules/chalk/package.json
generated
vendored
Normal file
116
node_modules/chalk/package.json
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
{
|
||||
"_from": "chalk@^1.0.0",
|
||||
"_id": "chalk@1.1.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
|
||||
"_location": "/chalk",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "chalk@^1.0.0",
|
||||
"name": "chalk",
|
||||
"escapedName": "chalk",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/fancy-log",
|
||||
"/gulp",
|
||||
"/gulp-util"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
|
||||
"_shasum": "a8115c55e4a702fe4d150abd3872822a7e09fc98",
|
||||
"_spec": "chalk@^1.0.0",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2/node_modules/gulp",
|
||||
"bugs": {
|
||||
"url": "https://github.com/chalk/chalk/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"ansi-styles": "^2.2.1",
|
||||
"escape-string-regexp": "^1.0.2",
|
||||
"has-ansi": "^2.0.0",
|
||||
"strip-ansi": "^3.0.0",
|
||||
"supports-color": "^2.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Terminal string styling done right. Much color.",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.2",
|
||||
"matcha": "^0.6.0",
|
||||
"mocha": "*",
|
||||
"nyc": "^3.0.0",
|
||||
"require-uncached": "^1.0.2",
|
||||
"resolve-from": "^1.0.0",
|
||||
"semver": "^4.3.3",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/chalk/chalk#readme",
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"str",
|
||||
"ansi",
|
||||
"style",
|
||||
"styles",
|
||||
"tty",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
{
|
||||
"name": "Joshua Appelman",
|
||||
"email": "jappelman@xebia.com",
|
||||
"url": "jbnicolai.com"
|
||||
},
|
||||
{
|
||||
"name": "JD Ballard",
|
||||
"email": "i.am.qix@gmail.com",
|
||||
"url": "github.com/qix-"
|
||||
}
|
||||
],
|
||||
"name": "chalk",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/chalk/chalk.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "matcha benchmark.js",
|
||||
"coverage": "nyc npm test && nyc report",
|
||||
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
|
||||
"test": "xo && mocha"
|
||||
},
|
||||
"version": "1.1.3",
|
||||
"xo": {
|
||||
"envs": [
|
||||
"node",
|
||||
"mocha"
|
||||
]
|
||||
}
|
||||
}
|
||||
213
node_modules/chalk/readme.md
generated
vendored
Normal file
213
node_modules/chalk/readme.md
generated
vendored
Normal file
@@ -0,0 +1,213 @@
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img width="360" src="https://cdn.rawgit.com/chalk/chalk/19935d6484811c5e468817f846b7b3d417d7bf4a/logo.svg" alt="chalk">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
> Terminal string styling done right
|
||||
|
||||
[](https://travis-ci.org/chalk/chalk)
|
||||
[](https://coveralls.io/r/chalk/chalk?branch=master)
|
||||
[](https://www.youtube.com/watch?v=9auOCbH5Ns4)
|
||||
|
||||
|
||||
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68). Although there are other ones, they either do too much or not enough.
|
||||
|
||||
**Chalk is a clean and focused alternative.**
|
||||
|
||||

|
||||
|
||||
|
||||
## Why
|
||||
|
||||
- Highly performant
|
||||
- Doesn't extend `String.prototype`
|
||||
- Expressive API
|
||||
- Ability to nest styles
|
||||
- Clean and focused
|
||||
- Auto-detects color support
|
||||
- Actively maintained
|
||||
- [Used by ~4500 modules](https://www.npmjs.com/browse/depended/chalk) as of July 15, 2015
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save chalk
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
|
||||
// style a string
|
||||
chalk.blue('Hello world!');
|
||||
|
||||
// combine styled and normal strings
|
||||
chalk.blue('Hello') + 'World' + chalk.red('!');
|
||||
|
||||
// compose multiple styles using the chainable API
|
||||
chalk.blue.bgRed.bold('Hello world!');
|
||||
|
||||
// pass in multiple arguments
|
||||
chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz');
|
||||
|
||||
// nest styles
|
||||
chalk.red('Hello', chalk.underline.bgBlue('world') + '!');
|
||||
|
||||
// nest styles of the same type even (color, underline, background)
|
||||
chalk.green(
|
||||
'I am a green line ' +
|
||||
chalk.blue.underline.bold('with a blue substring') +
|
||||
' that becomes green again!'
|
||||
);
|
||||
```
|
||||
|
||||
Easily define your own themes.
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
var error = chalk.bold.red;
|
||||
console.log(error('Error!'));
|
||||
```
|
||||
|
||||
Take advantage of console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data).
|
||||
|
||||
```js
|
||||
var name = 'Sindre';
|
||||
console.log(chalk.green('Hello %s'), name);
|
||||
//=> Hello Sindre
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### chalk.`<style>[.<style>...](string, [string...])`
|
||||
|
||||
Example: `chalk.red.bold.underline('Hello', 'world');`
|
||||
|
||||
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `Chalk.red.yellow.green` is equivalent to `Chalk.green`.
|
||||
|
||||
Multiple arguments will be separated by space.
|
||||
|
||||
### chalk.enabled
|
||||
|
||||
Color support is automatically detected, but you can override it by setting the `enabled` property. You should however only do this in your own code as it applies globally to all chalk consumers.
|
||||
|
||||
If you need to change this in a reusable module create a new instance:
|
||||
|
||||
```js
|
||||
var ctx = new chalk.constructor({enabled: false});
|
||||
```
|
||||
|
||||
### chalk.supportsColor
|
||||
|
||||
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
|
||||
|
||||
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`.
|
||||
|
||||
### chalk.styles
|
||||
|
||||
Exposes the styles as [ANSI escape codes](https://github.com/chalk/ansi-styles).
|
||||
|
||||
Generally not useful, but you might need just the `.open` or `.close` escape code if you're mixing externally styled strings with your own.
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
|
||||
console.log(chalk.styles.red);
|
||||
//=> {open: '\u001b[31m', close: '\u001b[39m'}
|
||||
|
||||
console.log(chalk.styles.red.open + 'Hello' + chalk.styles.red.close);
|
||||
```
|
||||
|
||||
### chalk.hasColor(string)
|
||||
|
||||
Check whether a string [has color](https://github.com/chalk/has-ansi).
|
||||
|
||||
### chalk.stripColor(string)
|
||||
|
||||
[Strip color](https://github.com/chalk/strip-ansi) from a string.
|
||||
|
||||
Can be useful in combination with `.supportsColor` to strip color on externally styled text when it's not supported.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
var styledString = getText();
|
||||
|
||||
if (!chalk.supportsColor) {
|
||||
styledString = chalk.stripColor(styledString);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(not widely supported)*
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue` *(on Windows the bright version is used as normal blue is illegible)*
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `gray`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
|
||||
|
||||
## 256-colors
|
||||
|
||||
Chalk does not support anything other than the base eight colors, which guarantees it will work on all terminals and systems. Some terminals, specifically `xterm` compliant ones, will support the full range of 8-bit colors. For this the lower level [ansi-256-colors](https://github.com/jbnicolai/ansi-256-colors) package can be used.
|
||||
|
||||
|
||||
## Windows
|
||||
|
||||
If you're on Windows, do yourself a favor and use [`cmder`](http://bliker.github.io/cmder/) instead of `cmd.exe`.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
|
||||
- [ansi-styles](https://github.com/chalk/ansi-styles/) - ANSI escape codes for styling strings in the terminal
|
||||
- [supports-color](https://github.com/chalk/supports-color/) - Detect whether a terminal supports color
|
||||
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
|
||||
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
||||
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
||||
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
1316
node_modules/clean-css/History.md
generated
vendored
Normal file
1316
node_modules/clean-css/History.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
19
node_modules/clean-css/LICENSE
generated
vendored
Normal file
19
node_modules/clean-css/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (C) 2017 JakubPawlowicz.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.
|
||||
719
node_modules/clean-css/README.md
generated
vendored
Normal file
719
node_modules/clean-css/README.md
generated
vendored
Normal file
@@ -0,0 +1,719 @@
|
||||
<h1 align="center">
|
||||
<br/>
|
||||
<img src="https://cdn.rawgit.com/jakubpawlowicz/clean-css/master/logo.v2.svg" alt="clean-css logo" width="525px"/>
|
||||
<br/>
|
||||
<br/>
|
||||
</h1>
|
||||
|
||||
[](https://www.npmjs.com/package/clean-css)
|
||||
[](https://travis-ci.org/jakubpawlowicz/clean-css)
|
||||
[](https://ci.appveyor.com/project/jakubpawlowicz/clean-css/branch/master)
|
||||
[](https://david-dm.org/jakubpawlowicz/clean-css)
|
||||
[](https://www.npmjs.com/package/clean-css)
|
||||
[](https://twitter.com/cleancss)
|
||||
|
||||
clean-css is a fast and efficient CSS optimizer for [Node.js](http://nodejs.org/) platform and [any modern browser](https://jakubpawlowicz.github.io/clean-css).
|
||||
|
||||
According to [tests](http://goalsmashers.github.io/css-minification-benchmark/) it is one of the best available.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
- [Node.js version support](#nodejs-version-support)
|
||||
- [Install](#install)
|
||||
- [Use](#use)
|
||||
* [Important: 4.0 breaking changes](#important-40-breaking-changes)
|
||||
* [What's new in version 4.1](#whats-new-in-version-41)
|
||||
* [Constructor options](#constructor-options)
|
||||
* [Compatibility modes](#compatibility-modes)
|
||||
* [Fetch option](#fetch-option)
|
||||
* [Formatting options](#formatting-options)
|
||||
* [Inlining options](#inlining-options)
|
||||
* [Optimization levels](#optimization-levels)
|
||||
+ [Level 0 optimizations](#level-0-optimizations)
|
||||
+ [Level 1 optimizations](#level-1-optimizations)
|
||||
+ [Level 2 optimizations](#level-2-optimizations)
|
||||
* [Minify method](#minify-method)
|
||||
* [Promise interface](#promise-interface)
|
||||
* [CLI utility](#cli-utility)
|
||||
- [FAQ](#faq)
|
||||
* [How to optimize multiple files?](#how-to-optimize-multiple-files)
|
||||
* [How to process remote `@import`s correctly?](#how-to-process-remote-imports-correctly)
|
||||
* [How to apply arbitrary transformations to CSS properties?](#how-to-apply-arbitrary-transformations-to-css-properties)
|
||||
* [How to specify a custom rounding precision?](#how-to-specify-a-custom-rounding-precision)
|
||||
* [How to preserve a comment block?](#how-to-preserve-a-comment-block)
|
||||
* [How to rebase relative image URLs?](#how-to-rebase-relative-image-urls)
|
||||
* [How to work with source maps?](#how-to-work-with-source-maps)
|
||||
* [How to apply level 1 & 2 optimizations at the same time?](#how-to-apply-level-1--2-optimizations-at-the-same-time)
|
||||
* [What level 2 optimizations do?](#what-level-2-optimizations-do)
|
||||
* [How to use clean-css with build tools?](#how-to-use-clean-css-with-build-tools)
|
||||
* [How to use clean-css from web browser?](#how-to-use-clean-css-from-web-browser)
|
||||
- [Contributing](#contributing)
|
||||
* [How to get started?](#how-to-get-started)
|
||||
- [Acknowledgments](#acknowledgments)
|
||||
- [License](#license)
|
||||
|
||||
# Node.js version support
|
||||
|
||||
clean-css requires Node.js 4.0+ (tested on Linux, OS X, and Windows)
|
||||
|
||||
# Install
|
||||
|
||||
```
|
||||
npm install clean-css
|
||||
```
|
||||
|
||||
# Use
|
||||
|
||||
```js
|
||||
var CleanCSS = require('clean-css');
|
||||
var input = 'a{font-weight:bold;}';
|
||||
var options = { /* options */ };
|
||||
var output = new CleanCSS(options).minify(input);
|
||||
```
|
||||
|
||||
## Important: 4.0 breaking changes
|
||||
|
||||
clean-css 4.0 introduces some breaking changes:
|
||||
|
||||
* API and CLI interfaces are split, so API stays in this repository while CLI moves to [clean-css-cli](https://github.com/jakubpawlowicz/clean-css-cli);
|
||||
* `root`, `relativeTo`, and `target` options are replaced by a single `rebaseTo` option - this means that rebasing URLs and import inlining is much simpler but may not be (YMMV) as powerful as in 3.x;
|
||||
* `debug` option is gone as stats are always provided in output object under `stats` property;
|
||||
* `roundingPrecision` is disabled by default;
|
||||
* `roundingPrecision` applies to **all** units now, not only `px` as in 3.x;
|
||||
* `processImport` and `processImportFrom` are merged into `inline` option which defaults to `local`. Remote `@import` rules are **NOT** inlined by default anymore;
|
||||
* splits `inliner: { request: ..., timeout: ... }` option into `inlineRequest` and `inlineTimeout` options;
|
||||
* remote resources without a protocol, e.g. `//fonts.googleapis.com/css?family=Domine:700`, are not inlined anymore;
|
||||
* changes default Internet Explorer compatibility from 9+ to 10+, to revert the old default use `{ compatibility: 'ie9' }` flag;
|
||||
* renames `keepSpecialComments` to `specialComments`;
|
||||
* moves `roundingPrecision` and `specialComments` to level 1 optimizations options, see examples;
|
||||
* moves `mediaMerging`, `restructuring`, `semanticMerging`, and `shorthandCompacting` to level 2 optimizations options, see examples below;
|
||||
* renames `shorthandCompacting` option to `mergeIntoShorthands`;
|
||||
* level 1 optimizations are the new default, up to 3.x it was level 2;
|
||||
* `keepBreaks` option is replaced with `{ format: 'keep-breaks' }` to ease transition;
|
||||
* `sourceMap` option has to be a boolean from now on - to specify an input source map pass it a 2nd argument to `minify` method or via a hash instead;
|
||||
* `aggressiveMerging` option is removed as aggressive merging is replaced by smarter override merging.
|
||||
|
||||
## What's new in version 4.1
|
||||
|
||||
clean-css 4.1 introduces the following changes / features:
|
||||
|
||||
* `inline: false` as an alias to `inline: ['none']`;
|
||||
* `multiplePseudoMerging` compatibility flag controlling merging of rules with multiple pseudo classes / elements;
|
||||
* `removeEmpty` flag in level 1 optimizations controlling removal of rules and nested blocks;
|
||||
* `removeEmpty` flag in level 2 optimizations controlling removal of rules and nested blocks;
|
||||
* `compatibility: { selectors: { mergeLimit: <number> } }` flag in compatibility settings controlling maximum number of selectors in a single rule;
|
||||
* `minify` method improved signature accepting a list of hashes for a predictable traversal;
|
||||
* `selectorsSortingMethod` level 1 optimization allows `false` or `'none'` for disabling selector sorting;
|
||||
* `fetch` option controlling a function for handling remote requests;
|
||||
* new `font` shorthand and `font-*` longhand optimizers;
|
||||
* removal of `optimizeFont` flag in level 1 optimizations due to new `font` shorthand optimizer;
|
||||
* `skipProperties` flag in level 2 optimizations controlling which properties won't be optimized;
|
||||
* new `animation` shorthand and `animation-*` longhand optimizers;
|
||||
* `removeUnusedAtRules` level 2 optimization controlling removal of unused `@counter-style`, `@font-face`, `@keyframes`, and `@namespace` at rules;
|
||||
* the [web interface](https://jakubpawlowicz.github.io/clean-css) gets an improved settings panel with "reset to defaults", instant option changes, and settings being persisted across sessions.
|
||||
|
||||
## Constructor options
|
||||
|
||||
clean-css constructor accepts a hash as a parameter with the following options available:
|
||||
|
||||
* `compatibility` - controls compatibility mode used; defaults to `ie10+`; see [compatibility modes](#compatibility-modes) for examples;
|
||||
* `fetch` - controls a function for handling remote requests; see [fetch option](#fetch-option) for examples (since 4.1.0);
|
||||
* `format` - controls output CSS formatting; defaults to `false`; see [formatting options](#formatting-options) for examples;
|
||||
* `inline` - controls `@import` inlining rules; defaults to `'local'`; see [inlining options](#inlining-options) for examples;
|
||||
* `inlineRequest` - controls extra options for inlining remote `@import` rules, can be any of [HTTP(S) request options](https://nodejs.org/api/http.html#http_http_request_options_callback);
|
||||
* `inlineTimeout` - controls number of milliseconds after which inlining a remote `@import` fails; defaults to 5000;
|
||||
* `level` - controls optimization level used; defaults to `1`; see [optimization levels](#optimization-levels) for examples;
|
||||
* `rebase` - controls URL rebasing; defaults to `true`;
|
||||
* `rebaseTo` - controls a directory to which all URLs are rebased, most likely the directory under which the output file will live; defaults to the current directory;
|
||||
* `returnPromise` - controls whether `minify` method returns a Promise object or not; defaults to `false`; see [promise interface](#promise-interface) for examples;
|
||||
* `sourceMap` - controls whether an output source map is built; defaults to `false`;
|
||||
* `sourceMapInlineSources` - controls embedding sources inside a source map's `sourcesContent` field; defaults to false.
|
||||
|
||||
## Compatibility modes
|
||||
|
||||
There is a certain number of compatibility mode shortcuts, namely:
|
||||
|
||||
* `new CleanCSS({ compatibility: '*' })` (default) - Internet Explorer 10+ compatibility mode
|
||||
* `new CleanCSS({ compatibility: 'ie9' })` - Internet Explorer 9+ compatibility mode
|
||||
* `new CleanCSS({ compatibility: 'ie8' })` - Internet Explorer 8+ compatibility mode
|
||||
* `new CleanCSS({ compatibility: 'ie7' })` - Internet Explorer 7+ compatibility mode
|
||||
|
||||
Each of these modes is an alias to a [fine grained configuration](https://github.com/jakubpawlowicz/clean-css/blob/master/lib/options/compatibility.js), with the following options available:
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
compatibility: {
|
||||
colors: {
|
||||
opacity: true // controls `rgba()` / `hsla()` color support
|
||||
},
|
||||
properties: {
|
||||
backgroundClipMerging: true, // controls background-clip merging into shorthand
|
||||
backgroundOriginMerging: true, // controls background-origin merging into shorthand
|
||||
backgroundSizeMerging: true, // controls background-size merging into shorthand
|
||||
colors: true, // controls color optimizations
|
||||
ieBangHack: false, // controls keeping IE bang hack
|
||||
ieFilters: false, // controls keeping IE `filter` / `-ms-filter`
|
||||
iePrefixHack: false, // controls keeping IE prefix hack
|
||||
ieSuffixHack: false, // controls keeping IE suffix hack
|
||||
merging: true, // controls property merging based on understandability
|
||||
shorterLengthUnits: false, // controls shortening pixel units into `pc`, `pt`, or `in` units
|
||||
spaceAfterClosingBrace: true, // controls keeping space after closing brace - `url() no-repeat` into `url()no-repeat`
|
||||
urlQuotes: false, // controls keeping quoting inside `url()`
|
||||
zeroUnits: true // controls removal of units `0` value
|
||||
},
|
||||
selectors: {
|
||||
adjacentSpace: false, // controls extra space before `nav` element
|
||||
ie7Hack: true, // controls removal of IE7 selector hacks, e.g. `*+html...`
|
||||
mergeablePseudoClasses: [':active', ...], // controls a whitelist of mergeable pseudo classes
|
||||
mergeablePseudoElements: ['::after', ...], // controls a whitelist of mergeable pseudo elements
|
||||
mergeLimit: 8191, // controls maximum number of selectors in a single rule (since 4.1.0)
|
||||
multiplePseudoMerging: true // controls merging of rules with multiple pseudo classes / elements (since 4.1.0)
|
||||
},
|
||||
units: {
|
||||
ch: true, // controls treating `ch` as a supported unit
|
||||
in: true, // controls treating `in` as a supported unit
|
||||
pc: true, // controls treating `pc` as a supported unit
|
||||
pt: true, // controls treating `pt` as a supported unit
|
||||
rem: true, // controls treating `rem` as a supported unit
|
||||
vh: true, // controls treating `vh` as a supported unit
|
||||
vm: true, // controls treating `vm` as a supported unit
|
||||
vmax: true, // controls treating `vmax` as a supported unit
|
||||
vmin: true // controls treating `vmin` as a supported unit
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
You can also use a string when setting a compatibility mode, e.g.
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
compatibility: 'ie9,-properties.merging' // sets compatibility to IE9 mode with disabled property merging
|
||||
})
|
||||
```
|
||||
|
||||
## Fetch option
|
||||
|
||||
The `fetch` option accepts a function which handles remote resource fetching, e.g.
|
||||
|
||||
```js
|
||||
var request = require('request');
|
||||
var source = '@import url(http://example.com/path/to/stylesheet.css);';
|
||||
new CleanCSS({
|
||||
fetch: function (uri, inlineRequest, inlineTimeout, callback) {
|
||||
request(uri, function (error, response, body) {
|
||||
if (error) {
|
||||
callback(error, null);
|
||||
} else if (response && response.statusCode != 200) {
|
||||
callback(response.statusCode, null);
|
||||
} else {
|
||||
callback(null, body);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).minify(source);
|
||||
```
|
||||
|
||||
This option provides a convenient way of overriding the default fetching logic if it doesn't support a particular feature, say CONNECT proxies.
|
||||
|
||||
Unless given, the default [loadRemoteResource](https://github.com/jakubpawlowicz/clean-css/blob/master/lib/reader/load-remote-resource.js) logic is used.
|
||||
|
||||
## Formatting options
|
||||
|
||||
By default output CSS is formatted without any whitespace unless a `format` option is given.
|
||||
First of all there are two shorthands:
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
format: 'beautify' // formats output in a really nice way
|
||||
})
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
format: 'keep-breaks' // formats output the default way but adds line breaks for improved readability
|
||||
})
|
||||
```
|
||||
|
||||
however `format` option also accept a fine-grained set of options:
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
format: {
|
||||
breaks: { // controls where to insert breaks
|
||||
afterAtRule: false, // controls if a line break comes after an at-rule; e.g. `@charset`; defaults to `false`
|
||||
afterBlockBegins: false, // controls if a line break comes after a block begins; e.g. `@media`; defaults to `false`
|
||||
afterBlockEnds: false, // controls if a line break comes after a block ends, defaults to `false`
|
||||
afterComment: false, // controls if a line break comes after a comment; defaults to `false`
|
||||
afterProperty: false, // controls if a line break comes after a property; defaults to `false`
|
||||
afterRuleBegins: false, // controls if a line break comes after a rule begins; defaults to `false`
|
||||
afterRuleEnds: false, // controls if a line break comes after a rule ends; defaults to `false`
|
||||
beforeBlockEnds: false, // controls if a line break comes before a block ends; defaults to `false`
|
||||
betweenSelectors: false // controls if a line break comes between selectors; defaults to `false`
|
||||
},
|
||||
indentBy: 0, // controls number of characters to indent with; defaults to `0`
|
||||
indentWith: 'space', // controls a character to indent with, can be `'space'` or `'tab'`; defaults to `'space'`
|
||||
spaces: { // controls where to insert spaces
|
||||
aroundSelectorRelation: false, // controls if spaces come around selector relations; e.g. `div > a`; defaults to `false`
|
||||
beforeBlockBegins: false, // controls if a space comes before a block begins; e.g. `.block {`; defaults to `false`
|
||||
beforeValue: false // controls if a space comes before a value; e.g. `width: 1rem`; defaults to `false`
|
||||
},
|
||||
wrapAt: false // controls maximum line length; defaults to `false`
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Inlining options
|
||||
|
||||
`inline` option whitelists which `@import` rules will be processed, e.g.
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
inline: ['local'] // default; enables local inlining only
|
||||
})
|
||||
```
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
inline: ['none'] // disables all inlining
|
||||
})
|
||||
```
|
||||
|
||||
```js
|
||||
// introduced in clean-css 4.1.0
|
||||
|
||||
new CleanCSS({
|
||||
inline: false // disables all inlining (alias to `['none']`)
|
||||
})
|
||||
```
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
inline: ['all'] // enables all inlining, same as ['local', 'remote']
|
||||
})
|
||||
```
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
inline: ['local', 'mydomain.example.com'] // enables local inlining plus given remote source
|
||||
})
|
||||
```
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
inline: ['local', 'remote', '!fonts.googleapis.com'] // enables all inlining but from given remote source
|
||||
})
|
||||
```
|
||||
|
||||
## Optimization levels
|
||||
|
||||
The `level` option can be either `0`, `1` (default), or `2`, e.g.
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
level: 2
|
||||
})
|
||||
```
|
||||
|
||||
or a fine-grained configuration given via a hash.
|
||||
|
||||
Please note that level 1 optimization options are generally safe while level 2 optimizations should be safe for most users.
|
||||
|
||||
### Level 0 optimizations
|
||||
|
||||
Level 0 optimizations simply means "no optimizations". Use it when you'd like to inline imports and / or rebase URLs but skip everything else.
|
||||
|
||||
### Level 1 optimizations
|
||||
|
||||
Level 1 optimizations (default) operate on single properties only, e.g. can remove units when not required, turn rgb colors to a shorter hex representation, remove comments, etc
|
||||
|
||||
Here is a full list of available options:
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
level: {
|
||||
1: {
|
||||
cleanupCharsets: true, // controls `@charset` moving to the front of a stylesheet; defaults to `true`
|
||||
normalizeUrls: true, // controls URL normalization; defaults to `true`
|
||||
optimizeBackground: true, // controls `background` property optimizations; defaults to `true`
|
||||
optimizeBorderRadius: true, // controls `border-radius` property optimizations; defaults to `true`
|
||||
optimizeFilter: true, // controls `filter` property optimizations; defaults to `true`
|
||||
optimizeFont: true, // controls `font` property optimizations; defaults to `true`
|
||||
optimizeFontWeight: true, // controls `font-weight` property optimizations; defaults to `true`
|
||||
optimizeOutline: true, // controls `outline` property optimizations; defaults to `true`
|
||||
removeEmpty: true, // controls removing empty rules and nested blocks; defaults to `true`
|
||||
removeNegativePaddings: true, // controls removing negative paddings; defaults to `true`
|
||||
removeQuotes: true, // controls removing quotes when unnecessary; defaults to `true`
|
||||
removeWhitespace: true, // controls removing unused whitespace; defaults to `true`
|
||||
replaceMultipleZeros: true, // contols removing redundant zeros; defaults to `true`
|
||||
replaceTimeUnits: true, // controls replacing time units with shorter values; defaults to `true`
|
||||
replaceZeroUnits: true, // controls replacing zero values with units; defaults to `true`
|
||||
roundingPrecision: false, // rounds pixel values to `N` decimal places; `false` disables rounding; defaults to `false`
|
||||
selectorsSortingMethod: 'standard', // denotes selector sorting method; can be `'natural'` or `'standard'`, `'none'`, or false (the last two since 4.1.0); defaults to `'standard'`
|
||||
specialComments: 'all', // denotes a number of /*! ... */ comments preserved; defaults to `all`
|
||||
tidyAtRules: true, // controls at-rules (e.g. `@charset`, `@import`) optimizing; defaults to `true`
|
||||
tidyBlockScopes: true, // controls block scopes (e.g. `@media`) optimizing; defaults to `true`
|
||||
tidySelectors: true, // controls selectors optimizing; defaults to `true`,
|
||||
transform: function () {} // defines a callback for fine-grained property optimization; defaults to no-op
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
There is an `all` shortcut for toggling all options at the same time, e.g.
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
level: {
|
||||
1: {
|
||||
all: false, // set all values to `false`
|
||||
tidySelectors: true // turns on optimizing selectors
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### Level 2 optimizations
|
||||
|
||||
Level 2 optimizations operate at rules or multiple properties level, e.g. can remove duplicate rules, remove properties redefined further down a stylesheet, or restructure rules by moving them around.
|
||||
|
||||
Please note that if level 2 optimizations are turned on then, unless explicitely disabled, level 1 optimizations are applied as well.
|
||||
|
||||
Here is a full list of available options:
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
level: {
|
||||
2: {
|
||||
mergeAdjacentRules: true, // controls adjacent rules merging; defaults to true
|
||||
mergeIntoShorthands: true, // controls merging properties into shorthands; defaults to true
|
||||
mergeMedia: true, // controls `@media` merging; defaults to true
|
||||
mergeNonAdjacentRules: true, // controls non-adjacent rule merging; defaults to true
|
||||
mergeSemantically: false, // controls semantic merging; defaults to false
|
||||
overrideProperties: true, // controls property overriding based on understandability; defaults to true
|
||||
removeEmpty: true, // controls removing empty rules and nested blocks; defaults to `true`
|
||||
reduceNonAdjacentRules: true, // controls non-adjacent rule reducing; defaults to true
|
||||
removeDuplicateFontRules: true, // controls duplicate `@font-face` removing; defaults to true
|
||||
removeDuplicateMediaBlocks: true, // controls duplicate `@media` removing; defaults to true
|
||||
removeDuplicateRules: true, // controls duplicate rules removing; defaults to true
|
||||
removeUnusedAtRules: false, // controls unused at rule removing; defaults to false (available since 4.1.0)
|
||||
restructureRules: false, // controls rule restructuring; defaults to false
|
||||
skipProperties: [] // controls which properties won't be optimized, defaults to `[]` which means all will be optimized (since 4.1.0)
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
There is an `all` shortcut for toggling all options at the same time, e.g.
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
level: {
|
||||
2: {
|
||||
all: false, // sets all values to `false`
|
||||
removeDuplicateRules: true // turns on removing duplicate rules
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Minify method
|
||||
|
||||
Once configured clean-css provides a `minify` method to optimize a given CSS, e.g.
|
||||
|
||||
```js
|
||||
var output = new CleanCSS(options).minify(source);
|
||||
```
|
||||
|
||||
The output of the `minify` method is a hash with following fields:
|
||||
|
||||
```js
|
||||
console.log(output.styles); // optimized output CSS as a string
|
||||
console.log(output.sourceMap); // output source map if requested with `sourceMap` option
|
||||
console.log(output.errors); // a list of errors raised
|
||||
console.log(output.warnings); // a list of warnings raised
|
||||
console.log(output.stats.originalSize); // original content size after import inlining
|
||||
console.log(output.stats.minifiedSize); // optimized content size
|
||||
console.log(output.stats.timeSpent); // time spent on optimizations in milliseconds
|
||||
console.log(output.stats.efficiency); // `(originalSize - minifiedSize) / originalSize`, e.g. 0.25 if size is reduced from 100 bytes to 75 bytes
|
||||
```
|
||||
|
||||
The `minify` method also accepts an input source map, e.g.
|
||||
|
||||
```js
|
||||
var output = new CleanCSS(options).minify(source, inputSourceMap);
|
||||
```
|
||||
|
||||
or a callback invoked when optimizations are finished, e.g.
|
||||
|
||||
```js
|
||||
new CleanCSS(options).minify(source, function (error, output) {
|
||||
// `output` is the same as in the synchronous call above
|
||||
});
|
||||
```
|
||||
|
||||
## Promise interface
|
||||
|
||||
If you prefer clean-css to return a Promise object then you need to explicitely ask for it, e.g.
|
||||
|
||||
```js
|
||||
new CleanCSS({ returnPromise: true })
|
||||
.minify(source)
|
||||
.then(function (output) { console.log(output.styles); })
|
||||
.catch(function (error) { // deal with errors });
|
||||
```
|
||||
|
||||
## CLI utility
|
||||
|
||||
Clean-css has an associated command line utility that can be installed separately using `npm install clean-css-cli`. For more detailed information, please visit https://github.com/jakubpawlowicz/clean-css-cli.
|
||||
|
||||
# FAQ
|
||||
|
||||
## How to optimize multiple files?
|
||||
|
||||
It can be done either by passing an array of paths, or, when sources are already available, a hash or an array of hashes:
|
||||
|
||||
```js
|
||||
new CleanCSS().minify(['path/to/file/one', 'path/to/file/two']);
|
||||
```
|
||||
|
||||
```js
|
||||
new CleanCSS().minify({
|
||||
'path/to/file/one': {
|
||||
styles: 'contents of file one'
|
||||
},
|
||||
'path/to/file/two': {
|
||||
styles: 'contents of file two'
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
```js
|
||||
new CleanCSS().minify([
|
||||
{'path/to/file/one': {styles: 'contents of file one'}},
|
||||
{'path/to/file/two': {styles: 'contents of file two'}}
|
||||
]);
|
||||
```
|
||||
|
||||
Passing an array of hashes allows you to explicitly specify the order in which the input files are concatenated. Whereas when you use a single hash the order is determined by the [traversal order of object properties](http://2ality.com/2015/10/property-traversal-order-es6.html) - available since 4.1.0.
|
||||
|
||||
Important note - any `@import` rules already present in the hash will be resolved in memory.
|
||||
|
||||
## How to process remote `@import`s correctly?
|
||||
|
||||
In order to inline remote `@import` statements you need to provide a callback to minify method as fetching remote assets is an asynchronous operation, e.g.:
|
||||
|
||||
```js
|
||||
var source = '@import url(http://example.com/path/to/remote/styles);';
|
||||
new CleanCSS({ inline: ['remote'] }).minify(source, function (error, output) {
|
||||
// output.styles
|
||||
});
|
||||
```
|
||||
|
||||
If you don't provide a callback, then remote `@import`s will be left as is.
|
||||
|
||||
## How to apply arbitrary transformations to CSS properties?
|
||||
|
||||
If clean-css doesn't perform a particular property optimization, you can use `transform` callback to apply it:
|
||||
|
||||
```js
|
||||
var source = '.block{background-image:url(/path/to/image.png)}';
|
||||
var output = new CleanCSS({
|
||||
level: {
|
||||
1: {
|
||||
transform: function (propertyName, propertyValue) {
|
||||
if (propertyName == 'background-image' && propertyValue.indexOf('/path/to') > -1) {
|
||||
return propertyValue.replace('/path/to', '../valid/path/to');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}).minify(source);
|
||||
|
||||
console.log(output.styles); # => .block{background-image:url(../valid/path/to/image.png)}
|
||||
```
|
||||
|
||||
Note: returning `false` from `transform` callback will drop a property.
|
||||
|
||||
## How to specify a custom rounding precision?
|
||||
|
||||
The level 1 `roundingPrecision` optimization option accept a string with per-unit rounding precision settings, e.g.
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
level: {
|
||||
1: {
|
||||
roundingPrecision: 'all=3,px=5'
|
||||
}
|
||||
}
|
||||
}).minify(source)
|
||||
```
|
||||
|
||||
which sets all units rounding precision to 3 digits except `px` unit precision of 5 digits.
|
||||
|
||||
## How to preserve a comment block?
|
||||
|
||||
Use the `/*!` notation instead of the standard one `/*`:
|
||||
|
||||
```css
|
||||
/*!
|
||||
Important comments included in optimized output.
|
||||
*/
|
||||
```
|
||||
|
||||
## How to rebase relative image URLs?
|
||||
|
||||
clean-css will handle it automatically for you in the following cases:
|
||||
|
||||
* when full paths to input files are passed in as options;
|
||||
* when correct paths are passed in via a hash;
|
||||
* when `rebaseTo` is used with any of above two.
|
||||
|
||||
## How to work with source maps?
|
||||
|
||||
To generate a source map, use `sourceMap: true` option, e.g.:
|
||||
|
||||
```js
|
||||
new CleanCSS({ sourceMap: true, rebaseTo: pathToOutputDirectory })
|
||||
.minify(source, function (error, output) {
|
||||
// access output.sourceMap for SourceMapGenerator object
|
||||
// see https://github.com/mozilla/source-map/#sourcemapgenerator for more details
|
||||
});
|
||||
```
|
||||
|
||||
You can also pass an input source map directly as a 2nd argument to `minify` method:
|
||||
|
||||
```js
|
||||
new CleanCSS({ sourceMap: true, rebaseTo: pathToOutputDirectory })
|
||||
.minify(source, inputSourceMap, function (error, output) {
|
||||
// access output.sourceMap to access SourceMapGenerator object
|
||||
// see https://github.com/mozilla/source-map/#sourcemapgenerator for more details
|
||||
});
|
||||
```
|
||||
|
||||
or even multiple input source maps at once:
|
||||
|
||||
```js
|
||||
new CleanCSS({ sourceMap: true, rebaseTo: pathToOutputDirectory }).minify({
|
||||
'path/to/source/1': {
|
||||
styles: '...styles...',
|
||||
sourceMap: '...source-map...'
|
||||
},
|
||||
'path/to/source/2': {
|
||||
styles: '...styles...',
|
||||
sourceMap: '...source-map...'
|
||||
}
|
||||
}, function (error, output) {
|
||||
// access output.sourceMap as above
|
||||
});
|
||||
```
|
||||
|
||||
## How to apply level 1 & 2 optimizations at the same time?
|
||||
|
||||
Using the hash configuration specifying both optimization levels, e.g.
|
||||
|
||||
```js
|
||||
new CleanCSS({
|
||||
level: {
|
||||
1: {
|
||||
all: true,
|
||||
normalizeUrls: false
|
||||
},
|
||||
2: {
|
||||
restructureRules: true
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
will apply level 1 optimizations, except url normalization, and default level 2 optimizations with rule restructuring.
|
||||
|
||||
## What level 2 optimizations do?
|
||||
|
||||
All level 2 optimizations are dispatched [here](https://github.com/jakubpawlowicz/clean-css/blob/master/lib/optimizer/level-2/optimize.js#L67), and this is what they do:
|
||||
|
||||
* `recursivelyOptimizeBlocks` - does all the following operations on a nested block, like `@media` or `@keyframe`;
|
||||
* `recursivelyOptimizeProperties` - optimizes properties in rulesets and flat at-rules, like @font-face, by splitting them into components (e.g. `margin` into `margin-(bottom|left|right|top)`), optimizing, and restoring them back. You may want to use `mergeIntoShorthands` option to control whether you want to turn multiple components into shorthands;
|
||||
* `removeDuplicates` - gets rid of duplicate rulesets with exactly the same set of properties, e.g. when including a Sass / Less partial twice for no good reason;
|
||||
* `mergeAdjacent` - merges adjacent rulesets with the same selector or rules;
|
||||
* `reduceNonAdjacent` - identifies which properties are overridden in same-selector non-adjacent rulesets, and removes them;
|
||||
* `mergeNonAdjacentBySelector` - identifies same-selector non-adjacent rulesets which can be moved (!) to be merged, requires all intermediate rulesets to not redefine the moved properties, or if redefined to have the same value;
|
||||
* `mergeNonAdjacentByBody` - same as the one above but for same-selector non-adjacent rulesets;
|
||||
* `restructure` - tries to reorganize different-selector different-rules rulesets so they take less space, e.g. `.one{padding:0}.two{margin:0}.one{margin-bottom:3px}` into `.two{margin:0}.one{padding:0;margin-bottom:3px}`;
|
||||
* `removeDuplicateFontAtRules` - removes duplicated `@font-face` rules;
|
||||
* `removeDuplicateMediaQueries` - removes duplicated `@media` nested blocks;
|
||||
* `mergeMediaQueries` - merges non-adjacent `@media` at-rules by the same rules as `mergeNonAdjacentBy*` above;
|
||||
|
||||
## How to use clean-css with build tools?
|
||||
|
||||
There is a number of 3rd party plugins to popular build tools:
|
||||
|
||||
* [Broccoli](https://github.com/broccolijs/broccoli#broccoli): [broccoli-clean-css](https://github.com/shinnn/broccoli-clean-css)
|
||||
* [Brunch](http://brunch.io/): [clean-css-brunch](https://github.com/brunch/clean-css-brunch)
|
||||
* [Grunt](http://gruntjs.com): [grunt-contrib-cssmin](https://github.com/gruntjs/grunt-contrib-cssmin)
|
||||
* [Gulp](http://gulpjs.com/): [gulp-clean-css](https://github.com/scniro/gulp-clean-css)
|
||||
* [Gulp](http://gulpjs.com/): [using vinyl-map as a wrapper - courtesy of @sogko](https://github.com/jakubpawlowicz/clean-css/issues/342)
|
||||
* [component-builder2](https://github.com/component/builder2.js): [builder-clean-css](https://github.com/poying/builder-clean-css)
|
||||
* [Metalsmith](http://metalsmith.io): [metalsmith-clean-css](https://github.com/aymericbeaumet/metalsmith-clean-css)
|
||||
* [Lasso](https://github.com/lasso-js/lasso): [lasso-clean-css](https://github.com/yomed/lasso-clean-css)
|
||||
* [Start](https://github.com/start-runner/start): [start-clean-css](https://github.com/start-runner/clean-css)
|
||||
|
||||
## How to use clean-css from web browser?
|
||||
|
||||
* https://jakubpawlowicz.github.io/clean-css/ (official web interface)
|
||||
* http://refresh-sf.com/
|
||||
* http://adamburgess.github.io/clean-css-online/
|
||||
|
||||
# Contributing
|
||||
|
||||
See [CONTRIBUTING.md](https://github.com/jakubpawlowicz/clean-css/blob/master/CONTRIBUTING.md).
|
||||
|
||||
## How to get started?
|
||||
|
||||
First clone the sources:
|
||||
|
||||
```bash
|
||||
git clone git@github.com:jakubpawlowicz/clean-css.git
|
||||
```
|
||||
|
||||
then install dependencies:
|
||||
|
||||
```bash
|
||||
cd clean-css
|
||||
npm install
|
||||
```
|
||||
|
||||
then use any of the following commands to verify your copy:
|
||||
|
||||
```bash
|
||||
npm run bench # for clean-css benchmarks (see [test/bench.js](https://github.com/jakubpawlowicz/clean-css/blob/master/test/bench.js) for details)
|
||||
npm run browserify # to create the browser-ready clean-css version
|
||||
npm run check # to lint JS sources with [JSHint](https://github.com/jshint/jshint/)
|
||||
npm test # to run all tests
|
||||
```
|
||||
|
||||
# Acknowledgments
|
||||
|
||||
Sorted alphabetically by GitHub handle:
|
||||
|
||||
* [@abarre](https://github.com/abarre) (Anthony Barre) for improvements to `@import` processing;
|
||||
* [@alexlamsl](https://github.com/alexlamsl) (Alex Lam S.L.) for testing early clean-css 4 versions, reporting bugs, and suggesting numerous improvements.
|
||||
* [@altschuler](https://github.com/altschuler) (Simon Altschuler) for fixing `@import` processing inside comments;
|
||||
* [@ben-eb](https://github.com/ben-eb) (Ben Briggs) for sharing ideas about CSS optimizations;
|
||||
* [@facelessuser](https://github.com/facelessuser) (Isaac) for pointing out a flaw in clean-css' stateless mode;
|
||||
* [@grandrath](https://github.com/grandrath) (Martin Grandrath) for improving `minify` method source traversal in ES6;
|
||||
* [@jmalonzo](https://github.com/jmalonzo) (Jan Michael Alonzo) for a patch removing node.js' old `sys` package;
|
||||
* [@lukeapage](https://github.com/lukeapage) (Luke Page) for suggestions and testing the source maps feature;
|
||||
Plus everyone else involved in [#125](https://github.com/jakubpawlowicz/clean-css/issues/125) for pushing it forward;
|
||||
* [@madwizard-thomas](https://github.com/madwizard-thomas) for sharing ideas about `@import` inlining and URL rebasing.
|
||||
* [@ngyikp](https://github.com/ngyikp) (Ng Yik Phang) for testing early clean-css 4 versions, reporting bugs, and suggesting numerous improvements.
|
||||
* [@wagenet](https://github.com/wagenet) (Peter Wagenet) for suggesting improvements to `@import` inlining behavior;
|
||||
* [@venemo](https://github.com/venemo) (Timur Kristóf) for an outstanding contribution of advanced property optimizer for 2.2 release;
|
||||
* [@vvo](https://github.com/vvo) (Vincent Voyer) for a patch with better empty element regex and for inspiring us to do many performance improvements in 0.4 release;
|
||||
* [@xhmikosr](https://github.com/xhmikosr) for suggesting new features, like option to remove special comments and strip out URLs quotation, and pointing out numerous improvements like JSHint, media queries, etc.
|
||||
|
||||
# License
|
||||
|
||||
clean-css is released under the [MIT License](https://github.com/jakubpawlowicz/clean-css/blob/master/LICENSE).
|
||||
1
node_modules/clean-css/index.js
generated
vendored
Normal file
1
node_modules/clean-css/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./lib/clean');
|
||||
156
node_modules/clean-css/lib/clean.js
generated
vendored
Normal file
156
node_modules/clean-css/lib/clean.js
generated
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
/**
|
||||
* Clean-css - https://github.com/jakubpawlowicz/clean-css
|
||||
* Released under the terms of MIT license
|
||||
*
|
||||
* Copyright (C) 2017 JakubPawlowicz.com
|
||||
*/
|
||||
|
||||
var level0Optimize = require('./optimizer/level-0/optimize');
|
||||
var level1Optimize = require('./optimizer/level-1/optimize');
|
||||
var level2Optimize = require('./optimizer/level-2/optimize');
|
||||
var validator = require('./optimizer/validator');
|
||||
|
||||
var compatibilityFrom = require('./options/compatibility');
|
||||
var fetchFrom = require('./options/fetch');
|
||||
var formatFrom = require('./options/format').formatFrom;
|
||||
var inlineFrom = require('./options/inline');
|
||||
var inlineRequestFrom = require('./options/inline-request');
|
||||
var inlineTimeoutFrom = require('./options/inline-timeout');
|
||||
var OptimizationLevel = require('./options/optimization-level').OptimizationLevel;
|
||||
var optimizationLevelFrom = require('./options/optimization-level').optimizationLevelFrom;
|
||||
var rebaseFrom = require('./options/rebase');
|
||||
var rebaseToFrom = require('./options/rebase-to');
|
||||
|
||||
var inputSourceMapTracker = require('./reader/input-source-map-tracker');
|
||||
var readSources = require('./reader/read-sources');
|
||||
|
||||
var serializeStyles = require('./writer/simple');
|
||||
var serializeStylesAndSourceMap = require('./writer/source-maps');
|
||||
|
||||
var CleanCSS = module.exports = function CleanCSS(options) {
|
||||
options = options || {};
|
||||
|
||||
this.options = {
|
||||
compatibility: compatibilityFrom(options.compatibility),
|
||||
fetch: fetchFrom(options.fetch),
|
||||
format: formatFrom(options.format),
|
||||
inline: inlineFrom(options.inline),
|
||||
inlineRequest: inlineRequestFrom(options.inlineRequest),
|
||||
inlineTimeout: inlineTimeoutFrom(options.inlineTimeout),
|
||||
level: optimizationLevelFrom(options.level),
|
||||
rebase: rebaseFrom(options.rebase),
|
||||
rebaseTo: rebaseToFrom(options.rebaseTo),
|
||||
returnPromise: !!options.returnPromise,
|
||||
sourceMap: !!options.sourceMap,
|
||||
sourceMapInlineSources: !!options.sourceMapInlineSources
|
||||
};
|
||||
};
|
||||
|
||||
CleanCSS.prototype.minify = function (input, maybeSourceMap, maybeCallback) {
|
||||
var options = this.options;
|
||||
|
||||
if (options.returnPromise) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
minify(input, options, maybeSourceMap, function (errors, output) {
|
||||
return errors ?
|
||||
reject(errors) :
|
||||
resolve(output);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
return minify(input, options, maybeSourceMap, maybeCallback);
|
||||
}
|
||||
};
|
||||
|
||||
function minify(input, options, maybeSourceMap, maybeCallback) {
|
||||
var sourceMap = typeof maybeSourceMap != 'function' ?
|
||||
maybeSourceMap :
|
||||
null;
|
||||
var callback = typeof maybeCallback == 'function' ?
|
||||
maybeCallback :
|
||||
(typeof maybeSourceMap == 'function' ? maybeSourceMap : null);
|
||||
var context = {
|
||||
stats: {
|
||||
efficiency: 0,
|
||||
minifiedSize: 0,
|
||||
originalSize: 0,
|
||||
startedAt: Date.now(),
|
||||
timeSpent: 0
|
||||
},
|
||||
cache: {
|
||||
specificity: {}
|
||||
},
|
||||
errors: [],
|
||||
inlinedStylesheets: [],
|
||||
inputSourceMapTracker: inputSourceMapTracker(),
|
||||
localOnly: !callback,
|
||||
options: options,
|
||||
source: null,
|
||||
sourcesContent: {},
|
||||
validator: validator(options.compatibility),
|
||||
warnings: []
|
||||
};
|
||||
|
||||
if (sourceMap) {
|
||||
context.inputSourceMapTracker.track(undefined, sourceMap);
|
||||
}
|
||||
|
||||
return runner(context.localOnly)(function () {
|
||||
return readSources(input, context, function (tokens) {
|
||||
var serialize = context.options.sourceMap ?
|
||||
serializeStylesAndSourceMap :
|
||||
serializeStyles;
|
||||
|
||||
var optimizedTokens = optimize(tokens, context);
|
||||
var optimizedStyles = serialize(optimizedTokens, context);
|
||||
var output = withMetadata(optimizedStyles, context);
|
||||
|
||||
return callback ?
|
||||
callback(context.errors.length > 0 ? context.errors : null, output) :
|
||||
output;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function runner(localOnly) {
|
||||
// to always execute code asynchronously when a callback is given
|
||||
// more at blog.izs.me/post/59142742143/designing-apis-for-asynchrony
|
||||
return localOnly ?
|
||||
function (callback) { return callback(); } :
|
||||
process.nextTick;
|
||||
}
|
||||
|
||||
function optimize(tokens, context) {
|
||||
var optimized;
|
||||
|
||||
optimized = level0Optimize(tokens, context);
|
||||
optimized = OptimizationLevel.One in context.options.level ?
|
||||
level1Optimize(tokens, context) :
|
||||
tokens;
|
||||
optimized = OptimizationLevel.Two in context.options.level ?
|
||||
level2Optimize(tokens, context, true) :
|
||||
optimized;
|
||||
|
||||
return optimized;
|
||||
}
|
||||
|
||||
function withMetadata(output, context) {
|
||||
output.stats = calculateStatsFrom(output.styles, context);
|
||||
output.errors = context.errors;
|
||||
output.inlinedStylesheets = context.inlinedStylesheets;
|
||||
output.warnings = context.warnings;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
function calculateStatsFrom(styles, context) {
|
||||
var finishedAt = Date.now();
|
||||
var timeSpent = finishedAt - context.stats.startedAt;
|
||||
|
||||
delete context.stats.startedAt;
|
||||
context.stats.timeSpent = timeSpent;
|
||||
context.stats.efficiency = 1 - styles.length / context.stats.originalSize;
|
||||
context.stats.minifiedSize = styles.length;
|
||||
|
||||
return context.stats;
|
||||
}
|
||||
8
node_modules/clean-css/lib/optimizer/hack.js
generated
vendored
Normal file
8
node_modules/clean-css/lib/optimizer/hack.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
var Hack = {
|
||||
ASTERISK: 'asterisk',
|
||||
BANG: 'bang',
|
||||
BACKSLASH: 'backslash',
|
||||
UNDERSCORE: 'underscore'
|
||||
};
|
||||
|
||||
module.exports = Hack;
|
||||
6
node_modules/clean-css/lib/optimizer/level-0/optimize.js
generated
vendored
Normal file
6
node_modules/clean-css/lib/optimizer/level-0/optimize.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
function level0Optimize(tokens) {
|
||||
// noop as level 0 means no optimizations!
|
||||
return tokens;
|
||||
}
|
||||
|
||||
module.exports = level0Optimize;
|
||||
673
node_modules/clean-css/lib/optimizer/level-1/optimize.js
generated
vendored
Normal file
673
node_modules/clean-css/lib/optimizer/level-1/optimize.js
generated
vendored
Normal file
@@ -0,0 +1,673 @@
|
||||
var shortenHex = require('./shorten-hex');
|
||||
var shortenHsl = require('./shorten-hsl');
|
||||
var shortenRgb = require('./shorten-rgb');
|
||||
var sortSelectors = require('./sort-selectors');
|
||||
var tidyRules = require('./tidy-rules');
|
||||
var tidyBlock = require('./tidy-block');
|
||||
var tidyAtRule = require('./tidy-at-rule');
|
||||
|
||||
var Hack = require('../hack');
|
||||
var removeUnused = require('../remove-unused');
|
||||
var restoreFromOptimizing = require('../restore-from-optimizing');
|
||||
var wrapForOptimizing = require('../wrap-for-optimizing').all;
|
||||
|
||||
var OptimizationLevel = require('../../options/optimization-level').OptimizationLevel;
|
||||
|
||||
var Token = require('../../tokenizer/token');
|
||||
var Marker = require('../../tokenizer/marker');
|
||||
|
||||
var formatPosition = require('../../utils/format-position');
|
||||
var split = require('../../utils/split');
|
||||
|
||||
var IgnoreProperty = 'ignore-property';
|
||||
|
||||
var CHARSET_TOKEN = '@charset';
|
||||
var CHARSET_REGEXP = new RegExp('^' + CHARSET_TOKEN, 'i');
|
||||
|
||||
var DEFAULT_ROUNDING_PRECISION = require('../../options/rounding-precision').DEFAULT;
|
||||
|
||||
var WHOLE_PIXEL_VALUE = /(?:^|\s|\()(-?\d+)px/;
|
||||
var TIME_VALUE = /^(\-?[\d\.]+)(m?s)$/;
|
||||
|
||||
var HEX_VALUE_PATTERN = /[0-9a-f]/i;
|
||||
var PROPERTY_NAME_PATTERN = /^(?:\-chrome\-|\-[\w\-]+\w|\w[\w\-]+\w|\-\-\S+)$/;
|
||||
var IMPORT_PREFIX_PATTERN = /^@import/i;
|
||||
var QUOTED_PATTERN = /^('.*'|".*")$/;
|
||||
var QUOTED_BUT_SAFE_PATTERN = /^['"][a-zA-Z][a-zA-Z\d\-_]+['"]$/;
|
||||
var URL_PREFIX_PATTERN = /^url\(/i;
|
||||
var VARIABLE_NAME_PATTERN = /^--\S+$/;
|
||||
|
||||
function isNegative(value) {
|
||||
return value && value[1][0] == '-' && parseFloat(value[1]) < 0;
|
||||
}
|
||||
|
||||
function isQuoted(value) {
|
||||
return QUOTED_PATTERN.test(value);
|
||||
}
|
||||
|
||||
function isUrl(value) {
|
||||
return URL_PREFIX_PATTERN.test(value);
|
||||
}
|
||||
|
||||
function normalizeUrl(value) {
|
||||
return value
|
||||
.replace(URL_PREFIX_PATTERN, 'url(')
|
||||
.replace(/\\?\n|\\?\r\n/g, '');
|
||||
}
|
||||
|
||||
function optimizeBackground(property) {
|
||||
var values = property.value;
|
||||
|
||||
if (values.length == 1 && values[0][1] == 'none') {
|
||||
values[0][1] = '0 0';
|
||||
}
|
||||
|
||||
if (values.length == 1 && values[0][1] == 'transparent') {
|
||||
values[0][1] = '0 0';
|
||||
}
|
||||
}
|
||||
|
||||
function optimizeBorderRadius(property) {
|
||||
var values = property.value;
|
||||
var spliceAt;
|
||||
|
||||
if (values.length == 3 && values[1][1] == '/' && values[0][1] == values[2][1]) {
|
||||
spliceAt = 1;
|
||||
} else if (values.length == 5 && values[2][1] == '/' && values[0][1] == values[3][1] && values[1][1] == values[4][1]) {
|
||||
spliceAt = 2;
|
||||
} else if (values.length == 7 && values[3][1] == '/' && values[0][1] == values[4][1] && values[1][1] == values[5][1] && values[2][1] == values[6][1]) {
|
||||
spliceAt = 3;
|
||||
} else if (values.length == 9 && values[4][1] == '/' && values[0][1] == values[5][1] && values[1][1] == values[6][1] && values[2][1] == values[7][1] && values[3][1] == values[8][1]) {
|
||||
spliceAt = 4;
|
||||
}
|
||||
|
||||
if (spliceAt) {
|
||||
property.value.splice(spliceAt);
|
||||
property.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
function optimizeColors(name, value, compatibility) {
|
||||
if (value.indexOf('#') === -1 && value.indexOf('rgb') == -1 && value.indexOf('hsl') == -1) {
|
||||
return shortenHex(value);
|
||||
}
|
||||
|
||||
value = value
|
||||
.replace(/rgb\((\-?\d+),(\-?\d+),(\-?\d+)\)/g, function (match, red, green, blue) {
|
||||
return shortenRgb(red, green, blue);
|
||||
})
|
||||
.replace(/hsl\((-?\d+),(-?\d+)%?,(-?\d+)%?\)/g, function (match, hue, saturation, lightness) {
|
||||
return shortenHsl(hue, saturation, lightness);
|
||||
})
|
||||
.replace(/(^|[^='"])#([0-9a-f]{6})/gi, function (match, prefix, color, at, inputValue) {
|
||||
var suffix = inputValue[at + match.length];
|
||||
|
||||
if (suffix && HEX_VALUE_PATTERN.test(suffix)) {
|
||||
return match;
|
||||
} else if (color[0] == color[1] && color[2] == color[3] && color[4] == color[5]) {
|
||||
return (prefix + '#' + color[0] + color[2] + color[4]).toLowerCase();
|
||||
} else {
|
||||
return (prefix + '#' + color).toLowerCase();
|
||||
}
|
||||
})
|
||||
.replace(/(^|[^='"])#([0-9a-f]{3})/gi, function (match, prefix, color) {
|
||||
return prefix + '#' + color.toLowerCase();
|
||||
})
|
||||
.replace(/(rgb|rgba|hsl|hsla)\(([^\)]+)\)/g, function (match, colorFunction, colorDef) {
|
||||
var tokens = colorDef.split(',');
|
||||
var applies = (colorFunction == 'hsl' && tokens.length == 3) ||
|
||||
(colorFunction == 'hsla' && tokens.length == 4) ||
|
||||
(colorFunction == 'rgb' && tokens.length == 3 && colorDef.indexOf('%') > 0) ||
|
||||
(colorFunction == 'rgba' && tokens.length == 4 && colorDef.indexOf('%') > 0);
|
||||
|
||||
if (!applies) {
|
||||
return match;
|
||||
}
|
||||
|
||||
if (tokens[1].indexOf('%') == -1) {
|
||||
tokens[1] += '%';
|
||||
}
|
||||
|
||||
if (tokens[2].indexOf('%') == -1) {
|
||||
tokens[2] += '%';
|
||||
}
|
||||
|
||||
return colorFunction + '(' + tokens.join(',') + ')';
|
||||
});
|
||||
|
||||
if (compatibility.colors.opacity && name.indexOf('background') == -1) {
|
||||
value = value.replace(/(?:rgba|hsla)\(0,0%?,0%?,0\)/g, function (match) {
|
||||
if (split(value, ',').pop().indexOf('gradient(') > -1) {
|
||||
return match;
|
||||
}
|
||||
|
||||
return 'transparent';
|
||||
});
|
||||
}
|
||||
|
||||
return shortenHex(value);
|
||||
}
|
||||
|
||||
function optimizeFilter(property) {
|
||||
if (property.value.length == 1) {
|
||||
property.value[0][1] = property.value[0][1].replace(/progid:DXImageTransform\.Microsoft\.(Alpha|Chroma)(\W)/, function (match, filter, suffix) {
|
||||
return filter.toLowerCase() + suffix;
|
||||
});
|
||||
}
|
||||
|
||||
property.value[0][1] = property.value[0][1]
|
||||
.replace(/,(\S)/g, ', $1')
|
||||
.replace(/ ?= ?/g, '=');
|
||||
}
|
||||
|
||||
function optimizeFontWeight(property, atIndex) {
|
||||
var value = property.value[atIndex][1];
|
||||
|
||||
if (value == 'normal') {
|
||||
value = '400';
|
||||
} else if (value == 'bold') {
|
||||
value = '700';
|
||||
}
|
||||
|
||||
property.value[atIndex][1] = value;
|
||||
}
|
||||
|
||||
function optimizeMultipleZeros(property) {
|
||||
var values = property.value;
|
||||
var spliceAt;
|
||||
|
||||
if (values.length == 4 && values[0][1] === '0' && values[1][1] === '0' && values[2][1] === '0' && values[3][1] === '0') {
|
||||
if (property.name.indexOf('box-shadow') > -1) {
|
||||
spliceAt = 2;
|
||||
} else {
|
||||
spliceAt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (spliceAt) {
|
||||
property.value.splice(spliceAt);
|
||||
property.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
function optimizeOutline(property) {
|
||||
var values = property.value;
|
||||
|
||||
if (values.length == 1 && values[0][1] == 'none') {
|
||||
values[0][1] = '0';
|
||||
}
|
||||
}
|
||||
|
||||
function optimizePixelLengths(_, value, compatibility) {
|
||||
if (!WHOLE_PIXEL_VALUE.test(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.replace(WHOLE_PIXEL_VALUE, function (match, val) {
|
||||
var newValue;
|
||||
var intVal = parseInt(val);
|
||||
|
||||
if (intVal === 0) {
|
||||
return match;
|
||||
}
|
||||
|
||||
if (compatibility.properties.shorterLengthUnits && compatibility.units.pt && intVal * 3 % 4 === 0) {
|
||||
newValue = intVal * 3 / 4 + 'pt';
|
||||
}
|
||||
|
||||
if (compatibility.properties.shorterLengthUnits && compatibility.units.pc && intVal % 16 === 0) {
|
||||
newValue = intVal / 16 + 'pc';
|
||||
}
|
||||
|
||||
if (compatibility.properties.shorterLengthUnits && compatibility.units.in && intVal % 96 === 0) {
|
||||
newValue = intVal / 96 + 'in';
|
||||
}
|
||||
|
||||
if (newValue) {
|
||||
newValue = match.substring(0, match.indexOf(val)) + newValue;
|
||||
}
|
||||
|
||||
return newValue && newValue.length < match.length ? newValue : match;
|
||||
});
|
||||
}
|
||||
|
||||
function optimizePrecision(_, value, precisionOptions) {
|
||||
if (!precisionOptions.enabled || value.indexOf('.') === -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(precisionOptions.decimalPointMatcher, '$1$2$3')
|
||||
.replace(precisionOptions.zeroMatcher, function (match, integerPart, fractionPart, unit) {
|
||||
var multiplier = precisionOptions.units[unit].multiplier;
|
||||
var parsedInteger = parseInt(integerPart);
|
||||
var integer = isNaN(parsedInteger) ? 0 : parsedInteger;
|
||||
var fraction = parseFloat(fractionPart);
|
||||
|
||||
return Math.round((integer + fraction) * multiplier) / multiplier + unit;
|
||||
});
|
||||
}
|
||||
|
||||
function optimizeTimeUnits(_, value) {
|
||||
if (!TIME_VALUE.test(value))
|
||||
return value;
|
||||
|
||||
return value.replace(TIME_VALUE, function (match, val, unit) {
|
||||
var newValue;
|
||||
|
||||
if (unit == 'ms') {
|
||||
newValue = parseInt(val) / 1000 + 's';
|
||||
} else if (unit == 's') {
|
||||
newValue = parseFloat(val) * 1000 + 'ms';
|
||||
}
|
||||
|
||||
return newValue.length < match.length ? newValue : match;
|
||||
});
|
||||
}
|
||||
|
||||
function optimizeUnits(name, value, unitsRegexp) {
|
||||
if (/^(?:\-moz\-calc|\-webkit\-calc|calc|rgb|hsl|rgba|hsla)\(/.test(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (name == 'flex' || name == '-ms-flex' || name == '-webkit-flex' || name == 'flex-basis' || name == '-webkit-flex-basis') {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.indexOf('%') > 0 && (name == 'height' || name == 'max-height' || name == 'width' || name == 'max-width')) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(unitsRegexp, '$1' + '0' + '$2')
|
||||
.replace(unitsRegexp, '$1' + '0' + '$2');
|
||||
}
|
||||
|
||||
function optimizeWhitespace(name, value) {
|
||||
if (name.indexOf('filter') > -1 || value.indexOf(' ') == -1 || value.indexOf('expression') === 0) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.indexOf(Marker.SINGLE_QUOTE) > -1 || value.indexOf(Marker.DOUBLE_QUOTE) > -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
value = value.replace(/\s+/g, ' ');
|
||||
|
||||
if (value.indexOf('calc') > -1) {
|
||||
value = value.replace(/\) ?\/ ?/g, ')/ ');
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(/(\(;?)\s+/g, '$1')
|
||||
.replace(/\s+(;?\))/g, '$1')
|
||||
.replace(/, /g, ',');
|
||||
}
|
||||
|
||||
function optimizeZeroDegUnit(_, value) {
|
||||
if (value.indexOf('0deg') == -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.replace(/\(0deg\)/g, '(0)');
|
||||
}
|
||||
|
||||
function optimizeZeroUnits(name, value) {
|
||||
if (value.indexOf('0') == -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.indexOf('-') > -1) {
|
||||
value = value
|
||||
.replace(/([^\w\d\-]|^)\-0([^\.]|$)/g, '$10$2')
|
||||
.replace(/([^\w\d\-]|^)\-0([^\.]|$)/g, '$10$2');
|
||||
}
|
||||
|
||||
return value
|
||||
.replace(/(^|\s)0+([1-9])/g, '$1$2')
|
||||
.replace(/(^|\D)\.0+(\D|$)/g, '$10$2')
|
||||
.replace(/(^|\D)\.0+(\D|$)/g, '$10$2')
|
||||
.replace(/\.([1-9]*)0+(\D|$)/g, function (match, nonZeroPart, suffix) {
|
||||
return (nonZeroPart.length > 0 ? '.' : '') + nonZeroPart + suffix;
|
||||
})
|
||||
.replace(/(^|\D)0\.(\d)/g, '$1.$2');
|
||||
}
|
||||
|
||||
function removeQuotes(name, value) {
|
||||
if (name == 'content' || name.indexOf('font-feature-settings') > -1 || name.indexOf('grid-') > -1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return QUOTED_BUT_SAFE_PATTERN.test(value) ?
|
||||
value.substring(1, value.length - 1) :
|
||||
value;
|
||||
}
|
||||
|
||||
function removeUrlQuotes(value) {
|
||||
return /^url\(['"].+['"]\)$/.test(value) && !/^url\(['"].*[\*\s\(\)'"].*['"]\)$/.test(value) && !/^url\(['"]data:[^;]+;charset/.test(value) ?
|
||||
value.replace(/["']/g, '') :
|
||||
value;
|
||||
}
|
||||
|
||||
function transformValue(propertyName, propertyValue, transformCallback) {
|
||||
var transformedValue = transformCallback(propertyName, propertyValue);
|
||||
|
||||
if (transformedValue === undefined) {
|
||||
return propertyValue;
|
||||
} else if (transformedValue === false) {
|
||||
return IgnoreProperty;
|
||||
} else {
|
||||
return transformedValue;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
function optimizeBody(properties, context) {
|
||||
var options = context.options;
|
||||
var levelOptions = options.level[OptimizationLevel.One];
|
||||
var property, name, type, value;
|
||||
var valueIsUrl;
|
||||
var propertyToken;
|
||||
var _properties = wrapForOptimizing(properties, true);
|
||||
|
||||
propertyLoop:
|
||||
for (var i = 0, l = _properties.length; i < l; i++) {
|
||||
property = _properties[i];
|
||||
name = property.name;
|
||||
|
||||
if (!PROPERTY_NAME_PATTERN.test(name)) {
|
||||
propertyToken = property.all[property.position];
|
||||
context.warnings.push('Invalid property name \'' + name + '\' at ' + formatPosition(propertyToken[1][2][0]) + '. Ignoring.');
|
||||
property.unused = true;
|
||||
}
|
||||
|
||||
if (property.value.length === 0) {
|
||||
propertyToken = property.all[property.position];
|
||||
context.warnings.push('Empty property \'' + name + '\' at ' + formatPosition(propertyToken[1][2][0]) + '. Ignoring.');
|
||||
property.unused = true;
|
||||
}
|
||||
|
||||
if (property.hack && (
|
||||
(property.hack[0] == Hack.ASTERISK || property.hack[0] == Hack.UNDERSCORE) && !options.compatibility.properties.iePrefixHack ||
|
||||
property.hack[0] == Hack.BACKSLASH && !options.compatibility.properties.ieSuffixHack ||
|
||||
property.hack[0] == Hack.BANG && !options.compatibility.properties.ieBangHack)) {
|
||||
property.unused = true;
|
||||
}
|
||||
|
||||
if (levelOptions.removeNegativePaddings && name.indexOf('padding') === 0 && (isNegative(property.value[0]) || isNegative(property.value[1]) || isNegative(property.value[2]) || isNegative(property.value[3]))) {
|
||||
property.unused = true;
|
||||
}
|
||||
|
||||
if (!options.compatibility.properties.ieFilters && isLegacyFilter(property)) {
|
||||
property.unused = true;
|
||||
}
|
||||
|
||||
if (property.unused) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (property.block) {
|
||||
optimizeBody(property.value[0][1], context);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (VARIABLE_NAME_PATTERN.test(name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (var j = 0, m = property.value.length; j < m; j++) {
|
||||
type = property.value[j][0];
|
||||
value = property.value[j][1];
|
||||
valueIsUrl = isUrl(value);
|
||||
|
||||
if (type == Token.PROPERTY_BLOCK) {
|
||||
property.unused = true;
|
||||
context.warnings.push('Invalid value token at ' + formatPosition(value[0][1][2][0]) + '. Ignoring.');
|
||||
break;
|
||||
}
|
||||
|
||||
if (valueIsUrl && !context.validator.isUrl(value)) {
|
||||
property.unused = true;
|
||||
context.warnings.push('Broken URL \'' + value + '\' at ' + formatPosition(property.value[j][2][0]) + '. Ignoring.');
|
||||
break;
|
||||
}
|
||||
|
||||
if (valueIsUrl) {
|
||||
value = levelOptions.normalizeUrls ?
|
||||
normalizeUrl(value) :
|
||||
value;
|
||||
value = !options.compatibility.properties.urlQuotes ?
|
||||
removeUrlQuotes(value) :
|
||||
value;
|
||||
} else if (isQuoted(value)) {
|
||||
value = levelOptions.removeQuotes ?
|
||||
removeQuotes(name, value) :
|
||||
value;
|
||||
} else {
|
||||
value = levelOptions.removeWhitespace ?
|
||||
optimizeWhitespace(name, value) :
|
||||
value;
|
||||
value = optimizePrecision(name, value, options.precision);
|
||||
value = optimizePixelLengths(name, value, options.compatibility);
|
||||
value = levelOptions.replaceTimeUnits ?
|
||||
optimizeTimeUnits(name, value) :
|
||||
value;
|
||||
value = levelOptions.replaceZeroUnits ?
|
||||
optimizeZeroUnits(name, value) :
|
||||
value;
|
||||
|
||||
if (options.compatibility.properties.zeroUnits) {
|
||||
value = optimizeZeroDegUnit(name, value);
|
||||
value = optimizeUnits(name, value, options.unitsRegexp);
|
||||
}
|
||||
|
||||
if (options.compatibility.properties.colors) {
|
||||
value = optimizeColors(name, value, options.compatibility);
|
||||
}
|
||||
}
|
||||
|
||||
value = transformValue(name, value, levelOptions.transform);
|
||||
|
||||
if (value === IgnoreProperty) {
|
||||
property.unused = true;
|
||||
continue propertyLoop;
|
||||
}
|
||||
|
||||
property.value[j][1] = value;
|
||||
}
|
||||
|
||||
if (levelOptions.replaceMultipleZeros) {
|
||||
optimizeMultipleZeros(property);
|
||||
}
|
||||
|
||||
if (name == 'background' && levelOptions.optimizeBackground) {
|
||||
optimizeBackground(property);
|
||||
} else if (name.indexOf('border') === 0 && name.indexOf('radius') > 0 && levelOptions.optimizeBorderRadius) {
|
||||
optimizeBorderRadius(property);
|
||||
} else if (name == 'filter'&& levelOptions.optimizeFilter && options.compatibility.properties.ieFilters) {
|
||||
optimizeFilter(property);
|
||||
} else if (name == 'font-weight' && levelOptions.optimizeFontWeight) {
|
||||
optimizeFontWeight(property, 0);
|
||||
} else if (name == 'outline' && levelOptions.optimizeOutline) {
|
||||
optimizeOutline(property);
|
||||
}
|
||||
}
|
||||
|
||||
restoreFromOptimizing(_properties);
|
||||
removeUnused(_properties);
|
||||
removeComments(properties, options);
|
||||
}
|
||||
|
||||
function removeComments(tokens, options) {
|
||||
var token;
|
||||
var i;
|
||||
|
||||
for (i = 0; i < tokens.length; i++) {
|
||||
token = tokens[i];
|
||||
|
||||
if (token[0] != Token.COMMENT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
optimizeComment(token, options);
|
||||
|
||||
if (token[1].length === 0) {
|
||||
tokens.splice(i, 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function optimizeComment(token, options) {
|
||||
if (token[1][2] == Marker.EXCLAMATION && (options.level[OptimizationLevel.One].specialComments == 'all' || options.commentsKept < options.level[OptimizationLevel.One].specialComments)) {
|
||||
options.commentsKept++;
|
||||
return;
|
||||
}
|
||||
|
||||
token[1] = [];
|
||||
}
|
||||
|
||||
function cleanupCharsets(tokens) {
|
||||
var hasCharset = false;
|
||||
|
||||
for (var i = 0, l = tokens.length; i < l; i++) {
|
||||
var token = tokens[i];
|
||||
|
||||
if (token[0] != Token.AT_RULE)
|
||||
continue;
|
||||
|
||||
if (!CHARSET_REGEXP.test(token[1]))
|
||||
continue;
|
||||
|
||||
if (hasCharset || token[1].indexOf(CHARSET_TOKEN) == -1) {
|
||||
tokens.splice(i, 1);
|
||||
i--;
|
||||
l--;
|
||||
} else {
|
||||
hasCharset = true;
|
||||
tokens.splice(i, 1);
|
||||
tokens.unshift([Token.AT_RULE, token[1].replace(CHARSET_REGEXP, CHARSET_TOKEN)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function buildUnitRegexp(options) {
|
||||
var units = ['px', 'em', 'ex', 'cm', 'mm', 'in', 'pt', 'pc', '%'];
|
||||
var otherUnits = ['ch', 'rem', 'vh', 'vm', 'vmax', 'vmin', 'vw'];
|
||||
|
||||
otherUnits.forEach(function (unit) {
|
||||
if (options.compatibility.units[unit]) {
|
||||
units.push(unit);
|
||||
}
|
||||
});
|
||||
|
||||
return new RegExp('(^|\\s|\\(|,)0(?:' + units.join('|') + ')(\\W|$)', 'g');
|
||||
}
|
||||
|
||||
function buildPrecisionOptions(roundingPrecision) {
|
||||
var precisionOptions = {
|
||||
matcher: null,
|
||||
units: {},
|
||||
};
|
||||
var optimizable = [];
|
||||
var unit;
|
||||
var value;
|
||||
|
||||
for (unit in roundingPrecision) {
|
||||
value = roundingPrecision[unit];
|
||||
|
||||
if (value != DEFAULT_ROUNDING_PRECISION) {
|
||||
precisionOptions.units[unit] = {};
|
||||
precisionOptions.units[unit].value = value;
|
||||
precisionOptions.units[unit].multiplier = Math.pow(10, value);
|
||||
|
||||
optimizable.push(unit);
|
||||
}
|
||||
}
|
||||
|
||||
if (optimizable.length > 0) {
|
||||
precisionOptions.enabled = true;
|
||||
precisionOptions.decimalPointMatcher = new RegExp('(\\d)\\.($|' + optimizable.join('|') + ')($|\W)', 'g');
|
||||
precisionOptions.zeroMatcher = new RegExp('(\\d*)(\\.\\d+)(' + optimizable.join('|') + ')', 'g');
|
||||
}
|
||||
|
||||
return precisionOptions;
|
||||
}
|
||||
|
||||
function isImport(token) {
|
||||
return IMPORT_PREFIX_PATTERN.test(token[1]);
|
||||
}
|
||||
|
||||
function isLegacyFilter(property) {
|
||||
var value;
|
||||
|
||||
if (property.name == 'filter' || property.name == '-ms-filter') {
|
||||
value = property.value[0][1];
|
||||
|
||||
return value.indexOf('progid') > -1 ||
|
||||
value.indexOf('alpha') === 0 ||
|
||||
value.indexOf('chroma') === 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function level1Optimize(tokens, context) {
|
||||
var options = context.options;
|
||||
var levelOptions = options.level[OptimizationLevel.One];
|
||||
var ie7Hack = options.compatibility.selectors.ie7Hack;
|
||||
var adjacentSpace = options.compatibility.selectors.adjacentSpace;
|
||||
var spaceAfterClosingBrace = options.compatibility.properties.spaceAfterClosingBrace;
|
||||
var format = options.format;
|
||||
var mayHaveCharset = false;
|
||||
var afterRules = false;
|
||||
|
||||
options.unitsRegexp = options.unitsRegexp || buildUnitRegexp(options);
|
||||
options.precision = options.precision || buildPrecisionOptions(levelOptions.roundingPrecision);
|
||||
options.commentsKept = options.commentsKept || 0;
|
||||
|
||||
for (var i = 0, l = tokens.length; i < l; i++) {
|
||||
var token = tokens[i];
|
||||
|
||||
switch (token[0]) {
|
||||
case Token.AT_RULE:
|
||||
token[1] = isImport(token) && afterRules ? '' : token[1];
|
||||
token[1] = levelOptions.tidyAtRules ? tidyAtRule(token[1]) : token[1];
|
||||
mayHaveCharset = true;
|
||||
break;
|
||||
case Token.AT_RULE_BLOCK:
|
||||
optimizeBody(token[2], context);
|
||||
afterRules = true;
|
||||
break;
|
||||
case Token.NESTED_BLOCK:
|
||||
token[1] = levelOptions.tidyBlockScopes ? tidyBlock(token[1], spaceAfterClosingBrace) : token[1];
|
||||
level1Optimize(token[2], context);
|
||||
afterRules = true;
|
||||
break;
|
||||
case Token.COMMENT:
|
||||
optimizeComment(token, options);
|
||||
break;
|
||||
case Token.RULE:
|
||||
token[1] = levelOptions.tidySelectors ? tidyRules(token[1], !ie7Hack, adjacentSpace, format, context.warnings) : token[1];
|
||||
token[1] = token[1].length > 1 ? sortSelectors(token[1], levelOptions.selectorsSortingMethod) : token[1];
|
||||
optimizeBody(token[2], context);
|
||||
afterRules = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (token[0] == Token.COMMENT && token[1].length === 0 || levelOptions.removeEmpty && (token[1].length === 0 || (token[2] && token[2].length === 0))) {
|
||||
tokens.splice(i, 1);
|
||||
i--;
|
||||
l--;
|
||||
}
|
||||
}
|
||||
|
||||
if (levelOptions.cleanupCharsets && mayHaveCharset) {
|
||||
cleanupCharsets(tokens);
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
module.exports = level1Optimize;
|
||||
189
node_modules/clean-css/lib/optimizer/level-1/shorten-hex.js
generated
vendored
Normal file
189
node_modules/clean-css/lib/optimizer/level-1/shorten-hex.js
generated
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
var COLORS = {
|
||||
aliceblue: '#f0f8ff',
|
||||
antiquewhite: '#faebd7',
|
||||
aqua: '#0ff',
|
||||
aquamarine: '#7fffd4',
|
||||
azure: '#f0ffff',
|
||||
beige: '#f5f5dc',
|
||||
bisque: '#ffe4c4',
|
||||
black: '#000',
|
||||
blanchedalmond: '#ffebcd',
|
||||
blue: '#00f',
|
||||
blueviolet: '#8a2be2',
|
||||
brown: '#a52a2a',
|
||||
burlywood: '#deb887',
|
||||
cadetblue: '#5f9ea0',
|
||||
chartreuse: '#7fff00',
|
||||
chocolate: '#d2691e',
|
||||
coral: '#ff7f50',
|
||||
cornflowerblue: '#6495ed',
|
||||
cornsilk: '#fff8dc',
|
||||
crimson: '#dc143c',
|
||||
cyan: '#0ff',
|
||||
darkblue: '#00008b',
|
||||
darkcyan: '#008b8b',
|
||||
darkgoldenrod: '#b8860b',
|
||||
darkgray: '#a9a9a9',
|
||||
darkgreen: '#006400',
|
||||
darkgrey: '#a9a9a9',
|
||||
darkkhaki: '#bdb76b',
|
||||
darkmagenta: '#8b008b',
|
||||
darkolivegreen: '#556b2f',
|
||||
darkorange: '#ff8c00',
|
||||
darkorchid: '#9932cc',
|
||||
darkred: '#8b0000',
|
||||
darksalmon: '#e9967a',
|
||||
darkseagreen: '#8fbc8f',
|
||||
darkslateblue: '#483d8b',
|
||||
darkslategray: '#2f4f4f',
|
||||
darkslategrey: '#2f4f4f',
|
||||
darkturquoise: '#00ced1',
|
||||
darkviolet: '#9400d3',
|
||||
deeppink: '#ff1493',
|
||||
deepskyblue: '#00bfff',
|
||||
dimgray: '#696969',
|
||||
dimgrey: '#696969',
|
||||
dodgerblue: '#1e90ff',
|
||||
firebrick: '#b22222',
|
||||
floralwhite: '#fffaf0',
|
||||
forestgreen: '#228b22',
|
||||
fuchsia: '#f0f',
|
||||
gainsboro: '#dcdcdc',
|
||||
ghostwhite: '#f8f8ff',
|
||||
gold: '#ffd700',
|
||||
goldenrod: '#daa520',
|
||||
gray: '#808080',
|
||||
green: '#008000',
|
||||
greenyellow: '#adff2f',
|
||||
grey: '#808080',
|
||||
honeydew: '#f0fff0',
|
||||
hotpink: '#ff69b4',
|
||||
indianred: '#cd5c5c',
|
||||
indigo: '#4b0082',
|
||||
ivory: '#fffff0',
|
||||
khaki: '#f0e68c',
|
||||
lavender: '#e6e6fa',
|
||||
lavenderblush: '#fff0f5',
|
||||
lawngreen: '#7cfc00',
|
||||
lemonchiffon: '#fffacd',
|
||||
lightblue: '#add8e6',
|
||||
lightcoral: '#f08080',
|
||||
lightcyan: '#e0ffff',
|
||||
lightgoldenrodyellow: '#fafad2',
|
||||
lightgray: '#d3d3d3',
|
||||
lightgreen: '#90ee90',
|
||||
lightgrey: '#d3d3d3',
|
||||
lightpink: '#ffb6c1',
|
||||
lightsalmon: '#ffa07a',
|
||||
lightseagreen: '#20b2aa',
|
||||
lightskyblue: '#87cefa',
|
||||
lightslategray: '#778899',
|
||||
lightslategrey: '#778899',
|
||||
lightsteelblue: '#b0c4de',
|
||||
lightyellow: '#ffffe0',
|
||||
lime: '#0f0',
|
||||
limegreen: '#32cd32',
|
||||
linen: '#faf0e6',
|
||||
magenta: '#ff00ff',
|
||||
maroon: '#800000',
|
||||
mediumaquamarine: '#66cdaa',
|
||||
mediumblue: '#0000cd',
|
||||
mediumorchid: '#ba55d3',
|
||||
mediumpurple: '#9370db',
|
||||
mediumseagreen: '#3cb371',
|
||||
mediumslateblue: '#7b68ee',
|
||||
mediumspringgreen: '#00fa9a',
|
||||
mediumturquoise: '#48d1cc',
|
||||
mediumvioletred: '#c71585',
|
||||
midnightblue: '#191970',
|
||||
mintcream: '#f5fffa',
|
||||
mistyrose: '#ffe4e1',
|
||||
moccasin: '#ffe4b5',
|
||||
navajowhite: '#ffdead',
|
||||
navy: '#000080',
|
||||
oldlace: '#fdf5e6',
|
||||
olive: '#808000',
|
||||
olivedrab: '#6b8e23',
|
||||
orange: '#ffa500',
|
||||
orangered: '#ff4500',
|
||||
orchid: '#da70d6',
|
||||
palegoldenrod: '#eee8aa',
|
||||
palegreen: '#98fb98',
|
||||
paleturquoise: '#afeeee',
|
||||
palevioletred: '#db7093',
|
||||
papayawhip: '#ffefd5',
|
||||
peachpuff: '#ffdab9',
|
||||
peru: '#cd853f',
|
||||
pink: '#ffc0cb',
|
||||
plum: '#dda0dd',
|
||||
powderblue: '#b0e0e6',
|
||||
purple: '#800080',
|
||||
rebeccapurple: '#663399',
|
||||
red: '#f00',
|
||||
rosybrown: '#bc8f8f',
|
||||
royalblue: '#4169e1',
|
||||
saddlebrown: '#8b4513',
|
||||
salmon: '#fa8072',
|
||||
sandybrown: '#f4a460',
|
||||
seagreen: '#2e8b57',
|
||||
seashell: '#fff5ee',
|
||||
sienna: '#a0522d',
|
||||
silver: '#c0c0c0',
|
||||
skyblue: '#87ceeb',
|
||||
slateblue: '#6a5acd',
|
||||
slategray: '#708090',
|
||||
slategrey: '#708090',
|
||||
snow: '#fffafa',
|
||||
springgreen: '#00ff7f',
|
||||
steelblue: '#4682b4',
|
||||
tan: '#d2b48c',
|
||||
teal: '#008080',
|
||||
thistle: '#d8bfd8',
|
||||
tomato: '#ff6347',
|
||||
turquoise: '#40e0d0',
|
||||
violet: '#ee82ee',
|
||||
wheat: '#f5deb3',
|
||||
white: '#fff',
|
||||
whitesmoke: '#f5f5f5',
|
||||
yellow: '#ff0',
|
||||
yellowgreen: '#9acd32'
|
||||
};
|
||||
|
||||
var toHex = {};
|
||||
var toName = {};
|
||||
|
||||
for (var name in COLORS) {
|
||||
var hex = COLORS[name];
|
||||
|
||||
if (name.length < hex.length) {
|
||||
toName[hex] = name;
|
||||
} else {
|
||||
toHex[name] = hex;
|
||||
}
|
||||
}
|
||||
|
||||
var toHexPattern = new RegExp('(^| |,|\\))(' + Object.keys(toHex).join('|') + ')( |,|\\)|$)', 'ig');
|
||||
var toNamePattern = new RegExp('(' + Object.keys(toName).join('|') + ')([^a-f0-9]|$)', 'ig');
|
||||
|
||||
function hexConverter(match, prefix, colorValue, suffix) {
|
||||
return prefix + toHex[colorValue.toLowerCase()] + suffix;
|
||||
}
|
||||
|
||||
function nameConverter(match, colorValue, suffix) {
|
||||
return toName[colorValue.toLowerCase()] + suffix;
|
||||
}
|
||||
|
||||
function shortenHex(value) {
|
||||
var hasHex = value.indexOf('#') > -1;
|
||||
var shortened = value.replace(toHexPattern, hexConverter);
|
||||
|
||||
if (shortened != value) {
|
||||
shortened = shortened.replace(toHexPattern, hexConverter);
|
||||
}
|
||||
|
||||
return hasHex ?
|
||||
shortened.replace(toNamePattern, nameConverter) :
|
||||
shortened;
|
||||
}
|
||||
|
||||
module.exports = shortenHex;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user