박민정

[feat] install nodemon

Showing 726 changed files with 5018 additions and 1 deletions
...@@ -19,7 +19,7 @@ mongoose.connect('mongodb+srv://mindyeoi:aaa111@boilerplate.djq4a.mongodb.net/my ...@@ -19,7 +19,7 @@ mongoose.connect('mongodb+srv://mindyeoi:aaa111@boilerplate.djq4a.mongodb.net/my
19 .catch(err => console.log(err)) 19 .catch(err => console.log(err))
20 20
21 app.get('/', (req, res) => { 21 app.get('/', (req, res) => {
22 - res.send('Hello World!') 22 + res.send('민정이짱짱맨최고최고!')
23 }) 23 })
24 24
25 // 회원가입 구현 25 // 회원가입 구현
......
1 +../is-ci/bin.js
...\ No newline at end of file ...\ No newline at end of file
1 +../nodemon/bin/nodemon.js
...\ No newline at end of file ...\ No newline at end of file
1 +../touch/bin/nodetouch.js
...\ No newline at end of file ...\ No newline at end of file
1 +../nopt/bin/nopt.js
...\ No newline at end of file ...\ No newline at end of file
1 +../rc/cli.js
...\ No newline at end of file ...\ No newline at end of file
1 +../semver/bin/semver
...\ No newline at end of file ...\ No newline at end of file
1 +/// <reference types="node" />
2 +/// <reference lib="es2016" />
3 +/// <reference lib="es2017.sharedmemory" />
4 +/// <reference lib="esnext.asynciterable" />
5 +/// <reference lib="dom" />
6 +declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
7 +declare type Primitive = null | undefined | string | number | boolean | Symbol;
8 +export interface ArrayLike {
9 + length: number;
10 +}
11 +export interface Class<T = unknown> {
12 + new (...args: any[]): T;
13 +}
14 +declare type DomElement = object & {
15 + nodeType: 1;
16 + nodeName: string;
17 +};
18 +declare type NodeStream = object & {
19 + pipe: Function;
20 +};
21 +export declare const enum TypeName {
22 + null = "null",
23 + boolean = "boolean",
24 + undefined = "undefined",
25 + string = "string",
26 + number = "number",
27 + symbol = "symbol",
28 + Function = "Function",
29 + GeneratorFunction = "GeneratorFunction",
30 + AsyncFunction = "AsyncFunction",
31 + Observable = "Observable",
32 + Array = "Array",
33 + Buffer = "Buffer",
34 + Object = "Object",
35 + RegExp = "RegExp",
36 + Date = "Date",
37 + Error = "Error",
38 + Map = "Map",
39 + Set = "Set",
40 + WeakMap = "WeakMap",
41 + WeakSet = "WeakSet",
42 + Int8Array = "Int8Array",
43 + Uint8Array = "Uint8Array",
44 + Uint8ClampedArray = "Uint8ClampedArray",
45 + Int16Array = "Int16Array",
46 + Uint16Array = "Uint16Array",
47 + Int32Array = "Int32Array",
48 + Uint32Array = "Uint32Array",
49 + Float32Array = "Float32Array",
50 + Float64Array = "Float64Array",
51 + ArrayBuffer = "ArrayBuffer",
52 + SharedArrayBuffer = "SharedArrayBuffer",
53 + DataView = "DataView",
54 + Promise = "Promise",
55 + URL = "URL"
56 +}
57 +declare function is(value: unknown): TypeName;
58 +declare namespace is {
59 + const undefined: (value: unknown) => value is undefined;
60 + const string: (value: unknown) => value is string;
61 + const number: (value: unknown) => value is number;
62 + const function_: (value: unknown) => value is Function;
63 + const null_: (value: unknown) => value is null;
64 + const class_: (value: unknown) => value is Class<unknown>;
65 + const boolean: (value: unknown) => value is boolean;
66 + const symbol: (value: unknown) => value is Symbol;
67 + const numericString: (value: unknown) => boolean;
68 + const array: (arg: any) => arg is any[];
69 + const buffer: (input: unknown) => input is Buffer;
70 + const nullOrUndefined: (value: unknown) => value is null | undefined;
71 + const object: (value: unknown) => value is object;
72 + const iterable: (value: unknown) => value is IterableIterator<unknown>;
73 + const asyncIterable: (value: unknown) => value is AsyncIterableIterator<unknown>;
74 + const generator: (value: unknown) => value is Generator;
75 + const nativePromise: (value: unknown) => value is Promise<unknown>;
76 + const promise: (value: unknown) => value is Promise<unknown>;
77 + const generatorFunction: (value: unknown) => value is GeneratorFunction;
78 + const asyncFunction: (value: unknown) => value is Function;
79 + const boundFunction: (value: unknown) => value is Function;
80 + const regExp: (value: unknown) => value is RegExp;
81 + const date: (value: unknown) => value is Date;
82 + const error: (value: unknown) => value is Error;
83 + const map: (value: unknown) => value is Map<unknown, unknown>;
84 + const set: (value: unknown) => value is Set<unknown>;
85 + const weakMap: (value: unknown) => value is WeakMap<object, unknown>;
86 + const weakSet: (value: unknown) => value is WeakSet<object>;
87 + const int8Array: (value: unknown) => value is Int8Array;
88 + const uint8Array: (value: unknown) => value is Uint8Array;
89 + const uint8ClampedArray: (value: unknown) => value is Uint8ClampedArray;
90 + const int16Array: (value: unknown) => value is Int16Array;
91 + const uint16Array: (value: unknown) => value is Uint16Array;
92 + const int32Array: (value: unknown) => value is Int32Array;
93 + const uint32Array: (value: unknown) => value is Uint32Array;
94 + const float32Array: (value: unknown) => value is Float32Array;
95 + const float64Array: (value: unknown) => value is Float64Array;
96 + const arrayBuffer: (value: unknown) => value is ArrayBuffer;
97 + const sharedArrayBuffer: (value: unknown) => value is SharedArrayBuffer;
98 + const dataView: (value: unknown) => value is DataView;
99 + const directInstanceOf: <T>(instance: unknown, klass: Class<T>) => instance is T;
100 + const urlInstance: (value: unknown) => value is URL;
101 + const urlString: (value: unknown) => boolean;
102 + const truthy: (value: unknown) => boolean;
103 + const falsy: (value: unknown) => boolean;
104 + const nan: (value: unknown) => boolean;
105 + const primitive: (value: unknown) => value is Primitive;
106 + const integer: (value: unknown) => value is number;
107 + const safeInteger: (value: unknown) => value is number;
108 + const plainObject: (value: unknown) => boolean;
109 + const typedArray: (value: unknown) => value is TypedArray;
110 + const arrayLike: (value: unknown) => value is ArrayLike;
111 + const inRange: (value: number, range: number | number[]) => boolean;
112 + const domElement: (value: unknown) => value is DomElement;
113 + const observable: (value: unknown) => boolean;
114 + const nodeStream: (value: unknown) => value is NodeStream;
115 + const infinite: (value: unknown) => boolean;
116 + const even: (value: number) => boolean;
117 + const odd: (value: number) => boolean;
118 + const emptyArray: (value: unknown) => boolean;
119 + const nonEmptyArray: (value: unknown) => boolean;
120 + const emptyString: (value: unknown) => boolean;
121 + const nonEmptyString: (value: unknown) => boolean;
122 + const emptyStringOrWhitespace: (value: unknown) => boolean;
123 + const emptyObject: (value: unknown) => boolean;
124 + const nonEmptyObject: (value: unknown) => boolean;
125 + const emptySet: (value: unknown) => boolean;
126 + const nonEmptySet: (value: unknown) => boolean;
127 + const emptyMap: (value: unknown) => boolean;
128 + const nonEmptyMap: (value: unknown) => boolean;
129 + const any: (predicate: unknown, ...values: unknown[]) => boolean;
130 + const all: (predicate: unknown, ...values: unknown[]) => boolean;
131 +}
132 +export default is;
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +MIT License
2 +
3 +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4 +
5 +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:
6 +
7 +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 +
9 +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.
1 +{
2 + "_from": "@sindresorhus/is@^0.14.0",
3 + "_id": "@sindresorhus/is@0.14.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==",
6 + "_location": "/@sindresorhus/is",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "@sindresorhus/is@^0.14.0",
12 + "name": "@sindresorhus/is",
13 + "escapedName": "@sindresorhus%2fis",
14 + "scope": "@sindresorhus",
15 + "rawSpec": "^0.14.0",
16 + "saveSpec": null,
17 + "fetchSpec": "^0.14.0"
18 + },
19 + "_requiredBy": [
20 + "/got"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
23 + "_shasum": "9fb3a3cf3132328151f353de4632e01e52102bea",
24 + "_spec": "@sindresorhus/is@^0.14.0",
25 + "_where": "/Users/mindyeoi/Desktop/oss/We-Shop/boiler-plate/node_modules/got",
26 + "author": {
27 + "name": "Sindre Sorhus",
28 + "email": "sindresorhus@gmail.com",
29 + "url": "sindresorhus.com"
30 + },
31 + "bugs": {
32 + "url": "https://github.com/sindresorhus/is/issues"
33 + },
34 + "bundleDependencies": false,
35 + "deprecated": false,
36 + "description": "Type check values: `is.string('🦄') //=> true`",
37 + "devDependencies": {
38 + "@sindresorhus/tsconfig": "^0.1.0",
39 + "@types/jsdom": "^11.12.0",
40 + "@types/node": "^10.12.10",
41 + "@types/tempy": "^0.2.0",
42 + "@types/zen-observable": "^0.8.0",
43 + "ava": "^0.25.0",
44 + "del-cli": "^1.1.0",
45 + "jsdom": "^11.6.2",
46 + "rxjs": "^6.3.3",
47 + "tempy": "^0.2.1",
48 + "tslint": "^5.9.1",
49 + "tslint-xo": "^0.10.0",
50 + "typescript": "^3.2.1",
51 + "zen-observable": "^0.8.8"
52 + },
53 + "engines": {
54 + "node": ">=6"
55 + },
56 + "files": [
57 + "dist"
58 + ],
59 + "homepage": "https://github.com/sindresorhus/is#readme",
60 + "keywords": [
61 + "type",
62 + "types",
63 + "is",
64 + "check",
65 + "checking",
66 + "validate",
67 + "validation",
68 + "utility",
69 + "util",
70 + "typeof",
71 + "instanceof",
72 + "object",
73 + "assert",
74 + "assertion",
75 + "test",
76 + "kind",
77 + "primitive",
78 + "verify",
79 + "compare"
80 + ],
81 + "license": "MIT",
82 + "main": "dist/index.js",
83 + "name": "@sindresorhus/is",
84 + "repository": {
85 + "type": "git",
86 + "url": "git+https://github.com/sindresorhus/is.git"
87 + },
88 + "scripts": {
89 + "build": "del dist && tsc",
90 + "lint": "tslint --format stylish --project .",
91 + "prepublish": "npm run build && del dist/tests",
92 + "test": "npm run lint && npm run build && ava dist/tests"
93 + },
94 + "types": "dist/index.d.ts",
95 + "version": "0.14.0"
96 +}
This diff is collapsed. Click to expand it.
1 +MIT License
2 +
3 +Copyright (c) 2018 Szymon Marczak
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy
6 +of this software and associated documentation files (the "Software"), to deal
7 +in the Software without restriction, including without limitation the rights
8 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 +copies of the Software, and to permit persons to whom the Software is
10 +furnished to do so, subject to the following conditions:
11 +
12 +The above copyright notice and this permission notice shall be included in all
13 +copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 +SOFTWARE.
1 +# http-timer
2 +> Timings for HTTP requests
3 +
4 +[![Build Status](https://travis-ci.org/szmarczak/http-timer.svg?branch=master)](https://travis-ci.org/szmarczak/http-timer)
5 +[![Coverage Status](https://coveralls.io/repos/github/szmarczak/http-timer/badge.svg?branch=master)](https://coveralls.io/github/szmarczak/http-timer?branch=master)
6 +[![install size](https://packagephobia.now.sh/badge?p=@szmarczak/http-timer)](https://packagephobia.now.sh/result?p=@szmarczak/http-timer)
7 +
8 +Inspired by the [`request` package](https://github.com/request/request).
9 +
10 +## Usage
11 +```js
12 +'use strict';
13 +const https = require('https');
14 +const timer = require('@szmarczak/http-timer');
15 +
16 +const request = https.get('https://httpbin.org/anything');
17 +const timings = timer(request);
18 +
19 +request.on('response', response => {
20 + response.on('data', () => {}); // Consume the data somehow
21 + response.on('end', () => {
22 + console.log(timings);
23 + });
24 +});
25 +
26 +// { start: 1535708511443,
27 +// socket: 1535708511444,
28 +// lookup: 1535708511444,
29 +// connect: 1535708511582,
30 +// upload: 1535708511887,
31 +// response: 1535708512037,
32 +// end: 1535708512040,
33 +// phases:
34 +// { wait: 1,
35 +// dns: 0,
36 +// tcp: 138,
37 +// request: 305,
38 +// firstByte: 150,
39 +// download: 3,
40 +// total: 597 } }
41 +```
42 +
43 +## API
44 +
45 +### timer(request)
46 +
47 +Returns: `Object`
48 +
49 +- `start` - Time when the request started.
50 +- `socket` - Time when a socket was assigned to the request.
51 +- `lookup` - Time when the DNS lookup finished.
52 +- `connect` - Time when the socket successfully connected.
53 +- `upload` - Time when the request finished uploading.
54 +- `response` - Time when the request fired the `response` event.
55 +- `end` - Time when the response fired the `end` event.
56 +- `error` - Time when the request fired the `error` event.
57 +- `phases`
58 + - `wait` - `timings.socket - timings.start`
59 + - `dns` - `timings.lookup - timings.socket`
60 + - `tcp` - `timings.connect - timings.lookup`
61 + - `request` - `timings.upload - timings.connect`
62 + - `firstByte` - `timings.response - timings.upload`
63 + - `download` - `timings.end - timings.response`
64 + - `total` - `timings.end - timings.start` or `timings.error - timings.start`
65 +
66 +**Note**: The time is a `number` representing the milliseconds elapsed since the UNIX epoch.
67 +
68 +## License
69 +
70 +MIT
1 +{
2 + "_from": "@szmarczak/http-timer@^1.1.2",
3 + "_id": "@szmarczak/http-timer@1.1.2",
4 + "_inBundle": false,
5 + "_integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==",
6 + "_location": "/@szmarczak/http-timer",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "@szmarczak/http-timer@^1.1.2",
12 + "name": "@szmarczak/http-timer",
13 + "escapedName": "@szmarczak%2fhttp-timer",
14 + "scope": "@szmarczak",
15 + "rawSpec": "^1.1.2",
16 + "saveSpec": null,
17 + "fetchSpec": "^1.1.2"
18 + },
19 + "_requiredBy": [
20 + "/got"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz",
23 + "_shasum": "b1665e2c461a2cd92f4c1bbf50d5454de0d4b421",
24 + "_spec": "@szmarczak/http-timer@^1.1.2",
25 + "_where": "/Users/mindyeoi/Desktop/oss/We-Shop/boiler-plate/node_modules/got",
26 + "author": {
27 + "name": "Szymon Marczak"
28 + },
29 + "bugs": {
30 + "url": "https://github.com/szmarczak/http-timer/issues"
31 + },
32 + "bundleDependencies": false,
33 + "dependencies": {
34 + "defer-to-connect": "^1.0.1"
35 + },
36 + "deprecated": false,
37 + "description": "Timings for HTTP requests",
38 + "devDependencies": {
39 + "ava": "^0.25.0",
40 + "coveralls": "^3.0.2",
41 + "nyc": "^12.0.2",
42 + "p-event": "^2.1.0",
43 + "xo": "^0.22.0"
44 + },
45 + "engines": {
46 + "node": ">=6"
47 + },
48 + "files": [
49 + "source"
50 + ],
51 + "homepage": "https://github.com/szmarczak/http-timer#readme",
52 + "keywords": [
53 + "http",
54 + "https",
55 + "timer",
56 + "timings"
57 + ],
58 + "license": "MIT",
59 + "main": "source",
60 + "name": "@szmarczak/http-timer",
61 + "repository": {
62 + "type": "git",
63 + "url": "git+https://github.com/szmarczak/http-timer.git"
64 + },
65 + "scripts": {
66 + "coveralls": "nyc report --reporter=text-lcov | coveralls",
67 + "test": "xo && nyc ava"
68 + },
69 + "version": "1.1.2",
70 + "xo": {
71 + "rules": {
72 + "unicorn/filename-case": "camelCase"
73 + }
74 + }
75 +}
1 +'use strict';
2 +const deferToConnect = require('defer-to-connect');
3 +
4 +module.exports = request => {
5 + const timings = {
6 + start: Date.now(),
7 + socket: null,
8 + lookup: null,
9 + connect: null,
10 + upload: null,
11 + response: null,
12 + end: null,
13 + error: null,
14 + phases: {
15 + wait: null,
16 + dns: null,
17 + tcp: null,
18 + request: null,
19 + firstByte: null,
20 + download: null,
21 + total: null
22 + }
23 + };
24 +
25 + const handleError = origin => {
26 + const emit = origin.emit.bind(origin);
27 + origin.emit = (event, ...args) => {
28 + // Catches the `error` event
29 + if (event === 'error') {
30 + timings.error = Date.now();
31 + timings.phases.total = timings.error - timings.start;
32 +
33 + origin.emit = emit;
34 + }
35 +
36 + // Saves the original behavior
37 + return emit(event, ...args);
38 + };
39 + };
40 +
41 + let uploadFinished = false;
42 + const onUpload = () => {
43 + timings.upload = Date.now();
44 + timings.phases.request = timings.upload - timings.connect;
45 + };
46 +
47 + handleError(request);
48 +
49 + request.once('socket', socket => {
50 + timings.socket = Date.now();
51 + timings.phases.wait = timings.socket - timings.start;
52 +
53 + const lookupListener = () => {
54 + timings.lookup = Date.now();
55 + timings.phases.dns = timings.lookup - timings.socket;
56 + };
57 +
58 + socket.once('lookup', lookupListener);
59 +
60 + deferToConnect(socket, () => {
61 + timings.connect = Date.now();
62 +
63 + if (timings.lookup === null) {
64 + socket.removeListener('lookup', lookupListener);
65 + timings.lookup = timings.connect;
66 + timings.phases.dns = timings.lookup - timings.socket;
67 + }
68 +
69 + timings.phases.tcp = timings.connect - timings.lookup;
70 +
71 + if (uploadFinished && !timings.upload) {
72 + onUpload();
73 + }
74 + });
75 + });
76 +
77 + request.once('finish', () => {
78 + uploadFinished = true;
79 +
80 + if (timings.connect) {
81 + onUpload();
82 + }
83 + });
84 +
85 + request.once('response', response => {
86 + timings.response = Date.now();
87 + timings.phases.firstByte = timings.response - timings.upload;
88 +
89 + handleError(response);
90 +
91 + response.once('end', () => {
92 + timings.end = Date.now();
93 + timings.phases.download = timings.end - timings.response;
94 + timings.phases.total = timings.end - timings.start;
95 + });
96 + });
97 +
98 + return timings;
99 +};
1 +This software is dual-licensed under the ISC and MIT licenses.
2 +You may use this software under EITHER of the following licenses.
3 +
4 +----------
5 +
6 +The ISC License
7 +
8 +Copyright (c) Isaac Z. Schlueter and Contributors
9 +
10 +Permission to use, copy, modify, and/or distribute this software for any
11 +purpose with or without fee is hereby granted, provided that the above
12 +copyright notice and this permission notice appear in all copies.
13 +
14 +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15 +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16 +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17 +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18 +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19 +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
20 +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 +
22 +----------
23 +
24 +Copyright Isaac Z. Schlueter and Contributors
25 +All rights reserved.
26 +
27 +Permission is hereby granted, free of charge, to any person
28 +obtaining a copy of this software and associated documentation
29 +files (the "Software"), to deal in the Software without
30 +restriction, including without limitation the rights to use,
31 +copy, modify, merge, publish, distribute, sublicense, and/or sell
32 +copies of the Software, and to permit persons to whom the
33 +Software is furnished to do so, subject to the following
34 +conditions:
35 +
36 +The above copyright notice and this permission notice shall be
37 +included in all copies or substantial portions of the Software.
38 +
39 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
40 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
41 +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
42 +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
43 +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
44 +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
45 +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
46 +OTHER DEALINGS IN THE SOFTWARE.
1 +# abbrev-js
2 +
3 +Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
4 +
5 +Usage:
6 +
7 + var abbrev = require("abbrev");
8 + abbrev("foo", "fool", "folding", "flop");
9 +
10 + // returns:
11 + { fl: 'flop'
12 + , flo: 'flop'
13 + , flop: 'flop'
14 + , fol: 'folding'
15 + , fold: 'folding'
16 + , foldi: 'folding'
17 + , foldin: 'folding'
18 + , folding: 'folding'
19 + , foo: 'foo'
20 + , fool: 'fool'
21 + }
22 +
23 +This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
1 +module.exports = exports = abbrev.abbrev = abbrev
2 +
3 +abbrev.monkeyPatch = monkeyPatch
4 +
5 +function monkeyPatch () {
6 + Object.defineProperty(Array.prototype, 'abbrev', {
7 + value: function () { return abbrev(this) },
8 + enumerable: false, configurable: true, writable: true
9 + })
10 +
11 + Object.defineProperty(Object.prototype, 'abbrev', {
12 + value: function () { return abbrev(Object.keys(this)) },
13 + enumerable: false, configurable: true, writable: true
14 + })
15 +}
16 +
17 +function abbrev (list) {
18 + if (arguments.length !== 1 || !Array.isArray(list)) {
19 + list = Array.prototype.slice.call(arguments, 0)
20 + }
21 + for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
22 + args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
23 + }
24 +
25 + // sort them lexicographically, so that they're next to their nearest kin
26 + args = args.sort(lexSort)
27 +
28 + // walk through each, seeing how much it has in common with the next and previous
29 + var abbrevs = {}
30 + , prev = ""
31 + for (var i = 0, l = args.length ; i < l ; i ++) {
32 + var current = args[i]
33 + , next = args[i + 1] || ""
34 + , nextMatches = true
35 + , prevMatches = true
36 + if (current === next) continue
37 + for (var j = 0, cl = current.length ; j < cl ; j ++) {
38 + var curChar = current.charAt(j)
39 + nextMatches = nextMatches && curChar === next.charAt(j)
40 + prevMatches = prevMatches && curChar === prev.charAt(j)
41 + if (!nextMatches && !prevMatches) {
42 + j ++
43 + break
44 + }
45 + }
46 + prev = current
47 + if (j === cl) {
48 + abbrevs[current] = current
49 + continue
50 + }
51 + for (var a = current.substr(0, j) ; j <= cl ; j ++) {
52 + abbrevs[a] = current
53 + a += current.charAt(j)
54 + }
55 + }
56 + return abbrevs
57 +}
58 +
59 +function lexSort (a, b) {
60 + return a === b ? 0 : a > b ? 1 : -1
61 +}
1 +{
2 + "_from": "abbrev@1",
3 + "_id": "abbrev@1.1.1",
4 + "_inBundle": false,
5 + "_integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
6 + "_location": "/abbrev",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "abbrev@1",
12 + "name": "abbrev",
13 + "escapedName": "abbrev",
14 + "rawSpec": "1",
15 + "saveSpec": null,
16 + "fetchSpec": "1"
17 + },
18 + "_requiredBy": [
19 + "/nopt"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
22 + "_shasum": "f8f2c887ad10bf67f634f005b6987fed3179aac8",
23 + "_spec": "abbrev@1",
24 + "_where": "/Users/mindyeoi/Desktop/oss/We-Shop/boiler-plate/node_modules/nopt",
25 + "author": {
26 + "name": "Isaac Z. Schlueter",
27 + "email": "i@izs.me"
28 + },
29 + "bugs": {
30 + "url": "https://github.com/isaacs/abbrev-js/issues"
31 + },
32 + "bundleDependencies": false,
33 + "deprecated": false,
34 + "description": "Like ruby's abbrev module, but in js",
35 + "devDependencies": {
36 + "tap": "^10.1"
37 + },
38 + "files": [
39 + "abbrev.js"
40 + ],
41 + "homepage": "https://github.com/isaacs/abbrev-js#readme",
42 + "license": "ISC",
43 + "main": "abbrev.js",
44 + "name": "abbrev",
45 + "repository": {
46 + "type": "git",
47 + "url": "git+ssh://git@github.com/isaacs/abbrev-js.git"
48 + },
49 + "scripts": {
50 + "postpublish": "git push origin --all; git push origin --tags",
51 + "postversion": "npm publish",
52 + "preversion": "npm test",
53 + "test": "tap test.js --100"
54 + },
55 + "version": "1.1.1"
56 +}
1 +# Change Log
2 +
3 +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4 +
5 +<a name="3.0.0"></a>
6 +# [3.0.0](https://github.com/nexdrew/ansi-align/compare/v2.0.0...v3.0.0) (2018-12-17)
7 +
8 +
9 +### Bug Fixes
10 +
11 +* **package:** update string-width to version 3.0.0 ([#50](https://github.com/nexdrew/ansi-align/issues/50)) ([67f0d8f](https://github.com/nexdrew/ansi-align/commit/67f0d8f))
12 +
13 +
14 +### BREAKING CHANGES
15 +
16 +* **package:** Node 4 no longer supported, please update to Node 6+ or use ansi-align@2.0.0
17 +
18 +
19 +
20 +<a name="2.0.0"></a>
21 +# [2.0.0](https://github.com/nexdrew/ansi-align/compare/v1.1.0...v2.0.0) (2017-05-01)
22 +
23 +
24 +### Features
25 +
26 +* ES2015ify, dropping support for Node <4 ([#30](https://github.com/nexdrew/ansi-align/issues/30)) ([7b43f48](https://github.com/nexdrew/ansi-align/commit/7b43f48))
27 +
28 +
29 +### BREAKING CHANGES
30 +
31 +* Node 0.10 or 0.12 no longer supported, please update to Node 4+ or use ansi-align@1.1.0
32 +
33 +
34 +
35 +<a name="1.1.0"></a>
36 +# [1.1.0](https://github.com/nexdrew/ansi-align/compare/v1.0.0...v1.1.0) (2016-06-06)
37 +
38 +
39 +### Features
40 +
41 +* support left-alignment as no-op ([#3](https://github.com/nexdrew/ansi-align/issues/3)) ([e581db6](https://github.com/nexdrew/ansi-align/commit/e581db6))
42 +
43 +
44 +
45 +<a name="1.0.0"></a>
46 +# 1.0.0 (2016-04-30)
47 +
48 +
49 +### Features
50 +
51 +* initial commit ([1914d90](https://github.com/nexdrew/ansi-align/commit/1914d90))
1 +Copyright (c) 2016, Contributors
2 +
3 +Permission to use, copy, modify, and/or distribute this software for any purpose
4 +with or without fee is hereby granted, provided that the above copyright notice
5 +and this permission notice appear in all copies.
6 +
7 +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8 +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
9 +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10 +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
11 +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
12 +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
13 +THIS SOFTWARE.
1 +# ansi-align
2 +
3 +> align-text with ANSI support for CLIs
4 +
5 +[![Build Status](https://travis-ci.org/nexdrew/ansi-align.svg?branch=master)](https://travis-ci.org/nexdrew/ansi-align)
6 +[![Coverage Status](https://coveralls.io/repos/github/nexdrew/ansi-align/badge.svg?branch=master)](https://coveralls.io/github/nexdrew/ansi-align?branch=master)
7 +[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
8 +[![Greenkeeper badge](https://badges.greenkeeper.io/nexdrew/ansi-align.svg)](https://greenkeeper.io/)
9 +
10 +Easily center- or right- align a block of text, carefully ignoring ANSI escape codes.
11 +
12 +E.g. turn this:
13 +
14 +<img width="281" alt="ansi text block no alignment :(" src="https://cloud.githubusercontent.com/assets/1929625/14937509/7c3076dc-0ed7-11e6-8c16-4f6a4ccc8346.png">
15 +
16 +Into this:
17 +
18 +<img width="278" alt="ansi text block center aligned!" src="https://cloud.githubusercontent.com/assets/1929625/14937510/7c3ca0b0-0ed7-11e6-8f0a-541ca39b6e0a.png">
19 +
20 +## Install
21 +
22 +```sh
23 +npm install --save ansi-align
24 +```
25 +
26 +```js
27 +var ansiAlign = require('ansi-align')
28 +```
29 +
30 +## API
31 +
32 +### `ansiAlign(text, [opts])`
33 +
34 +Align the given text per the line with the greatest [`string-width`](https://github.com/sindresorhus/string-width), returning a new string (or array).
35 +
36 +#### Arguments
37 +
38 +- `text`: required, string or array
39 +
40 + The text to align. If a string is given, it will be split using either the `opts.split` value or `'\n'` by default. If an array is given, a different array of modified strings will be returned.
41 +
42 +- `opts`: optional, object
43 +
44 + Options to change behavior, see below.
45 +
46 +#### Options
47 +
48 +- `opts.align`: string, default `'center'`
49 +
50 + The alignment mode. Use `'center'` for center-alignment, `'right'` for right-alignment, or `'left'` for left-alignment. Note that the given `text` is assumed to be left-aligned already, so specifying `align: 'left'` just returns the `text` as is (no-op).
51 +
52 +- `opts.split`: string or RegExp, default `'\n'`
53 +
54 + The separator to use when splitting the text. Only used if text is given as a string.
55 +
56 +- `opts.pad`: string, default `' '`
57 +
58 + The value used to left-pad (prepend to) lines of lesser width. Will be repeated as necessary to adjust alignment to the line with the greatest width.
59 +
60 +### `ansiAlign.center(text)`
61 +
62 +Alias for `ansiAlign(text, { align: 'center' })`.
63 +
64 +### `ansiAlign.right(text)`
65 +
66 +Alias for `ansiAlign(text, { align: 'right' })`.
67 +
68 +### `ansiAlign.left(text)`
69 +
70 +Alias for `ansiAlign(text, { align: 'left' })`, which is a no-op.
71 +
72 +## Similar Packages
73 +
74 +- [`center-align`](https://github.com/jonschlinkert/center-align): Very close to this package, except it doesn't support ANSI codes.
75 +- [`left-pad`](https://github.com/camwest/left-pad): Great for left-padding but does not support center alignment or ANSI codes.
76 +- Pretty much anything by the [chalk](https://github.com/chalk) team
77 +
78 +## License
79 +
80 +ISC © Contributors
1 +'use strict'
2 +
3 +const stringWidth = require('string-width')
4 +
5 +function ansiAlign (text, opts) {
6 + if (!text) return text
7 +
8 + opts = opts || {}
9 + const align = opts.align || 'center'
10 +
11 + // short-circuit `align: 'left'` as no-op
12 + if (align === 'left') return text
13 +
14 + const split = opts.split || '\n'
15 + const pad = opts.pad || ' '
16 + const widthDiffFn = align !== 'right' ? halfDiff : fullDiff
17 +
18 + let returnString = false
19 + if (!Array.isArray(text)) {
20 + returnString = true
21 + text = String(text).split(split)
22 + }
23 +
24 + let width
25 + let maxWidth = 0
26 + text = text.map(function (str) {
27 + str = String(str)
28 + width = stringWidth(str)
29 + maxWidth = Math.max(width, maxWidth)
30 + return {
31 + str,
32 + width
33 + }
34 + }).map(function (obj) {
35 + return new Array(widthDiffFn(maxWidth, obj.width) + 1).join(pad) + obj.str
36 + })
37 +
38 + return returnString ? text.join(split) : text
39 +}
40 +
41 +ansiAlign.left = function left (text) {
42 + return ansiAlign(text, { align: 'left' })
43 +}
44 +
45 +ansiAlign.center = function center (text) {
46 + return ansiAlign(text, { align: 'center' })
47 +}
48 +
49 +ansiAlign.right = function right (text) {
50 + return ansiAlign(text, { align: 'right' })
51 +}
52 +
53 +module.exports = ansiAlign
54 +
55 +function halfDiff (maxWidth, curWidth) {
56 + return Math.floor((maxWidth - curWidth) / 2)
57 +}
58 +
59 +function fullDiff (maxWidth, curWidth) {
60 + return maxWidth - curWidth
61 +}
1 +'use strict';
2 +const stripAnsi = require('strip-ansi');
3 +const isFullwidthCodePoint = require('is-fullwidth-code-point');
4 +const emojiRegex = require('emoji-regex')();
5 +
6 +module.exports = input => {
7 + input = input.replace(emojiRegex, ' ');
8 +
9 + if (typeof input !== 'string' || input.length === 0) {
10 + return 0;
11 + }
12 +
13 + input = stripAnsi(input);
14 +
15 + let width = 0;
16 +
17 + for (let i = 0; i < input.length; i++) {
18 + const code = input.codePointAt(i);
19 +
20 + // Ignore control characters
21 + if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) {
22 + continue;
23 + }
24 +
25 + // Ignore combining characters
26 + if (code >= 0x300 && code <= 0x36F) {
27 + continue;
28 + }
29 +
30 + // Surrogates
31 + if (code > 0xFFFF) {
32 + i++;
33 + }
34 +
35 + width += isFullwidthCodePoint(code) ? 2 : 1;
36 + }
37 +
38 + return width;
39 +};
1 +MIT License
2 +
3 +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4 +
5 +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:
6 +
7 +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 +
9 +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.
1 +{
2 + "_from": "string-width@^3.0.0",
3 + "_id": "string-width@3.1.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
6 + "_location": "/ansi-align/string-width",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "string-width@^3.0.0",
12 + "name": "string-width",
13 + "escapedName": "string-width",
14 + "rawSpec": "^3.0.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^3.0.0"
17 + },
18 + "_requiredBy": [
19 + "/ansi-align"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
22 + "_shasum": "22767be21b62af1081574306f69ac51b62203961",
23 + "_spec": "string-width@^3.0.0",
24 + "_where": "/Users/mindyeoi/Desktop/oss/We-Shop/boiler-plate/node_modules/ansi-align",
25 + "author": {
26 + "name": "Sindre Sorhus",
27 + "email": "sindresorhus@gmail.com",
28 + "url": "sindresorhus.com"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/sindresorhus/string-width/issues"
32 + },
33 + "bundleDependencies": false,
34 + "dependencies": {
35 + "emoji-regex": "^7.0.1",
36 + "is-fullwidth-code-point": "^2.0.0",
37 + "strip-ansi": "^5.1.0"
38 + },
39 + "deprecated": false,
40 + "description": "Get the visual width of a string - the number of columns required to display it",
41 + "devDependencies": {
42 + "ava": "^1.0.1",
43 + "xo": "^0.23.0"
44 + },
45 + "engines": {
46 + "node": ">=6"
47 + },
48 + "files": [
49 + "index.js"
50 + ],
51 + "homepage": "https://github.com/sindresorhus/string-width#readme",
52 + "keywords": [
53 + "string",
54 + "str",
55 + "character",
56 + "char",
57 + "unicode",
58 + "width",
59 + "visual",
60 + "column",
61 + "columns",
62 + "fullwidth",
63 + "full-width",
64 + "full",
65 + "ansi",
66 + "escape",
67 + "codes",
68 + "cli",
69 + "command-line",
70 + "terminal",
71 + "console",
72 + "cjk",
73 + "chinese",
74 + "japanese",
75 + "korean",
76 + "fixed-width"
77 + ],
78 + "license": "MIT",
79 + "name": "string-width",
80 + "repository": {
81 + "type": "git",
82 + "url": "git+https://github.com/sindresorhus/string-width.git"
83 + },
84 + "scripts": {
85 + "test": "xo && ava"
86 + },
87 + "version": "3.1.0"
88 +}
1 +# string-width [![Build Status](https://travis-ci.org/sindresorhus/string-width.svg?branch=master)](https://travis-ci.org/sindresorhus/string-width)
2 +
3 +> Get the visual width of a string - the number of columns required to display it
4 +
5 +Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
6 +
7 +Useful to be able to measure the actual width of command-line output.
8 +
9 +
10 +## Install
11 +
12 +```
13 +$ npm install string-width
14 +```
15 +
16 +
17 +## Usage
18 +
19 +```js
20 +const stringWidth = require('string-width');
21 +
22 +stringWidth('古');
23 +//=> 2
24 +
25 +stringWidth('\u001b[1m古\u001b[22m');
26 +//=> 2
27 +
28 +stringWidth('a');
29 +//=> 1
30 +
31 +stringWidth('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
32 +// => 5
33 +```
34 +
35 +
36 +## Related
37 +
38 +- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module
39 +- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string
40 +- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string
41 +
42 +
43 +## License
44 +
45 +MIT © [Sindre Sorhus](https://sindresorhus.com)
1 +{
2 + "_from": "ansi-align@^3.0.0",
3 + "_id": "ansi-align@3.0.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==",
6 + "_location": "/ansi-align",
7 + "_phantomChildren": {
8 + "emoji-regex": "7.0.3",
9 + "is-fullwidth-code-point": "2.0.0",
10 + "strip-ansi": "5.2.0"
11 + },
12 + "_requested": {
13 + "type": "range",
14 + "registry": true,
15 + "raw": "ansi-align@^3.0.0",
16 + "name": "ansi-align",
17 + "escapedName": "ansi-align",
18 + "rawSpec": "^3.0.0",
19 + "saveSpec": null,
20 + "fetchSpec": "^3.0.0"
21 + },
22 + "_requiredBy": [
23 + "/boxen"
24 + ],
25 + "_resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz",
26 + "_shasum": "b536b371cf687caaef236c18d3e21fe3797467cb",
27 + "_spec": "ansi-align@^3.0.0",
28 + "_where": "/Users/mindyeoi/Desktop/oss/We-Shop/boiler-plate/node_modules/boxen",
29 + "author": {
30 + "name": "nexdrew"
31 + },
32 + "bugs": {
33 + "url": "https://github.com/nexdrew/ansi-align/issues"
34 + },
35 + "bundleDependencies": false,
36 + "dependencies": {
37 + "string-width": "^3.0.0"
38 + },
39 + "deprecated": false,
40 + "description": "align-text with ANSI support for CLIs",
41 + "devDependencies": {
42 + "ava": "^1.0.1",
43 + "chalk": "^2.4.1",
44 + "coveralls": "^3.0.2",
45 + "nyc": "^13.1.0",
46 + "standard": "^12.0.1",
47 + "standard-version": "^4.4.0"
48 + },
49 + "files": [
50 + "index.js"
51 + ],
52 + "homepage": "https://github.com/nexdrew/ansi-align#readme",
53 + "keywords": [
54 + "ansi",
55 + "align",
56 + "cli",
57 + "center",
58 + "pad"
59 + ],
60 + "license": "ISC",
61 + "main": "index.js",
62 + "name": "ansi-align",
63 + "repository": {
64 + "type": "git",
65 + "url": "git+https://github.com/nexdrew/ansi-align.git"
66 + },
67 + "scripts": {
68 + "coverage": "nyc report --reporter=text-lcov | coveralls",
69 + "pretest": "standard",
70 + "release": "standard-version",
71 + "test": "nyc ava"
72 + },
73 + "version": "3.0.0"
74 +}
1 +'use strict';
2 +
3 +module.exports = options => {
4 + options = Object.assign({
5 + onlyFirst: false
6 + }, options);
7 +
8 + const pattern = [
9 + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
10 + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
11 + ].join('|');
12 +
13 + return new RegExp(pattern, options.onlyFirst ? undefined : 'g');
14 +};
1 +MIT License
2 +
3 +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4 +
5 +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:
6 +
7 +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 +
9 +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.
1 +{
2 + "_from": "ansi-regex@^4.1.0",
3 + "_id": "ansi-regex@4.1.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
6 + "_location": "/ansi-regex",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "ansi-regex@^4.1.0",
12 + "name": "ansi-regex",
13 + "escapedName": "ansi-regex",
14 + "rawSpec": "^4.1.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^4.1.0"
17 + },
18 + "_requiredBy": [
19 + "/strip-ansi"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
22 + "_shasum": "8b9f8f08cf1acb843756a839ca8c7e3168c51997",
23 + "_spec": "ansi-regex@^4.1.0",
24 + "_where": "/Users/mindyeoi/Desktop/oss/We-Shop/boiler-plate/node_modules/strip-ansi",
25 + "author": {
26 + "name": "Sindre Sorhus",
27 + "email": "sindresorhus@gmail.com",
28 + "url": "sindresorhus.com"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/chalk/ansi-regex/issues"
32 + },
33 + "bundleDependencies": false,
34 + "deprecated": false,
35 + "description": "Regular expression for matching ANSI escape codes",
36 + "devDependencies": {
37 + "ava": "^0.25.0",
38 + "xo": "^0.23.0"
39 + },
40 + "engines": {
41 + "node": ">=6"
42 + },
43 + "files": [
44 + "index.js"
45 + ],
46 + "homepage": "https://github.com/chalk/ansi-regex#readme",
47 + "keywords": [
48 + "ansi",
49 + "styles",
50 + "color",
51 + "colour",
52 + "colors",
53 + "terminal",
54 + "console",
55 + "cli",
56 + "string",
57 + "tty",
58 + "escape",
59 + "formatting",
60 + "rgb",
61 + "256",
62 + "shell",
63 + "xterm",
64 + "command-line",
65 + "text",
66 + "regex",
67 + "regexp",
68 + "re",
69 + "match",
70 + "test",
71 + "find",
72 + "pattern"
73 + ],
74 + "license": "MIT",
75 + "name": "ansi-regex",
76 + "repository": {
77 + "type": "git",
78 + "url": "git+https://github.com/chalk/ansi-regex.git"
79 + },
80 + "scripts": {
81 + "test": "xo && ava",
82 + "view-supported": "node fixtures/view-codes.js"
83 + },
84 + "version": "4.1.0"
85 +}
1 +# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex)
2 +
3 +> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
4 +
5 +---
6 +
7 +<div align="center">
8 + <b>
9 + <a href="https://tidelift.com/subscription/pkg/npm-ansi-regex?utm_source=npm-ansi-regex&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
10 + </b>
11 + <br>
12 + <sub>
13 + Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
14 + </sub>
15 +</div>
16 +
17 +---
18 +
19 +
20 +## Install
21 +
22 +```
23 +$ npm install ansi-regex
24 +```
25 +
26 +
27 +## Usage
28 +
29 +```js
30 +const ansiRegex = require('ansi-regex');
31 +
32 +ansiRegex().test('\u001B[4mcake\u001B[0m');
33 +//=> true
34 +
35 +ansiRegex().test('cake');
36 +//=> false
37 +
38 +'\u001B[4mcake\u001B[0m'.match(ansiRegex());
39 +//=> ['\u001B[4m', '\u001B[0m']
40 +
41 +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
42 +//=> ['\u001B[4m']
43 +
44 +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
45 +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
46 +```
47 +
48 +
49 +## API
50 +
51 +### ansiRegex([options])
52 +
53 +Returns a regex for matching ANSI escape codes.
54 +
55 +#### options
56 +
57 +##### onlyFirst
58 +
59 +Type: `boolean`<br>
60 +Default: `false` *(Matches any ANSI escape codes in a string)*
61 +
62 +Match only the first ANSI escape.
63 +
64 +
65 +## FAQ
66 +
67 +### Why do you test for codes not in the ECMA 48 standard?
68 +
69 +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. 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.
70 +
71 +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.
72 +
73 +
74 +## Security
75 +
76 +To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
77 +
78 +
79 +## Maintainers
80 +
81 +- [Sindre Sorhus](https://github.com/sindresorhus)
82 +- [Josh Junon](https://github.com/qix-)
83 +
84 +
85 +## License
86 +
87 +MIT
1 +declare type CSSColor =
2 + | 'aliceblue'
3 + | 'antiquewhite'
4 + | 'aqua'
5 + | 'aquamarine'
6 + | 'azure'
7 + | 'beige'
8 + | 'bisque'
9 + | 'black'
10 + | 'blanchedalmond'
11 + | 'blue'
12 + | 'blueviolet'
13 + | 'brown'
14 + | 'burlywood'
15 + | 'cadetblue'
16 + | 'chartreuse'
17 + | 'chocolate'
18 + | 'coral'
19 + | 'cornflowerblue'
20 + | 'cornsilk'
21 + | 'crimson'
22 + | 'cyan'
23 + | 'darkblue'
24 + | 'darkcyan'
25 + | 'darkgoldenrod'
26 + | 'darkgray'
27 + | 'darkgreen'
28 + | 'darkgrey'
29 + | 'darkkhaki'
30 + | 'darkmagenta'
31 + | 'darkolivegreen'
32 + | 'darkorange'
33 + | 'darkorchid'
34 + | 'darkred'
35 + | 'darksalmon'
36 + | 'darkseagreen'
37 + | 'darkslateblue'
38 + | 'darkslategray'
39 + | 'darkslategrey'
40 + | 'darkturquoise'
41 + | 'darkviolet'
42 + | 'deeppink'
43 + | 'deepskyblue'
44 + | 'dimgray'
45 + | 'dimgrey'
46 + | 'dodgerblue'
47 + | 'firebrick'
48 + | 'floralwhite'
49 + | 'forestgreen'
50 + | 'fuchsia'
51 + | 'gainsboro'
52 + | 'ghostwhite'
53 + | 'gold'
54 + | 'goldenrod'
55 + | 'gray'
56 + | 'green'
57 + | 'greenyellow'
58 + | 'grey'
59 + | 'honeydew'
60 + | 'hotpink'
61 + | 'indianred'
62 + | 'indigo'
63 + | 'ivory'
64 + | 'khaki'
65 + | 'lavender'
66 + | 'lavenderblush'
67 + | 'lawngreen'
68 + | 'lemonchiffon'
69 + | 'lightblue'
70 + | 'lightcoral'
71 + | 'lightcyan'
72 + | 'lightgoldenrodyellow'
73 + | 'lightgray'
74 + | 'lightgreen'
75 + | 'lightgrey'
76 + | 'lightpink'
77 + | 'lightsalmon'
78 + | 'lightseagreen'
79 + | 'lightskyblue'
80 + | 'lightslategray'
81 + | 'lightslategrey'
82 + | 'lightsteelblue'
83 + | 'lightyellow'
84 + | 'lime'
85 + | 'limegreen'
86 + | 'linen'
87 + | 'magenta'
88 + | 'maroon'
89 + | 'mediumaquamarine'
90 + | 'mediumblue'
91 + | 'mediumorchid'
92 + | 'mediumpurple'
93 + | 'mediumseagreen'
94 + | 'mediumslateblue'
95 + | 'mediumspringgreen'
96 + | 'mediumturquoise'
97 + | 'mediumvioletred'
98 + | 'midnightblue'
99 + | 'mintcream'
100 + | 'mistyrose'
101 + | 'moccasin'
102 + | 'navajowhite'
103 + | 'navy'
104 + | 'oldlace'
105 + | 'olive'
106 + | 'olivedrab'
107 + | 'orange'
108 + | 'orangered'
109 + | 'orchid'
110 + | 'palegoldenrod'
111 + | 'palegreen'
112 + | 'paleturquoise'
113 + | 'palevioletred'
114 + | 'papayawhip'
115 + | 'peachpuff'
116 + | 'peru'
117 + | 'pink'
118 + | 'plum'
119 + | 'powderblue'
120 + | 'purple'
121 + | 'rebeccapurple'
122 + | 'red'
123 + | 'rosybrown'
124 + | 'royalblue'
125 + | 'saddlebrown'
126 + | 'salmon'
127 + | 'sandybrown'
128 + | 'seagreen'
129 + | 'seashell'
130 + | 'sienna'
131 + | 'silver'
132 + | 'skyblue'
133 + | 'slateblue'
134 + | 'slategray'
135 + | 'slategrey'
136 + | 'snow'
137 + | 'springgreen'
138 + | 'steelblue'
139 + | 'tan'
140 + | 'teal'
141 + | 'thistle'
142 + | 'tomato'
143 + | 'turquoise'
144 + | 'violet'
145 + | 'wheat'
146 + | 'white'
147 + | 'whitesmoke'
148 + | 'yellow'
149 + | 'yellowgreen';
150 +
151 +declare namespace ansiStyles {
152 + interface ColorConvert {
153 + /**
154 + The RGB color space.
155 +
156 + @param red - (`0`-`255`)
157 + @param green - (`0`-`255`)
158 + @param blue - (`0`-`255`)
159 + */
160 + rgb(red: number, green: number, blue: number): string;
161 +
162 + /**
163 + The RGB HEX color space.
164 +
165 + @param hex - A hexadecimal string containing RGB data.
166 + */
167 + hex(hex: string): string;
168 +
169 + /**
170 + @param keyword - A CSS color name.
171 + */
172 + keyword(keyword: CSSColor): string;
173 +
174 + /**
175 + The HSL color space.
176 +
177 + @param hue - (`0`-`360`)
178 + @param saturation - (`0`-`100`)
179 + @param lightness - (`0`-`100`)
180 + */
181 + hsl(hue: number, saturation: number, lightness: number): string;
182 +
183 + /**
184 + The HSV color space.
185 +
186 + @param hue - (`0`-`360`)
187 + @param saturation - (`0`-`100`)
188 + @param value - (`0`-`100`)
189 + */
190 + hsv(hue: number, saturation: number, value: number): string;
191 +
192 + /**
193 + The HSV color space.
194 +
195 + @param hue - (`0`-`360`)
196 + @param whiteness - (`0`-`100`)
197 + @param blackness - (`0`-`100`)
198 + */
199 + hwb(hue: number, whiteness: number, blackness: number): string;
200 +
201 + /**
202 + Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color.
203 + */
204 + ansi(ansi: number): string;
205 +
206 + /**
207 + Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
208 + */
209 + ansi256(ansi: number): string;
210 + }
211 +
212 + interface CSPair {
213 + /**
214 + The ANSI terminal control sequence for starting this style.
215 + */
216 + readonly open: string;
217 +
218 + /**
219 + The ANSI terminal control sequence for ending this style.
220 + */
221 + readonly close: string;
222 + }
223 +
224 + interface ColorBase {
225 + readonly ansi: ColorConvert;
226 + readonly ansi256: ColorConvert;
227 + readonly ansi16m: ColorConvert;
228 +
229 + /**
230 + The ANSI terminal control sequence for ending this color.
231 + */
232 + readonly close: string;
233 + }
234 +
235 + interface Modifier {
236 + /**
237 + Resets the current color chain.
238 + */
239 + readonly reset: CSPair;
240 +
241 + /**
242 + Make text bold.
243 + */
244 + readonly bold: CSPair;
245 +
246 + /**
247 + Emitting only a small amount of light.
248 + */
249 + readonly dim: CSPair;
250 +
251 + /**
252 + Make text italic. (Not widely supported)
253 + */
254 + readonly italic: CSPair;
255 +
256 + /**
257 + Make text underline. (Not widely supported)
258 + */
259 + readonly underline: CSPair;
260 +
261 + /**
262 + Inverse background and foreground colors.
263 + */
264 + readonly inverse: CSPair;
265 +
266 + /**
267 + Prints the text, but makes it invisible.
268 + */
269 + readonly hidden: CSPair;
270 +
271 + /**
272 + Puts a horizontal line through the center of the text. (Not widely supported)
273 + */
274 + readonly strikethrough: CSPair;
275 + }
276 +
277 + interface ForegroundColor {
278 + readonly black: CSPair;
279 + readonly red: CSPair;
280 + readonly green: CSPair;
281 + readonly yellow: CSPair;
282 + readonly blue: CSPair;
283 + readonly cyan: CSPair;
284 + readonly magenta: CSPair;
285 + readonly white: CSPair;
286 +
287 + /**
288 + Alias for `blackBright`.
289 + */
290 + readonly gray: CSPair;
291 +
292 + /**
293 + Alias for `blackBright`.
294 + */
295 + readonly grey: CSPair;
296 +
297 + readonly blackBright: CSPair;
298 + readonly redBright: CSPair;
299 + readonly greenBright: CSPair;
300 + readonly yellowBright: CSPair;
301 + readonly blueBright: CSPair;
302 + readonly cyanBright: CSPair;
303 + readonly magentaBright: CSPair;
304 + readonly whiteBright: CSPair;
305 + }
306 +
307 + interface BackgroundColor {
308 + readonly bgBlack: CSPair;
309 + readonly bgRed: CSPair;
310 + readonly bgGreen: CSPair;
311 + readonly bgYellow: CSPair;
312 + readonly bgBlue: CSPair;
313 + readonly bgCyan: CSPair;
314 + readonly bgMagenta: CSPair;
315 + readonly bgWhite: CSPair;
316 +
317 + /**
318 + Alias for `bgBlackBright`.
319 + */
320 + readonly bgGray: CSPair;
321 +
322 + /**
323 + Alias for `bgBlackBright`.
324 + */
325 + readonly bgGrey: CSPair;
326 +
327 + readonly bgBlackBright: CSPair;
328 + readonly bgRedBright: CSPair;
329 + readonly bgGreenBright: CSPair;
330 + readonly bgYellowBright: CSPair;
331 + readonly bgBlueBright: CSPair;
332 + readonly bgCyanBright: CSPair;
333 + readonly bgMagentaBright: CSPair;
334 + readonly bgWhiteBright: CSPair;
335 + }
336 +}
337 +
338 +declare const ansiStyles: {
339 + readonly modifier: ansiStyles.Modifier;
340 + readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase;
341 + readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase;
342 + readonly codes: ReadonlyMap<number, number>;
343 +} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier;
344 +
345 +export = ansiStyles;
1 +'use strict';
2 +
3 +const wrapAnsi16 = (fn, offset) => (...args) => {
4 + const code = fn(...args);
5 + return `\u001B[${code + offset}m`;
6 +};
7 +
8 +const wrapAnsi256 = (fn, offset) => (...args) => {
9 + const code = fn(...args);
10 + return `\u001B[${38 + offset};5;${code}m`;
11 +};
12 +
13 +const wrapAnsi16m = (fn, offset) => (...args) => {
14 + const rgb = fn(...args);
15 + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
16 +};
17 +
18 +const ansi2ansi = n => n;
19 +const rgb2rgb = (r, g, b) => [r, g, b];
20 +
21 +const setLazyProperty = (object, property, get) => {
22 + Object.defineProperty(object, property, {
23 + get: () => {
24 + const value = get();
25 +
26 + Object.defineProperty(object, property, {
27 + value,
28 + enumerable: true,
29 + configurable: true
30 + });
31 +
32 + return value;
33 + },
34 + enumerable: true,
35 + configurable: true
36 + });
37 +};
38 +
39 +/** @type {typeof import('color-convert')} */
40 +let colorConvert;
41 +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
42 + if (colorConvert === undefined) {
43 + colorConvert = require('color-convert');
44 + }
45 +
46 + const offset = isBackground ? 10 : 0;
47 + const styles = {};
48 +
49 + for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
50 + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
51 + if (sourceSpace === targetSpace) {
52 + styles[name] = wrap(identity, offset);
53 + } else if (typeof suite === 'object') {
54 + styles[name] = wrap(suite[targetSpace], offset);
55 + }
56 + }
57 +
58 + return styles;
59 +};
60 +
61 +function assembleStyles() {
62 + const codes = new Map();
63 + const styles = {
64 + modifier: {
65 + reset: [0, 0],
66 + // 21 isn't widely supported and 22 does the same thing
67 + bold: [1, 22],
68 + dim: [2, 22],
69 + italic: [3, 23],
70 + underline: [4, 24],
71 + inverse: [7, 27],
72 + hidden: [8, 28],
73 + strikethrough: [9, 29]
74 + },
75 + color: {
76 + black: [30, 39],
77 + red: [31, 39],
78 + green: [32, 39],
79 + yellow: [33, 39],
80 + blue: [34, 39],
81 + magenta: [35, 39],
82 + cyan: [36, 39],
83 + white: [37, 39],
84 +
85 + // Bright color
86 + blackBright: [90, 39],
87 + redBright: [91, 39],
88 + greenBright: [92, 39],
89 + yellowBright: [93, 39],
90 + blueBright: [94, 39],
91 + magentaBright: [95, 39],
92 + cyanBright: [96, 39],
93 + whiteBright: [97, 39]
94 + },
95 + bgColor: {
96 + bgBlack: [40, 49],
97 + bgRed: [41, 49],
98 + bgGreen: [42, 49],
99 + bgYellow: [43, 49],
100 + bgBlue: [44, 49],
101 + bgMagenta: [45, 49],
102 + bgCyan: [46, 49],
103 + bgWhite: [47, 49],
104 +
105 + // Bright color
106 + bgBlackBright: [100, 49],
107 + bgRedBright: [101, 49],
108 + bgGreenBright: [102, 49],
109 + bgYellowBright: [103, 49],
110 + bgBlueBright: [104, 49],
111 + bgMagentaBright: [105, 49],
112 + bgCyanBright: [106, 49],
113 + bgWhiteBright: [107, 49]
114 + }
115 + };
116 +
117 + // Alias bright black as gray (and grey)
118 + styles.color.gray = styles.color.blackBright;
119 + styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
120 + styles.color.grey = styles.color.blackBright;
121 + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
122 +
123 + for (const [groupName, group] of Object.entries(styles)) {
124 + for (const [styleName, style] of Object.entries(group)) {
125 + styles[styleName] = {
126 + open: `\u001B[${style[0]}m`,
127 + close: `\u001B[${style[1]}m`
128 + };
129 +
130 + group[styleName] = styles[styleName];
131 +
132 + codes.set(style[0], style[1]);
133 + }
134 +
135 + Object.defineProperty(styles, groupName, {
136 + value: group,
137 + enumerable: false
138 + });
139 + }
140 +
141 + Object.defineProperty(styles, 'codes', {
142 + value: codes,
143 + enumerable: false
144 + });
145 +
146 + styles.color.close = '\u001B[39m';
147 + styles.bgColor.close = '\u001B[49m';
148 +
149 + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
150 + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
151 + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
152 + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
153 + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
154 + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
155 +
156 + return styles;
157 +}
158 +
159 +// Make the export immutable
160 +Object.defineProperty(module, 'exports', {
161 + enumerable: true,
162 + get: assembleStyles
163 +});
1 +MIT License
2 +
3 +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4 +
5 +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:
6 +
7 +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 +
9 +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.
1 +{
2 + "_from": "ansi-styles@^4.1.0",
3 + "_id": "ansi-styles@4.3.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
6 + "_location": "/ansi-styles",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "ansi-styles@^4.1.0",
12 + "name": "ansi-styles",
13 + "escapedName": "ansi-styles",
14 + "rawSpec": "^4.1.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^4.1.0"
17 + },
18 + "_requiredBy": [
19 + "/chalk"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
22 + "_shasum": "edd803628ae71c04c85ae7a0906edad34b648937",
23 + "_spec": "ansi-styles@^4.1.0",
24 + "_where": "/Users/mindyeoi/Desktop/oss/We-Shop/boiler-plate/node_modules/chalk",
25 + "author": {
26 + "name": "Sindre Sorhus",
27 + "email": "sindresorhus@gmail.com",
28 + "url": "sindresorhus.com"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/chalk/ansi-styles/issues"
32 + },
33 + "bundleDependencies": false,
34 + "dependencies": {
35 + "color-convert": "^2.0.1"
36 + },
37 + "deprecated": false,
38 + "description": "ANSI escape codes for styling strings in the terminal",
39 + "devDependencies": {
40 + "@types/color-convert": "^1.9.0",
41 + "ava": "^2.3.0",
42 + "svg-term-cli": "^2.1.1",
43 + "tsd": "^0.11.0",
44 + "xo": "^0.25.3"
45 + },
46 + "engines": {
47 + "node": ">=8"
48 + },
49 + "files": [
50 + "index.js",
51 + "index.d.ts"
52 + ],
53 + "funding": "https://github.com/chalk/ansi-styles?sponsor=1",
54 + "homepage": "https://github.com/chalk/ansi-styles#readme",
55 + "keywords": [
56 + "ansi",
57 + "styles",
58 + "color",
59 + "colour",
60 + "colors",
61 + "terminal",
62 + "console",
63 + "cli",
64 + "string",
65 + "tty",
66 + "escape",
67 + "formatting",
68 + "rgb",
69 + "256",
70 + "shell",
71 + "xterm",
72 + "log",
73 + "logging",
74 + "command-line",
75 + "text"
76 + ],
77 + "license": "MIT",
78 + "name": "ansi-styles",
79 + "repository": {
80 + "type": "git",
81 + "url": "git+https://github.com/chalk/ansi-styles.git"
82 + },
83 + "scripts": {
84 + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor",
85 + "test": "xo && ava && tsd"
86 + },
87 + "version": "4.3.0"
88 +}
1 +# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
2 +
3 +> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
4 +
5 +You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
6 +
7 +<img src="screenshot.svg" width="900">
8 +
9 +## Install
10 +
11 +```
12 +$ npm install ansi-styles
13 +```
14 +
15 +## Usage
16 +
17 +```js
18 +const style = require('ansi-styles');
19 +
20 +console.log(`${style.green.open}Hello world!${style.green.close}`);
21 +
22 +
23 +// Color conversion between 16/256/truecolor
24 +// NOTE: If conversion goes to 16 colors or 256 colors, the original color
25 +// may be degraded to fit that color palette. This means terminals
26 +// that do not support 16 million colors will best-match the
27 +// original color.
28 +console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
29 +console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
30 +console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close);
31 +```
32 +
33 +## API
34 +
35 +Each style has an `open` and `close` property.
36 +
37 +## Styles
38 +
39 +### Modifiers
40 +
41 +- `reset`
42 +- `bold`
43 +- `dim`
44 +- `italic` *(Not widely supported)*
45 +- `underline`
46 +- `inverse`
47 +- `hidden`
48 +- `strikethrough` *(Not widely supported)*
49 +
50 +### Colors
51 +
52 +- `black`
53 +- `red`
54 +- `green`
55 +- `yellow`
56 +- `blue`
57 +- `magenta`
58 +- `cyan`
59 +- `white`
60 +- `blackBright` (alias: `gray`, `grey`)
61 +- `redBright`
62 +- `greenBright`
63 +- `yellowBright`
64 +- `blueBright`
65 +- `magentaBright`
66 +- `cyanBright`
67 +- `whiteBright`
68 +
69 +### Background colors
70 +
71 +- `bgBlack`
72 +- `bgRed`
73 +- `bgGreen`
74 +- `bgYellow`
75 +- `bgBlue`
76 +- `bgMagenta`
77 +- `bgCyan`
78 +- `bgWhite`
79 +- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
80 +- `bgRedBright`
81 +- `bgGreenBright`
82 +- `bgYellowBright`
83 +- `bgBlueBright`
84 +- `bgMagentaBright`
85 +- `bgCyanBright`
86 +- `bgWhiteBright`
87 +
88 +## Advanced usage
89 +
90 +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.
91 +
92 +- `style.modifier`
93 +- `style.color`
94 +- `style.bgColor`
95 +
96 +###### Example
97 +
98 +```js
99 +console.log(style.color.green.open);
100 +```
101 +
102 +Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
103 +
104 +###### Example
105 +
106 +```js
107 +console.log(style.codes.get(36));
108 +//=> 39
109 +```
110 +
111 +## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
112 +
113 +`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
114 +
115 +The following color spaces from `color-convert` are supported:
116 +
117 +- `rgb`
118 +- `hex`
119 +- `keyword`
120 +- `hsl`
121 +- `hsv`
122 +- `hwb`
123 +- `ansi`
124 +- `ansi256`
125 +
126 +To use these, call the associated conversion function with the intended output, for example:
127 +
128 +```js
129 +style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
130 +style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
131 +
132 +style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
133 +style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
134 +
135 +style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
136 +style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
137 +```
138 +
139 +## Related
140 +
141 +- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
142 +
143 +## Maintainers
144 +
145 +- [Sindre Sorhus](https://github.com/sindresorhus)
146 +- [Josh Junon](https://github.com/qix-)
147 +
148 +## For enterprise
149 +
150 +Available as part of the Tidelift Subscription.
151 +
152 +The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
1 +The ISC License
2 +
3 +Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com)
4 +
5 +Permission to use, copy, modify, and/or distribute this software for any
6 +purpose with or without fee is hereby granted, provided that the above
7 +copyright notice and this permission notice appear in all copies.
8 +
9 +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15 +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1 +anymatch [![Build Status](https://travis-ci.org/micromatch/anymatch.svg?branch=master)](https://travis-ci.org/micromatch/anymatch) [![Coverage Status](https://img.shields.io/coveralls/micromatch/anymatch.svg?branch=master)](https://coveralls.io/r/micromatch/anymatch?branch=master)
2 +======
3 +Javascript module to match a string against a regular expression, glob, string,
4 +or function that takes the string as an argument and returns a truthy or falsy
5 +value. The matcher can also be an array of any or all of these. Useful for
6 +allowing a very flexible user-defined config to define things like file paths.
7 +
8 +__Note: This module has Bash-parity, please be aware that Windows-style backslashes are not supported as separators. See https://github.com/micromatch/micromatch#backslashes for more information.__
9 +
10 +
11 +Usage
12 +-----
13 +```sh
14 +npm install anymatch
15 +```
16 +
17 +#### anymatch(matchers, testString, [returnIndex], [options])
18 +* __matchers__: (_Array|String|RegExp|Function_)
19 +String to be directly matched, string with glob patterns, regular expression
20 +test, function that takes the testString as an argument and returns a truthy
21 +value if it should be matched, or an array of any number and mix of these types.
22 +* __testString__: (_String|Array_) The string to test against the matchers. If
23 +passed as an array, the first element of the array will be used as the
24 +`testString` for non-function matchers, while the entire array will be applied
25 +as the arguments for function matchers.
26 +* __options__: (_Object_ [optional]_) Any of the [picomatch](https://github.com/micromatch/picomatch#options) options.
27 + * __returnIndex__: (_Boolean [optional]_) If true, return the array index of
28 +the first matcher that that testString matched, or -1 if no match, instead of a
29 +boolean result.
30 +
31 +```js
32 +const anymatch = require('anymatch');
33 +
34 +const matchers = [ 'path/to/file.js', 'path/anyjs/**/*.js', /foo.js$/, string => string.includes('bar') && string.length > 10 ] ;
35 +
36 +anymatch(matchers, 'path/to/file.js'); // true
37 +anymatch(matchers, 'path/anyjs/baz.js'); // true
38 +anymatch(matchers, 'path/to/foo.js'); // true
39 +anymatch(matchers, 'path/to/bar.js'); // true
40 +anymatch(matchers, 'bar.js'); // false
41 +
42 +// returnIndex = true
43 +anymatch(matchers, 'foo.js', {returnIndex: true}); // 2
44 +anymatch(matchers, 'path/anyjs/foo.js', {returnIndex: true}); // 1
45 +
46 +// any picomatc
47 +
48 +// using globs to match directories and their children
49 +anymatch('node_modules', 'node_modules'); // true
50 +anymatch('node_modules', 'node_modules/somelib/index.js'); // false
51 +anymatch('node_modules/**', 'node_modules/somelib/index.js'); // true
52 +anymatch('node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // false
53 +anymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // true
54 +
55 +const matcher = anymatch(matchers);
56 +['foo.js', 'bar.js'].filter(matcher); // [ 'foo.js' ]
57 +anymatch master*
58 +
59 +```
60 +
61 +#### anymatch(matchers)
62 +You can also pass in only your matcher(s) to get a curried function that has
63 +already been bound to the provided matching criteria. This can be used as an
64 +`Array#filter` callback.
65 +
66 +```js
67 +var matcher = anymatch(matchers);
68 +
69 +matcher('path/to/file.js'); // true
70 +matcher('path/anyjs/baz.js', true); // 1
71 +
72 +['foo.js', 'bar.js'].filter(matcher); // ['foo.js']
73 +```
74 +
75 +Changelog
76 +----------
77 +[See release notes page on GitHub](https://github.com/micromatch/anymatch/releases)
78 +
79 +- **v3.0:** Removed `startIndex` and `endIndex` arguments. Node 8.x-only.
80 +- **v2.0:** [micromatch](https://github.com/jonschlinkert/micromatch) moves away from minimatch-parity and inline with Bash. This includes handling backslashes differently (see https://github.com/micromatch/micromatch#backslashes for more information).
81 +- **v1.2:** anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch)
82 +for glob pattern matching. Issues with glob pattern matching should be
83 +reported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues).
84 +
85 +License
86 +-------
87 +[ISC](https://raw.github.com/micromatch/anymatch/master/LICENSE)
1 +type AnymatchFn = (testString: string) => boolean;
2 +type AnymatchPattern = string|RegExp|AnymatchFn;
3 +type AnymatchMatcher = AnymatchPattern|AnymatchPattern[]
4 +type AnymatchTester = {
5 + (testString: string|any[], returnIndex: true): number;
6 + (testString: string|any[]): boolean;
7 +}
8 +
9 +type PicomatchOptions = {dot: boolean};
10 +
11 +declare const anymatch: {
12 + (matchers: AnymatchMatcher): AnymatchTester;
13 + (matchers: AnymatchMatcher, testString: string|any[], returnIndex: true | PicomatchOptions): number;
14 + (matchers: AnymatchMatcher, testString: string|any[]): boolean;
15 +}
16 +
17 +export {AnymatchMatcher as Matcher}
18 +export {AnymatchTester as Tester}
19 +export default anymatch
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", { value: true });
4 +
5 +const picomatch = require('picomatch');
6 +const normalizePath = require('normalize-path');
7 +
8 +/**
9 + * @typedef {(testString: string) => boolean} AnymatchFn
10 + * @typedef {string|RegExp|AnymatchFn} AnymatchPattern
11 + * @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher
12 + */
13 +const BANG = '!';
14 +const DEFAULT_OPTIONS = {returnIndex: false};
15 +const arrify = (item) => Array.isArray(item) ? item : [item];
16 +
17 +/**
18 + * @param {AnymatchPattern} matcher
19 + * @param {object} options
20 + * @returns {AnymatchFn}
21 + */
22 +const createPattern = (matcher, options) => {
23 + if (typeof matcher === 'function') {
24 + return matcher;
25 + }
26 + if (typeof matcher === 'string') {
27 + const glob = picomatch(matcher, options);
28 + return (string) => matcher === string || glob(string);
29 + }
30 + if (matcher instanceof RegExp) {
31 + return (string) => matcher.test(string);
32 + }
33 + return (string) => false;
34 +};
35 +
36 +/**
37 + * @param {Array<Function>} patterns
38 + * @param {Array<Function>} negPatterns
39 + * @param {String|Array} args
40 + * @param {Boolean} returnIndex
41 + * @returns {boolean|number}
42 + */
43 +const matchPatterns = (patterns, negPatterns, args, returnIndex) => {
44 + const isList = Array.isArray(args);
45 + const _path = isList ? args[0] : args;
46 + if (!isList && typeof _path !== 'string') {
47 + throw new TypeError('anymatch: second argument must be a string: got ' +
48 + Object.prototype.toString.call(_path))
49 + }
50 + const path = normalizePath(_path);
51 +
52 + for (let index = 0; index < negPatterns.length; index++) {
53 + const nglob = negPatterns[index];
54 + if (nglob(path)) {
55 + return returnIndex ? -1 : false;
56 + }
57 + }
58 +
59 + const applied = isList && [path].concat(args.slice(1));
60 + for (let index = 0; index < patterns.length; index++) {
61 + const pattern = patterns[index];
62 + if (isList ? pattern(...applied) : pattern(path)) {
63 + return returnIndex ? index : true;
64 + }
65 + }
66 +
67 + return returnIndex ? -1 : false;
68 +};
69 +
70 +/**
71 + * @param {AnymatchMatcher} matchers
72 + * @param {Array|string} testString
73 + * @param {object} options
74 + * @returns {boolean|number|Function}
75 + */
76 +const anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => {
77 + if (matchers == null) {
78 + throw new TypeError('anymatch: specify first argument');
79 + }
80 + const opts = typeof options === 'boolean' ? {returnIndex: options} : options;
81 + const returnIndex = opts.returnIndex || false;
82 +
83 + // Early cache for matchers.
84 + const mtchers = arrify(matchers);
85 + const negatedGlobs = mtchers
86 + .filter(item => typeof item === 'string' && item.charAt(0) === BANG)
87 + .map(item => item.slice(1))
88 + .map(item => picomatch(item, opts));
89 + const patterns = mtchers
90 + .filter(item => typeof item !== 'string' || (typeof item === 'string' && item.charAt(0) !== BANG))
91 + .map(matcher => createPattern(matcher, opts));
92 +
93 + if (testString == null) {
94 + return (testString, ri = false) => {
95 + const returnIndex = typeof ri === 'boolean' ? ri : false;
96 + return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
97 + }
98 + }
99 +
100 + return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
101 +};
102 +
103 +anymatch.default = anymatch;
104 +module.exports = anymatch;
1 +{
2 + "_from": "anymatch@~3.1.1",
3 + "_id": "anymatch@3.1.2",
4 + "_inBundle": false,
5 + "_integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
6 + "_location": "/anymatch",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "anymatch@~3.1.1",
12 + "name": "anymatch",
13 + "escapedName": "anymatch",
14 + "rawSpec": "~3.1.1",
15 + "saveSpec": null,
16 + "fetchSpec": "~3.1.1"
17 + },
18 + "_requiredBy": [
19 + "/chokidar"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
22 + "_shasum": "c0557c096af32f106198f4f4e2a383537e378716",
23 + "_spec": "anymatch@~3.1.1",
24 + "_where": "/Users/mindyeoi/Desktop/oss/We-Shop/boiler-plate/node_modules/chokidar",
25 + "author": {
26 + "name": "Elan Shanker",
27 + "url": "https://github.com/es128"
28 + },
29 + "bugs": {
30 + "url": "https://github.com/micromatch/anymatch/issues"
31 + },
32 + "bundleDependencies": false,
33 + "dependencies": {
34 + "normalize-path": "^3.0.0",
35 + "picomatch": "^2.0.4"
36 + },
37 + "deprecated": false,
38 + "description": "Matches strings against configurable strings, globs, regular expressions, and/or functions",
39 + "devDependencies": {
40 + "mocha": "^6.1.3",
41 + "nyc": "^14.0.0"
42 + },
43 + "engines": {
44 + "node": ">= 8"
45 + },
46 + "files": [
47 + "index.js",
48 + "index.d.ts"
49 + ],
50 + "homepage": "https://github.com/micromatch/anymatch",
51 + "keywords": [
52 + "match",
53 + "any",
54 + "string",
55 + "file",
56 + "fs",
57 + "list",
58 + "glob",
59 + "regex",
60 + "regexp",
61 + "regular",
62 + "expression",
63 + "function"
64 + ],
65 + "license": "ISC",
66 + "name": "anymatch",
67 + "repository": {
68 + "type": "git",
69 + "url": "git+https://github.com/micromatch/anymatch.git"
70 + },
71 + "scripts": {
72 + "mocha": "mocha",
73 + "test": "nyc mocha"
74 + },
75 + "version": "3.1.2"
76 +}
1 +tidelift: "npm/balanced-match"
2 +patreon: juliangruber
1 +(MIT)
2 +
3 +Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy of
6 +this software and associated documentation files (the "Software"), to deal in
7 +the Software without restriction, including without limitation the rights to
8 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9 +of the Software, and to permit persons to whom the Software is furnished to do
10 +so, subject to the following conditions:
11 +
12 +The above copyright notice and this permission notice shall be included in all
13 +copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 +SOFTWARE.
1 +# balanced-match
2 +
3 +Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
4 +
5 +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match)
6 +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match)
7 +
8 +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match)
9 +
10 +## Example
11 +
12 +Get the first matching pair of braces:
13 +
14 +```js
15 +var balanced = require('balanced-match');
16 +
17 +console.log(balanced('{', '}', 'pre{in{nested}}post'));
18 +console.log(balanced('{', '}', 'pre{first}between{second}post'));
19 +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'));
20 +```
21 +
22 +The matches are:
23 +
24 +```bash
25 +$ node example.js
26 +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
27 +{ start: 3,
28 + end: 9,
29 + pre: 'pre',
30 + body: 'first',
31 + post: 'between{second}post' }
32 +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
33 +```
34 +
35 +## API
36 +
37 +### var m = balanced(a, b, str)
38 +
39 +For the first non-nested matching pair of `a` and `b` in `str`, return an
40 +object with those keys:
41 +
42 +* **start** the index of the first match of `a`
43 +* **end** the index of the matching `b`
44 +* **pre** the preamble, `a` and `b` not included
45 +* **body** the match, `a` and `b` not included
46 +* **post** the postscript, `a` and `b` not included
47 +
48 +If there's no match, `undefined` will be returned.
49 +
50 +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', '}']`.
51 +
52 +### var r = balanced.range(a, b, str)
53 +
54 +For the first non-nested matching pair of `a` and `b` in `str`, return an
55 +array with indexes: `[ <a index>, <b index> ]`.
56 +
57 +If there's no match, `undefined` will be returned.
58 +
59 +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]`.
60 +
61 +## Installation
62 +
63 +With [npm](https://npmjs.org) do:
64 +
65 +```bash
66 +npm install balanced-match
67 +```
68 +
69 +## Security contact information
70 +
71 +To report a security vulnerability, please use the
72 +[Tidelift security contact](https://tidelift.com/security).
73 +Tidelift will coordinate the fix and disclosure.
74 +
75 +## License
76 +
77 +(MIT)
78 +
79 +Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
80 +
81 +Permission is hereby granted, free of charge, to any person obtaining a copy of
82 +this software and associated documentation files (the "Software"), to deal in
83 +the Software without restriction, including without limitation the rights to
84 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
85 +of the Software, and to permit persons to whom the Software is furnished to do
86 +so, subject to the following conditions:
87 +
88 +The above copyright notice and this permission notice shall be included in all
89 +copies or substantial portions of the Software.
90 +
91 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
92 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
93 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
94 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
95 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
96 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
97 +SOFTWARE.
1 +'use strict';
2 +module.exports = balanced;
3 +function balanced(a, b, str) {
4 + if (a instanceof RegExp) a = maybeMatch(a, str);
5 + if (b instanceof RegExp) b = maybeMatch(b, str);
6 +
7 + var r = range(a, b, str);
8 +
9 + return r && {
10 + start: r[0],
11 + end: r[1],
12 + pre: str.slice(0, r[0]),
13 + body: str.slice(r[0] + a.length, r[1]),
14 + post: str.slice(r[1] + b.length)
15 + };
16 +}
17 +
18 +function maybeMatch(reg, str) {
19 + var m = str.match(reg);
20 + return m ? m[0] : null;
21 +}
22 +
23 +balanced.range = range;
24 +function range(a, b, str) {
25 + var begs, beg, left, right, result;
26 + var ai = str.indexOf(a);
27 + var bi = str.indexOf(b, ai + 1);
28 + var i = ai;
29 +
30 + if (ai >= 0 && bi > 0) {
31 + if(a===b) {
32 + return [ai, bi];
33 + }
34 + begs = [];
35 + left = str.length;
36 +
37 + while (i >= 0 && !result) {
38 + if (i == ai) {
39 + begs.push(i);
40 + ai = str.indexOf(a, i + 1);
41 + } else if (begs.length == 1) {
42 + result = [ begs.pop(), bi ];
43 + } else {
44 + beg = begs.pop();
45 + if (beg < left) {
46 + left = beg;
47 + right = bi;
48 + }
49 +
50 + bi = str.indexOf(b, i + 1);
51 + }
52 +
53 + i = ai < bi && ai >= 0 ? ai : bi;
54 + }
55 +
56 + if (begs.length) {
57 + result = [ left, right ];
58 + }
59 + }
60 +
61 + return result;
62 +}
1 +{
2 + "_from": "balanced-match@^1.0.0",
3 + "_id": "balanced-match@1.0.2",
4 + "_inBundle": false,
5 + "_integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
6 + "_location": "/balanced-match",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "balanced-match@^1.0.0",
12 + "name": "balanced-match",
13 + "escapedName": "balanced-match",
14 + "rawSpec": "^1.0.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^1.0.0"
17 + },
18 + "_requiredBy": [
19 + "/brace-expansion"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
22 + "_shasum": "e83e3a7e3f300b34cb9d87f615fa0cbf357690ee",
23 + "_spec": "balanced-match@^1.0.0",
24 + "_where": "/Users/mindyeoi/Desktop/oss/We-Shop/boiler-plate/node_modules/brace-expansion",
25 + "author": {
26 + "name": "Julian Gruber",
27 + "email": "mail@juliangruber.com",
28 + "url": "http://juliangruber.com"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/juliangruber/balanced-match/issues"
32 + },
33 + "bundleDependencies": false,
34 + "deprecated": false,
35 + "description": "Match balanced character pairs, like \"{\" and \"}\"",
36 + "devDependencies": {
37 + "matcha": "^0.7.0",
38 + "tape": "^4.6.0"
39 + },
40 + "homepage": "https://github.com/juliangruber/balanced-match",
41 + "keywords": [
42 + "match",
43 + "regexp",
44 + "test",
45 + "balanced",
46 + "parse"
47 + ],
48 + "license": "MIT",
49 + "main": "index.js",
50 + "name": "balanced-match",
51 + "repository": {
52 + "type": "git",
53 + "url": "git://github.com/juliangruber/balanced-match.git"
54 + },
55 + "scripts": {
56 + "bench": "matcha test/bench.js",
57 + "test": "tape test/test.js"
58 + },
59 + "testling": {
60 + "files": "test/*.js",
61 + "browsers": [
62 + "ie/8..latest",
63 + "firefox/20..latest",
64 + "firefox/nightly",
65 + "chrome/25..latest",
66 + "chrome/canary",
67 + "opera/12..latest",
68 + "opera/next",
69 + "safari/5.1..latest",
70 + "ipad/6.0..latest",
71 + "iphone/6.0..latest",
72 + "android-browser/4.2..latest"
73 + ]
74 + },
75 + "version": "1.0.2"
76 +}
1 +[
2 + "3dm",
3 + "3ds",
4 + "3g2",
5 + "3gp",
6 + "7z",
7 + "a",
8 + "aac",
9 + "adp",
10 + "ai",
11 + "aif",
12 + "aiff",
13 + "alz",
14 + "ape",
15 + "apk",
16 + "appimage",
17 + "ar",
18 + "arj",
19 + "asf",
20 + "au",
21 + "avi",
22 + "bak",
23 + "baml",
24 + "bh",
25 + "bin",
26 + "bk",
27 + "bmp",
28 + "btif",
29 + "bz2",
30 + "bzip2",
31 + "cab",
32 + "caf",
33 + "cgm",
34 + "class",
35 + "cmx",
36 + "cpio",
37 + "cr2",
38 + "cur",
39 + "dat",
40 + "dcm",
41 + "deb",
42 + "dex",
43 + "djvu",
44 + "dll",
45 + "dmg",
46 + "dng",
47 + "doc",
48 + "docm",
49 + "docx",
50 + "dot",
51 + "dotm",
52 + "dra",
53 + "DS_Store",
54 + "dsk",
55 + "dts",
56 + "dtshd",
57 + "dvb",
58 + "dwg",
59 + "dxf",
60 + "ecelp4800",
61 + "ecelp7470",
62 + "ecelp9600",
63 + "egg",
64 + "eol",
65 + "eot",
66 + "epub",
67 + "exe",
68 + "f4v",
69 + "fbs",
70 + "fh",
71 + "fla",
72 + "flac",
73 + "flatpak",
74 + "fli",
75 + "flv",
76 + "fpx",
77 + "fst",
78 + "fvt",
79 + "g3",
80 + "gh",
81 + "gif",
82 + "graffle",
83 + "gz",
84 + "gzip",
85 + "h261",
86 + "h263",
87 + "h264",
88 + "icns",
89 + "ico",
90 + "ief",
91 + "img",
92 + "ipa",
93 + "iso",
94 + "jar",
95 + "jpeg",
96 + "jpg",
97 + "jpgv",
98 + "jpm",
99 + "jxr",
100 + "key",
101 + "ktx",
102 + "lha",
103 + "lib",
104 + "lvp",
105 + "lz",
106 + "lzh",
107 + "lzma",
108 + "lzo",
109 + "m3u",
110 + "m4a",
111 + "m4v",
112 + "mar",
113 + "mdi",
114 + "mht",
115 + "mid",
116 + "midi",
117 + "mj2",
118 + "mka",
119 + "mkv",
120 + "mmr",
121 + "mng",
122 + "mobi",
123 + "mov",
124 + "movie",
125 + "mp3",
126 + "mp4",
127 + "mp4a",
128 + "mpeg",
129 + "mpg",
130 + "mpga",
131 + "mxu",
132 + "nef",
133 + "npx",
134 + "numbers",
135 + "nupkg",
136 + "o",
137 + "odp",
138 + "ods",
139 + "odt",
140 + "oga",
141 + "ogg",
142 + "ogv",
143 + "otf",
144 + "ott",
145 + "pages",
146 + "pbm",
147 + "pcx",
148 + "pdb",
149 + "pdf",
150 + "pea",
151 + "pgm",
152 + "pic",
153 + "png",
154 + "pnm",
155 + "pot",
156 + "potm",
157 + "potx",
158 + "ppa",
159 + "ppam",
160 + "ppm",
161 + "pps",
162 + "ppsm",
163 + "ppsx",
164 + "ppt",
165 + "pptm",
166 + "pptx",
167 + "psd",
168 + "pya",
169 + "pyc",
170 + "pyo",
171 + "pyv",
172 + "qt",
173 + "rar",
174 + "ras",
175 + "raw",
176 + "resources",
177 + "rgb",
178 + "rip",
179 + "rlc",
180 + "rmf",
181 + "rmvb",
182 + "rpm",
183 + "rtf",
184 + "rz",
185 + "s3m",
186 + "s7z",
187 + "scpt",
188 + "sgi",
189 + "shar",
190 + "snap",
191 + "sil",
192 + "sketch",
193 + "slk",
194 + "smv",
195 + "snk",
196 + "so",
197 + "stl",
198 + "suo",
199 + "sub",
200 + "swf",
201 + "tar",
202 + "tbz",
203 + "tbz2",
204 + "tga",
205 + "tgz",
206 + "thmx",
207 + "tif",
208 + "tiff",
209 + "tlz",
210 + "ttc",
211 + "ttf",
212 + "txz",
213 + "udf",
214 + "uvh",
215 + "uvi",
216 + "uvm",
217 + "uvp",
218 + "uvs",
219 + "uvu",
220 + "viv",
221 + "vob",
222 + "war",
223 + "wav",
224 + "wax",
225 + "wbmp",
226 + "wdp",
227 + "weba",
228 + "webm",
229 + "webp",
230 + "whl",
231 + "wim",
232 + "wm",
233 + "wma",
234 + "wmv",
235 + "wmx",
236 + "woff",
237 + "woff2",
238 + "wrm",
239 + "wvx",
240 + "xbm",
241 + "xif",
242 + "xla",
243 + "xlam",
244 + "xls",
245 + "xlsb",
246 + "xlsm",
247 + "xlsx",
248 + "xlt",
249 + "xltm",
250 + "xltx",
251 + "xm",
252 + "xmind",
253 + "xpi",
254 + "xpm",
255 + "xwd",
256 + "xz",
257 + "z",
258 + "zip",
259 + "zipx"
260 +]
1 +declare const binaryExtensionsJson: readonly string[];
2 +
3 +export = binaryExtensionsJson;
1 +/**
2 +List of binary file extensions.
3 +
4 +@example
5 +```
6 +import binaryExtensions = require('binary-extensions');
7 +
8 +console.log(binaryExtensions);
9 +//=> ['3ds', '3g2', …]
10 +```
11 +*/
12 +declare const binaryExtensions: readonly string[];
13 +
14 +export = binaryExtensions;
1 +module.exports = require('./binary-extensions.json');
1 +MIT License
2 +
3 +Copyright (c) 2019 Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com), Paul Miller (https://paulmillr.com)
4 +
5 +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:
6 +
7 +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 +
9 +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.
1 +{
2 + "_from": "binary-extensions@^2.0.0",
3 + "_id": "binary-extensions@2.2.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
6 + "_location": "/binary-extensions",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "binary-extensions@^2.0.0",
12 + "name": "binary-extensions",
13 + "escapedName": "binary-extensions",
14 + "rawSpec": "^2.0.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^2.0.0"
17 + },
18 + "_requiredBy": [
19 + "/is-binary-path"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
22 + "_shasum": "75f502eeaf9ffde42fc98829645be4ea76bd9e2d",
23 + "_spec": "binary-extensions@^2.0.0",
24 + "_where": "/Users/mindyeoi/Desktop/oss/We-Shop/boiler-plate/node_modules/is-binary-path",
25 + "author": {
26 + "name": "Sindre Sorhus",
27 + "email": "sindresorhus@gmail.com",
28 + "url": "sindresorhus.com"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/sindresorhus/binary-extensions/issues"
32 + },
33 + "bundleDependencies": false,
34 + "deprecated": false,
35 + "description": "List of binary file extensions",
36 + "devDependencies": {
37 + "ava": "^1.4.1",
38 + "tsd": "^0.7.2",
39 + "xo": "^0.24.0"
40 + },
41 + "engines": {
42 + "node": ">=8"
43 + },
44 + "files": [
45 + "index.js",
46 + "index.d.ts",
47 + "binary-extensions.json",
48 + "binary-extensions.json.d.ts"
49 + ],
50 + "homepage": "https://github.com/sindresorhus/binary-extensions#readme",
51 + "keywords": [
52 + "binary",
53 + "extensions",
54 + "extension",
55 + "file",
56 + "json",
57 + "list",
58 + "array"
59 + ],
60 + "license": "MIT",
61 + "name": "binary-extensions",
62 + "repository": {
63 + "type": "git",
64 + "url": "git+https://github.com/sindresorhus/binary-extensions.git"
65 + },
66 + "scripts": {
67 + "test": "xo && ava && tsd"
68 + },
69 + "version": "2.2.0"
70 +}
1 +# binary-extensions
2 +
3 +> List of binary file extensions
4 +
5 +The list is just a [JSON file](binary-extensions.json) and can be used anywhere.
6 +
7 +
8 +## Install
9 +
10 +```
11 +$ npm install binary-extensions
12 +```
13 +
14 +
15 +## Usage
16 +
17 +```js
18 +const binaryExtensions = require('binary-extensions');
19 +
20 +console.log(binaryExtensions);
21 +//=> ['3ds', '3g2', …]
22 +```
23 +
24 +
25 +## Related
26 +
27 +- [is-binary-path](https://github.com/sindresorhus/is-binary-path) - Check if a filepath is a binary file
28 +- [text-extensions](https://github.com/sindresorhus/text-extensions) - List of text file extensions
29 +
30 +
31 +---
32 +
33 +<div align="center">
34 + <b>
35 + <a href="https://tidelift.com/subscription/pkg/npm-binary-extensions?utm_source=npm-binary-extensions&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
36 + </b>
37 + <br>
38 + <sub>
39 + Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
40 + </sub>
41 +</div>
1 +import {LiteralUnion} from 'type-fest';
2 +import cliBoxes, {BoxStyle} from 'cli-boxes';
3 +
4 +declare namespace boxen {
5 + /**
6 + Characters used for custom border.
7 +
8 + @example
9 + ```
10 + // affffb
11 + // e e
12 + // dffffc
13 +
14 + const border: CustomBorderStyle = {
15 + topLeft: 'a',
16 + topRight: 'b',
17 + bottomRight: 'c',
18 + bottomLeft: 'd',
19 + vertical: 'e',
20 + horizontal: 'f'
21 + };
22 + ```
23 + */
24 + interface CustomBorderStyle extends BoxStyle {}
25 +
26 + /**
27 + Spacing used for `padding` and `margin`.
28 + */
29 + interface Spacing {
30 + readonly top: number;
31 + readonly right: number;
32 + readonly bottom: number;
33 + readonly left: number;
34 + }
35 +
36 + interface Options {
37 + /**
38 + Color of the box border.
39 + */
40 + readonly borderColor?: LiteralUnion<
41 + | 'black'
42 + | 'red'
43 + | 'green'
44 + | 'yellow'
45 + | 'blue'
46 + | 'magenta'
47 + | 'cyan'
48 + | 'white'
49 + | 'gray'
50 + | 'grey'
51 + | 'blackBright'
52 + | 'redBright'
53 + | 'greenBright'
54 + | 'yellowBright'
55 + | 'blueBright'
56 + | 'magentaBright'
57 + | 'cyanBright'
58 + | 'whiteBright',
59 + string
60 + >;
61 +
62 + /**
63 + Style of the box border.
64 +
65 + @default BorderStyle.Single
66 + */
67 + readonly borderStyle?: BorderStyle | CustomBorderStyle;
68 +
69 + /**
70 + Reduce opacity of the border.
71 +
72 + @default false
73 + */
74 + readonly dimBorder?: boolean;
75 +
76 + /**
77 + Space between the text and box border.
78 +
79 + @default 0
80 + */
81 + readonly padding?: number | Spacing;
82 +
83 + /**
84 + Space around the box.
85 +
86 + @default 0
87 + */
88 + readonly margin?: number | Spacing;
89 +
90 + /**
91 + Float the box on the available terminal screen space.
92 +
93 + @default 'left'
94 + */
95 + readonly float?: 'left' | 'right' | 'center';
96 +
97 + /**
98 + Color of the background.
99 + */
100 + readonly backgroundColor?: LiteralUnion<
101 + | 'black'
102 + | 'red'
103 + | 'green'
104 + | 'yellow'
105 + | 'blue'
106 + | 'magenta'
107 + | 'cyan'
108 + | 'white'
109 + | 'blackBright'
110 + | 'redBright'
111 + | 'greenBright'
112 + | 'yellowBright'
113 + | 'blueBright'
114 + | 'magentaBright'
115 + | 'cyanBright'
116 + | 'whiteBright',
117 + string
118 + >;
119 +
120 + /**
121 + Align the text in the box based on the widest line.
122 +
123 + @default 'left'
124 + */
125 + readonly align?: 'left' | 'right' | 'center';
126 + }
127 +}
128 +
129 +declare const enum BorderStyle {
130 + Single = 'single',
131 + Double = 'double',
132 + Round = 'round',
133 + Bold = 'bold',
134 + SingleDouble = 'singleDouble',
135 + DoubleSingle = 'doubleSingle',
136 + Classic = 'classic'
137 +}
138 +
139 +declare const boxen: {
140 + /**
141 + Creates a box in the terminal.
142 +
143 + @param text - The text inside the box.
144 + @returns The box.
145 +
146 + @example
147 + ```
148 + import boxen = require('boxen');
149 +
150 + console.log(boxen('unicorn', {padding: 1}));
151 + // ┌─────────────┐
152 + // │ │
153 + // │ unicorn │
154 + // │ │
155 + // └─────────────┘
156 +
157 + console.log(boxen('unicorn', {padding: 1, margin: 1, borderStyle: 'double'}));
158 + //
159 + // ╔═════════════╗
160 + // ║ ║
161 + // ║ unicorn ║
162 + // ║ ║
163 + // ╚═════════════╝
164 + //
165 + ```
166 + */
167 + (text: string, options?: boxen.Options): string;
168 +
169 + /**
170 + Border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-boxes).
171 + */
172 + BorderStyle: typeof BorderStyle;
173 +};
174 +
175 +export = boxen;
1 +'use strict';
2 +const stringWidth = require('string-width');
3 +const chalk = require('chalk');
4 +const widestLine = require('widest-line');
5 +const cliBoxes = require('cli-boxes');
6 +const camelCase = require('camelcase');
7 +const ansiAlign = require('ansi-align');
8 +const termSize = require('term-size');
9 +
10 +const getObject = detail => {
11 + let object;
12 +
13 + if (typeof detail === 'number') {
14 + object = {
15 + top: detail,
16 + right: detail * 3,
17 + bottom: detail,
18 + left: detail * 3
19 + };
20 + } else {
21 + object = {
22 + top: 0,
23 + right: 0,
24 + bottom: 0,
25 + left: 0,
26 + ...detail
27 + };
28 + }
29 +
30 + return object;
31 +};
32 +
33 +const getBorderChars = borderStyle => {
34 + const sides = [
35 + 'topLeft',
36 + 'topRight',
37 + 'bottomRight',
38 + 'bottomLeft',
39 + 'vertical',
40 + 'horizontal'
41 + ];
42 +
43 + let chararacters;
44 +
45 + if (typeof borderStyle === 'string') {
46 + chararacters = cliBoxes[borderStyle];
47 +
48 + if (!chararacters) {
49 + throw new TypeError(`Invalid border style: ${borderStyle}`);
50 + }
51 + } else {
52 + for (const side of sides) {
53 + if (!borderStyle[side] || typeof borderStyle[side] !== 'string') {
54 + throw new TypeError(`Invalid border style: ${side}`);
55 + }
56 + }
57 +
58 + chararacters = borderStyle;
59 + }
60 +
61 + return chararacters;
62 +};
63 +
64 +const isHex = color => color.match(/^#[0-f]{3}(?:[0-f]{3})?$/i);
65 +const isColorValid = color => typeof color === 'string' && ((chalk[color]) || isHex(color));
66 +const getColorFn = color => isHex(color) ? chalk.hex(color) : chalk[color];
67 +const getBGColorFn = color => isHex(color) ? chalk.bgHex(color) : chalk[camelCase(['bg', color])];
68 +
69 +module.exports = (text, options) => {
70 + options = {
71 + padding: 0,
72 + borderStyle: 'single',
73 + dimBorder: false,
74 + align: 'left',
75 + float: 'left',
76 + ...options
77 + };
78 +
79 + if (options.borderColor && !isColorValid(options.borderColor)) {
80 + throw new Error(`${options.borderColor} is not a valid borderColor`);
81 + }
82 +
83 + if (options.backgroundColor && !isColorValid(options.backgroundColor)) {
84 + throw new Error(`${options.backgroundColor} is not a valid backgroundColor`);
85 + }
86 +
87 + const chars = getBorderChars(options.borderStyle);
88 + const padding = getObject(options.padding);
89 + const margin = getObject(options.margin);
90 +
91 + const colorizeBorder = border => {
92 + const newBorder = options.borderColor ? getColorFn(options.borderColor)(border) : border;
93 + return options.dimBorder ? chalk.dim(newBorder) : newBorder;
94 + };
95 +
96 + const colorizeContent = content => options.backgroundColor ? getBGColorFn(options.backgroundColor)(content) : content;
97 +
98 + text = ansiAlign(text, {align: options.align});
99 +
100 + const NL = '\n';
101 + const PAD = ' ';
102 +
103 + let lines = text.split(NL);
104 +
105 + if (padding.top > 0) {
106 + lines = new Array(padding.top).fill('').concat(lines);
107 + }
108 +
109 + if (padding.bottom > 0) {
110 + lines = lines.concat(new Array(padding.bottom).fill(''));
111 + }
112 +
113 + const contentWidth = widestLine(text) + padding.left + padding.right;
114 + const paddingLeft = PAD.repeat(padding.left);
115 + const {columns} = termSize();
116 + let marginLeft = PAD.repeat(margin.left);
117 +
118 + if (options.float === 'center') {
119 + const padWidth = Math.max((columns - contentWidth) / 2, 0);
120 + marginLeft = PAD.repeat(padWidth);
121 + } else if (options.float === 'right') {
122 + const padWidth = Math.max(columns - contentWidth - margin.right - 2, 0);
123 + marginLeft = PAD.repeat(padWidth);
124 + }
125 +
126 + const horizontal = chars.horizontal.repeat(contentWidth);
127 + const top = colorizeBorder(NL.repeat(margin.top) + marginLeft + chars.topLeft + horizontal + chars.topRight);
128 + const bottom = colorizeBorder(marginLeft + chars.bottomLeft + horizontal + chars.bottomRight + NL.repeat(margin.bottom));
129 + const side = colorizeBorder(chars.vertical);
130 +
131 + const middle = lines.map(line => {
132 + const paddingRight = PAD.repeat(contentWidth - stringWidth(line) - padding.left);
133 + return marginLeft + side + colorizeContent(paddingLeft + line + paddingRight) + side;
134 + }).join(NL);
135 +
136 + return top + NL + middle + NL + bottom;
137 +};
138 +
139 +module.exports._borderStyles = cliBoxes;
1 +MIT License
2 +
3 +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4 +
5 +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:
6 +
7 +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 +
9 +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.
1 +{
2 + "_from": "boxen@^4.2.0",
3 + "_id": "boxen@4.2.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-eB4uT9RGzg2odpER62bBwSLvUeGC+WbRjjyyFhGsKnc8wp/m0+hQsMUvUe3H2V0D5vw0nBdO1hCJoZo5mKeuIQ==",
6 + "_location": "/boxen",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "boxen@^4.2.0",
12 + "name": "boxen",
13 + "escapedName": "boxen",
14 + "rawSpec": "^4.2.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^4.2.0"
17 + },
18 + "_requiredBy": [
19 + "/update-notifier"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/boxen/-/boxen-4.2.0.tgz",
22 + "_shasum": "e411b62357d6d6d36587c8ac3d5d974daa070e64",
23 + "_spec": "boxen@^4.2.0",
24 + "_where": "/Users/mindyeoi/Desktop/oss/We-Shop/boiler-plate/node_modules/update-notifier",
25 + "author": {
26 + "name": "Sindre Sorhus",
27 + "email": "sindresorhus@gmail.com",
28 + "url": "sindresorhus.com"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/sindresorhus/boxen/issues"
32 + },
33 + "bundleDependencies": false,
34 + "dependencies": {
35 + "ansi-align": "^3.0.0",
36 + "camelcase": "^5.3.1",
37 + "chalk": "^3.0.0",
38 + "cli-boxes": "^2.2.0",
39 + "string-width": "^4.1.0",
40 + "term-size": "^2.1.0",
41 + "type-fest": "^0.8.1",
42 + "widest-line": "^3.1.0"
43 + },
44 + "deprecated": false,
45 + "description": "Create boxes in the terminal",
46 + "devDependencies": {
47 + "ava": "^2.1.0",
48 + "nyc": "^14.1.1",
49 + "tsd": "^0.11.0",
50 + "xo": "^0.25.3"
51 + },
52 + "engines": {
53 + "node": ">=8"
54 + },
55 + "files": [
56 + "index.js",
57 + "index.d.ts"
58 + ],
59 + "funding": "https://github.com/sponsors/sindresorhus",
60 + "homepage": "https://github.com/sindresorhus/boxen#readme",
61 + "keywords": [
62 + "cli",
63 + "box",
64 + "boxes",
65 + "terminal",
66 + "term",
67 + "console",
68 + "ascii",
69 + "unicode",
70 + "border",
71 + "text"
72 + ],
73 + "license": "MIT",
74 + "name": "boxen",
75 + "repository": {
76 + "type": "git",
77 + "url": "git+https://github.com/sindresorhus/boxen.git"
78 + },
79 + "scripts": {
80 + "test": "xo && nyc ava && tsd"
81 + },
82 + "version": "4.2.0"
83 +}
1 +# boxen [![Build Status](https://travis-ci.org/sindresorhus/boxen.svg?branch=master)](https://travis-ci.org/sindresorhus/boxen)
2 +
3 +> Create boxes in the terminal
4 +
5 +![](screenshot.png)
6 +
7 +## Install
8 +
9 +```
10 +$ npm install boxen
11 +```
12 +
13 +## Usage
14 +
15 +```js
16 +const boxen = require('boxen');
17 +
18 +console.log(boxen('unicorn', {padding: 1}));
19 +/*
20 +┌─────────────┐
21 +│ │
22 +│ unicorn │
23 +│ │
24 +└─────────────┘
25 +*/
26 +
27 +console.log(boxen('unicorn', {padding: 1, margin: 1, borderStyle: 'double'}));
28 +/*
29 +
30 + ╔═════════════╗
31 + ║ ║
32 + ║ unicorn ║
33 + ║ ║
34 + ╚═════════════╝
35 +
36 +*/
37 +```
38 +
39 +## API
40 +
41 +### boxen(text, options?)
42 +
43 +#### text
44 +
45 +Type: `string`
46 +
47 +Text inside the box.
48 +
49 +#### options
50 +
51 +Type: `object`
52 +
53 +##### borderColor
54 +
55 +Type: `string`\
56 +Values: `'black'` `'red'` `'green'` `'yellow'` `'blue'` `'magenta'` `'cyan'` `'white'` `'gray'` or a hex value like `'#ff0000'`
57 +
58 +Color of the box border.
59 +
60 +##### borderStyle
61 +
62 +Type: `string | object`\
63 +Default: `'single'`\
64 +Values:
65 +- `'single'`
66 +```
67 +┌───┐
68 +│foo│
69 +└───┘
70 +```
71 +- `'double'`
72 +```
73 +╔═══╗
74 +║foo║
75 +╚═══╝
76 +```
77 +- `'round'` (`'single'` sides with round corners)
78 +```
79 +╭───╮
80 +│foo│
81 +╰───╯
82 +```
83 +- `'bold'`
84 +```
85 +┏━━━┓
86 +┃foo┃
87 +┗━━━┛
88 +```
89 +- `'singleDouble'` (`'single'` on top and bottom, `'double'` on right and left)
90 +```
91 +╓───╖
92 +║foo║
93 +╙───╜
94 +```
95 +- `'doubleSingle'` (`'double'` on top and bottom, `'single'` on right and left)
96 +```
97 +╒═══╕
98 +│foo│
99 +╘═══╛
100 +```
101 +- `'classic'`
102 +```
103 ++---+
104 +|foo|
105 ++---+
106 +```
107 +
108 +Style of the box border.
109 +
110 +Can be any of the above predefined styles or an object with the following keys:
111 +
112 +```js
113 +{
114 + topLeft: '+',
115 + topRight: '+',
116 + bottomLeft: '+',
117 + bottomRight: '+',
118 + horizontal: '-',
119 + vertical: '|'
120 +}
121 +```
122 +
123 +##### dimBorder
124 +
125 +Type: `boolean`\
126 +Default: `false`
127 +
128 +Reduce opacity of the border.
129 +
130 +##### padding
131 +
132 +Type: `number | object`\
133 +Default: `0`
134 +
135 +Space between the text and box border.
136 +
137 +Accepts a number or an object with any of the `top`, `right`, `bottom`, `left` properties. When a number is specified, the left/right padding is 3 times the top/bottom to make it look nice.
138 +
139 +##### margin
140 +
141 +Type: `number | object`\
142 +Default: `0`
143 +
144 +Space around the box.
145 +
146 +Accepts a number or an object with any of the `top`, `right`, `bottom`, `left` properties. When a number is specified, the left/right margin is 3 times the top/bottom to make it look nice.
147 +
148 +##### float
149 +
150 +Type: `string`\
151 +Default: `'left'`\
152 +Values: `'right'` `'center'` `'left'`
153 +
154 +Float the box on the available terminal screen space.
155 +
156 +##### backgroundColor
157 +
158 +Type: `string`\
159 +Values: `'black'` `'red'` `'green'` `'yellow'` `'blue'` `'magenta'` `'cyan'` `'white'` `'gray'` or a hex value like `'#ff0000'`
160 +
161 +Color of the background.
162 +
163 +##### align
164 +
165 +Type: `string`\
166 +Default: `'left'`\
167 +Values: `'left'` `'center'` `'right'`
168 +
169 +Align the text in the box based on the widest line.
170 +
171 +## Related
172 +
173 +- [boxen-cli](https://github.com/sindresorhus/boxen-cli) - CLI for this module
174 +- [cli-boxes](https://github.com/sindresorhus/cli-boxes) - Boxes for use in the terminal
175 +- [ink-box](https://github.com/sindresorhus/ink-box) - Box component for Ink that uses this package
176 +
177 +---
178 +
179 +<div align="center">
180 + <b>
181 + <a href="https://tidelift.com/subscription/pkg/npm-boxen?utm_source=npm-boxen&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
182 + </b>
183 + <br>
184 + <sub>
185 + Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
186 + </sub>
187 +</div>
1 +MIT License
2 +
3 +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy
6 +of this software and associated documentation files (the "Software"), to deal
7 +in the Software without restriction, including without limitation the rights
8 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 +copies of the Software, and to permit persons to whom the Software is
10 +furnished to do so, subject to the following conditions:
11 +
12 +The above copyright notice and this permission notice shall be included in all
13 +copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 +SOFTWARE.
1 +# brace-expansion
2 +
3 +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
4 +as known from sh/bash, in JavaScript.
5 +
6 +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion)
7 +[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion)
8 +[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/)
9 +
10 +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion)
11 +
12 +## Example
13 +
14 +```js
15 +var expand = require('brace-expansion');
16 +
17 +expand('file-{a,b,c}.jpg')
18 +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
19 +
20 +expand('-v{,,}')
21 +// => ['-v', '-v', '-v']
22 +
23 +expand('file{0..2}.jpg')
24 +// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
25 +
26 +expand('file-{a..c}.jpg')
27 +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
28 +
29 +expand('file{2..0}.jpg')
30 +// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
31 +
32 +expand('file{0..4..2}.jpg')
33 +// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
34 +
35 +expand('file-{a..e..2}.jpg')
36 +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
37 +
38 +expand('file{00..10..5}.jpg')
39 +// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
40 +
41 +expand('{{A..C},{a..c}}')
42 +// => ['A', 'B', 'C', 'a', 'b', 'c']
43 +
44 +expand('ppp{,config,oe{,conf}}')
45 +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
46 +```
47 +
48 +## API
49 +
50 +```js
51 +var expand = require('brace-expansion');
52 +```
53 +
54 +### var expanded = expand(str)
55 +
56 +Return an array of all possible and valid expansions of `str`. If none are
57 +found, `[str]` is returned.
58 +
59 +Valid expansions are:
60 +
61 +```js
62 +/^(.*,)+(.+)?$/
63 +// {a,b,...}
64 +```
65 +
66 +A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
67 +
68 +```js
69 +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
70 +// {x..y[..incr]}
71 +```
72 +
73 +A numeric sequence from `x` to `y` inclusive, with optional increment.
74 +If `x` or `y` start with a leading `0`, all the numbers will be padded
75 +to have equal length. Negative numbers and backwards iteration work too.
76 +
77 +```js
78 +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
79 +// {x..y[..incr]}
80 +```
81 +
82 +An alphabetic sequence from `x` to `y` inclusive, with optional increment.
83 +`x` and `y` must be exactly one character, and if given, `incr` must be a
84 +number.
85 +
86 +For compatibility reasons, the string `${` is not eligible for brace expansion.
87 +
88 +## Installation
89 +
90 +With [npm](https://npmjs.org) do:
91 +
92 +```bash
93 +npm install brace-expansion
94 +```
95 +
96 +## Contributors
97 +
98 +- [Julian Gruber](https://github.com/juliangruber)
99 +- [Isaac Z. Schlueter](https://github.com/isaacs)
100 +
101 +## Sponsors
102 +
103 +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
104 +
105 +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
106 +
107 +## License
108 +
109 +(MIT)
110 +
111 +Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
112 +
113 +Permission is hereby granted, free of charge, to any person obtaining a copy of
114 +this software and associated documentation files (the "Software"), to deal in
115 +the Software without restriction, including without limitation the rights to
116 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
117 +of the Software, and to permit persons to whom the Software is furnished to do
118 +so, subject to the following conditions:
119 +
120 +The above copyright notice and this permission notice shall be included in all
121 +copies or substantial portions of the Software.
122 +
123 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
124 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
125 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
126 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
127 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
128 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
129 +SOFTWARE.
1 +var concatMap = require('concat-map');
2 +var balanced = require('balanced-match');
3 +
4 +module.exports = expandTop;
5 +
6 +var escSlash = '\0SLASH'+Math.random()+'\0';
7 +var escOpen = '\0OPEN'+Math.random()+'\0';
8 +var escClose = '\0CLOSE'+Math.random()+'\0';
9 +var escComma = '\0COMMA'+Math.random()+'\0';
10 +var escPeriod = '\0PERIOD'+Math.random()+'\0';
11 +
12 +function numeric(str) {
13 + return parseInt(str, 10) == str
14 + ? parseInt(str, 10)
15 + : str.charCodeAt(0);
16 +}
17 +
18 +function escapeBraces(str) {
19 + return str.split('\\\\').join(escSlash)
20 + .split('\\{').join(escOpen)
21 + .split('\\}').join(escClose)
22 + .split('\\,').join(escComma)
23 + .split('\\.').join(escPeriod);
24 +}
25 +
26 +function unescapeBraces(str) {
27 + return str.split(escSlash).join('\\')
28 + .split(escOpen).join('{')
29 + .split(escClose).join('}')
30 + .split(escComma).join(',')
31 + .split(escPeriod).join('.');
32 +}
33 +
34 +
35 +// Basically just str.split(","), but handling cases
36 +// where we have nested braced sections, which should be
37 +// treated as individual members, like {a,{b,c},d}
38 +function parseCommaParts(str) {
39 + if (!str)
40 + return [''];
41 +
42 + var parts = [];
43 + var m = balanced('{', '}', str);
44 +
45 + if (!m)
46 + return str.split(',');
47 +
48 + var pre = m.pre;
49 + var body = m.body;
50 + var post = m.post;
51 + var p = pre.split(',');
52 +
53 + p[p.length-1] += '{' + body + '}';
54 + var postParts = parseCommaParts(post);
55 + if (post.length) {
56 + p[p.length-1] += postParts.shift();
57 + p.push.apply(p, postParts);
58 + }
59 +
60 + parts.push.apply(parts, p);
61 +
62 + return parts;
63 +}
64 +
65 +function expandTop(str) {
66 + if (!str)
67 + return [];
68 +
69 + // I don't know why Bash 4.3 does this, but it does.
70 + // Anything starting with {} will have the first two bytes preserved
71 + // but *only* at the top level, so {},a}b will not expand to anything,
72 + // but a{},b}c will be expanded to [a}c,abc].
73 + // One could argue that this is a bug in Bash, but since the goal of
74 + // this module is to match Bash's rules, we escape a leading {}
75 + if (str.substr(0, 2) === '{}') {
76 + str = '\\{\\}' + str.substr(2);
77 + }
78 +
79 + return expand(escapeBraces(str), true).map(unescapeBraces);
80 +}
81 +
82 +function identity(e) {
83 + return e;
84 +}
85 +
86 +function embrace(str) {
87 + return '{' + str + '}';
88 +}
89 +function isPadded(el) {
90 + return /^-?0\d/.test(el);
91 +}
92 +
93 +function lte(i, y) {
94 + return i <= y;
95 +}
96 +function gte(i, y) {
97 + return i >= y;
98 +}
99 +
100 +function expand(str, isTop) {
101 + var expansions = [];
102 +
103 + var m = balanced('{', '}', str);
104 + if (!m || /\$$/.test(m.pre)) return [str];
105 +
106 + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
107 + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
108 + var isSequence = isNumericSequence || isAlphaSequence;
109 + var isOptions = m.body.indexOf(',') >= 0;
110 + if (!isSequence && !isOptions) {
111 + // {a},b}
112 + if (m.post.match(/,.*\}/)) {
113 + str = m.pre + '{' + m.body + escClose + m.post;
114 + return expand(str);
115 + }
116 + return [str];
117 + }
118 +
119 + var n;
120 + if (isSequence) {
121 + n = m.body.split(/\.\./);
122 + } else {
123 + n = parseCommaParts(m.body);
124 + if (n.length === 1) {
125 + // x{{a,b}}y ==> x{a}y x{b}y
126 + n = expand(n[0], false).map(embrace);
127 + if (n.length === 1) {
128 + var post = m.post.length
129 + ? expand(m.post, false)
130 + : [''];
131 + return post.map(function(p) {
132 + return m.pre + n[0] + p;
133 + });
134 + }
135 + }
136 + }
137 +
138 + // at this point, n is the parts, and we know it's not a comma set
139 + // with a single entry.
140 +
141 + // no need to expand pre, since it is guaranteed to be free of brace-sets
142 + var pre = m.pre;
143 + var post = m.post.length
144 + ? expand(m.post, false)
145 + : [''];
146 +
147 + var N;
148 +
149 + if (isSequence) {
150 + var x = numeric(n[0]);
151 + var y = numeric(n[1]);
152 + var width = Math.max(n[0].length, n[1].length)
153 + var incr = n.length == 3
154 + ? Math.abs(numeric(n[2]))
155 + : 1;
156 + var test = lte;
157 + var reverse = y < x;
158 + if (reverse) {
159 + incr *= -1;
160 + test = gte;
161 + }
162 + var pad = n.some(isPadded);
163 +
164 + N = [];
165 +
166 + for (var i = x; test(i, y); i += incr) {
167 + var c;
168 + if (isAlphaSequence) {
169 + c = String.fromCharCode(i);
170 + if (c === '\\')
171 + c = '';
172 + } else {
173 + c = String(i);
174 + if (pad) {
175 + var need = width - c.length;
176 + if (need > 0) {
177 + var z = new Array(need + 1).join('0');
178 + if (i < 0)
179 + c = '-' + z + c.slice(1);
180 + else
181 + c = z + c;
182 + }
183 + }
184 + }
185 + N.push(c);
186 + }
187 + } else {
188 + N = concatMap(n, function(el) { return expand(el, false) });
189 + }
190 +
191 + for (var j = 0; j < N.length; j++) {
192 + for (var k = 0; k < post.length; k++) {
193 + var expansion = pre + N[j] + post[k];
194 + if (!isTop || isSequence || expansion)
195 + expansions.push(expansion);
196 + }
197 + }
198 +
199 + return expansions;
200 +}
201 +
1 +{
2 + "_from": "brace-expansion@^1.1.7",
3 + "_id": "brace-expansion@1.1.11",
4 + "_inBundle": false,
5 + "_integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
6 + "_location": "/brace-expansion",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "brace-expansion@^1.1.7",
12 + "name": "brace-expansion",
13 + "escapedName": "brace-expansion",
14 + "rawSpec": "^1.1.7",
15 + "saveSpec": null,
16 + "fetchSpec": "^1.1.7"
17 + },
18 + "_requiredBy": [
19 + "/minimatch"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
22 + "_shasum": "3c7fcbf529d87226f3d2f52b966ff5271eb441dd",
23 + "_spec": "brace-expansion@^1.1.7",
24 + "_where": "/Users/mindyeoi/Desktop/oss/We-Shop/boiler-plate/node_modules/minimatch",
25 + "author": {
26 + "name": "Julian Gruber",
27 + "email": "mail@juliangruber.com",
28 + "url": "http://juliangruber.com"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/juliangruber/brace-expansion/issues"
32 + },
33 + "bundleDependencies": false,
34 + "dependencies": {
35 + "balanced-match": "^1.0.0",
36 + "concat-map": "0.0.1"
37 + },
38 + "deprecated": false,
39 + "description": "Brace expansion as known from sh/bash",
40 + "devDependencies": {
41 + "matcha": "^0.7.0",
42 + "tape": "^4.6.0"
43 + },
44 + "homepage": "https://github.com/juliangruber/brace-expansion",
45 + "keywords": [],
46 + "license": "MIT",
47 + "main": "index.js",
48 + "name": "brace-expansion",
49 + "repository": {
50 + "type": "git",
51 + "url": "git://github.com/juliangruber/brace-expansion.git"
52 + },
53 + "scripts": {
54 + "bench": "matcha test/perf/bench.js",
55 + "gentest": "bash test/generate.sh",
56 + "test": "tape test/*.js"
57 + },
58 + "testling": {
59 + "files": "test/*.js",
60 + "browsers": [
61 + "ie/8..latest",
62 + "firefox/20..latest",
63 + "firefox/nightly",
64 + "chrome/25..latest",
65 + "chrome/canary",
66 + "opera/12..latest",
67 + "opera/next",
68 + "safari/5.1..latest",
69 + "ipad/6.0..latest",
70 + "iphone/6.0..latest",
71 + "android-browser/4.2..latest"
72 + ]
73 + },
74 + "version": "1.1.11"
75 +}
1 +# Release history
2 +
3 +All notable changes to this project will be documented in this file.
4 +
5 +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6 +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7 +
8 +<details>
9 + <summary><strong>Guiding Principles</strong></summary>
10 +
11 +- Changelogs are for humans, not machines.
12 +- There should be an entry for every single version.
13 +- The same types of changes should be grouped.
14 +- Versions and sections should be linkable.
15 +- The latest version comes first.
16 +- The release date of each versions is displayed.
17 +- Mention whether you follow Semantic Versioning.
18 +
19 +</details>
20 +
21 +<details>
22 + <summary><strong>Types of changes</strong></summary>
23 +
24 +Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_):
25 +
26 +- `Added` for new features.
27 +- `Changed` for changes in existing functionality.
28 +- `Deprecated` for soon-to-be removed features.
29 +- `Removed` for now removed features.
30 +- `Fixed` for any bug fixes.
31 +- `Security` in case of vulnerabilities.
32 +
33 +</details>
34 +
35 +## [3.0.0] - 2018-04-08
36 +
37 +v3.0 is a complete refactor, resulting in a faster, smaller codebase, with fewer deps, and a more accurate parser and compiler.
38 +
39 +**Breaking Changes**
40 +
41 +- The undocumented `.makeRe` method was removed
42 +
43 +**Non-breaking changes**
44 +
45 +- Caching was removed
46 +
47 +## [2.3.2] - 2018-04-08
48 +
49 +- start refactoring
50 +- cover sets
51 +- better range handling
52 +
53 +## [2.3.1] - 2018-02-17
54 +
55 +- Remove unnecessary escape in Regex. (#14)
56 +
57 +## [2.3.0] - 2017-10-19
58 +
59 +- minor code reorganization
60 +- optimize regex
61 +- expose `maxLength` option
62 +
63 +## [2.2.1] - 2017-05-30
64 +
65 +- don't condense when braces contain extglobs
66 +
67 +## [2.2.0] - 2017-05-28
68 +
69 +- ensure word boundaries are preserved
70 +- fixes edge case where extglob characters precede a brace pattern
71 +
72 +## [2.1.1] - 2017-04-27
73 +
74 +- use snapdragon-node
75 +- handle edge case
76 +- optimizations, lint
77 +
78 +## [2.0.4] - 2017-04-11
79 +
80 +- pass opts to compiler
81 +- minor optimization in create method
82 +- re-write parser handlers to remove negation regex
83 +
84 +## [2.0.3] - 2016-12-10
85 +
86 +- use split-string
87 +- clear queue at the end
88 +- adds sequences example
89 +- add unit tests
90 +
91 +## [2.0.2] - 2016-10-21
92 +
93 +- fix comma handling in nested extglobs
94 +
95 +## [2.0.1] - 2016-10-20
96 +
97 +- add comments
98 +- more tests, ensure quotes are stripped
99 +
100 +## [2.0.0] - 2016-10-19
101 +
102 +- don't expand braces inside character classes
103 +- add quantifier pattern
104 +
105 +## [1.8.5] - 2016-05-21
106 +
107 +- Refactor (#10)
108 +
109 +## [1.8.4] - 2016-04-20
110 +
111 +- fixes https://github.com/jonschlinkert/micromatch/issues/66
112 +
113 +## [1.8.0] - 2015-03-18
114 +
115 +- adds exponent examples, tests
116 +- fixes the first example in https://github.com/jonschlinkert/micromatch/issues/38
117 +
118 +## [1.6.0] - 2015-01-30
119 +
120 +- optimizations, `bash` mode:
121 +- improve path escaping
122 +
123 +## [1.5.0] - 2015-01-28
124 +
125 +- Merge pull request #5 from eush77/lib-files
126 +
127 +## [1.4.0] - 2015-01-24
128 +
129 +- add extglob tests
130 +- externalize exponent function
131 +- better whitespace handling
132 +
133 +## [1.3.0] - 2015-01-24
134 +
135 +- make regex patterns explicity
136 +
137 +## [1.1.0] - 2015-01-11
138 +
139 +- don't create a match group with `makeRe`
140 +
141 +## [1.0.0] - 2014-12-23
142 +
143 +- Merge commit '97b05f5544f8348736a8efaecf5c32bbe3e2ad6e'
144 +- support empty brace syntax
145 +- better bash coverage
146 +- better support for regex strings
147 +
148 +## [0.1.4] - 2014-11-14
149 +
150 +- improve recognition of bad args, recognize mismatched argument types
151 +- support escaping
152 +- remove pathname-expansion
153 +- support whitespace in patterns
154 +
155 +## [0.1.0]
156 +
157 +- first commit
158 +
159 +[2.3.2]: https://github.com/micromatch/braces/compare/2.3.1...2.3.2
160 +[2.3.1]: https://github.com/micromatch/braces/compare/2.3.0...2.3.1
161 +[2.3.0]: https://github.com/micromatch/braces/compare/2.2.1...2.3.0
162 +[2.2.1]: https://github.com/micromatch/braces/compare/2.2.0...2.2.1
163 +[2.2.0]: https://github.com/micromatch/braces/compare/2.1.1...2.2.0
164 +[2.1.1]: https://github.com/micromatch/braces/compare/2.1.0...2.1.1
165 +[2.1.0]: https://github.com/micromatch/braces/compare/2.0.4...2.1.0
166 +[2.0.4]: https://github.com/micromatch/braces/compare/2.0.3...2.0.4
167 +[2.0.3]: https://github.com/micromatch/braces/compare/2.0.2...2.0.3
168 +[2.0.2]: https://github.com/micromatch/braces/compare/2.0.1...2.0.2
169 +[2.0.1]: https://github.com/micromatch/braces/compare/2.0.0...2.0.1
170 +[2.0.0]: https://github.com/micromatch/braces/compare/1.8.5...2.0.0
171 +[1.8.5]: https://github.com/micromatch/braces/compare/1.8.4...1.8.5
172 +[1.8.4]: https://github.com/micromatch/braces/compare/1.8.0...1.8.4
173 +[1.8.0]: https://github.com/micromatch/braces/compare/1.6.0...1.8.0
174 +[1.6.0]: https://github.com/micromatch/braces/compare/1.5.0...1.6.0
175 +[1.5.0]: https://github.com/micromatch/braces/compare/1.4.0...1.5.0
176 +[1.4.0]: https://github.com/micromatch/braces/compare/1.3.0...1.4.0
177 +[1.3.0]: https://github.com/micromatch/braces/compare/1.2.0...1.3.0
178 +[1.2.0]: https://github.com/micromatch/braces/compare/1.1.0...1.2.0
179 +[1.1.0]: https://github.com/micromatch/braces/compare/1.0.0...1.1.0
180 +[1.0.0]: https://github.com/micromatch/braces/compare/0.1.4...1.0.0
181 +[0.1.4]: https://github.com/micromatch/braces/compare/0.1.0...0.1.4
182 +
183 +[Unreleased]: https://github.com/micromatch/braces/compare/0.1.0...HEAD
184 +[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog
...\ No newline at end of file ...\ No newline at end of file
1 +The MIT License (MIT)
2 +
3 +Copyright (c) 2014-2018, Jon Schlinkert.
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy
6 +of this software and associated documentation files (the "Software"), to deal
7 +in the Software without restriction, including without limitation the rights
8 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 +copies of the Software, and to permit persons to whom the Software is
10 +furnished to do so, subject to the following conditions:
11 +
12 +The above copyright notice and this permission notice shall be included in
13 +all copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 +THE SOFTWARE.
This diff is collapsed. Click to expand it.
1 +'use strict';
2 +
3 +const stringify = require('./lib/stringify');
4 +const compile = require('./lib/compile');
5 +const expand = require('./lib/expand');
6 +const parse = require('./lib/parse');
7 +
8 +/**
9 + * Expand the given pattern or create a regex-compatible string.
10 + *
11 + * ```js
12 + * const braces = require('braces');
13 + * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
14 + * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
15 + * ```
16 + * @param {String} `str`
17 + * @param {Object} `options`
18 + * @return {String}
19 + * @api public
20 + */
21 +
22 +const braces = (input, options = {}) => {
23 + let output = [];
24 +
25 + if (Array.isArray(input)) {
26 + for (let pattern of input) {
27 + let result = braces.create(pattern, options);
28 + if (Array.isArray(result)) {
29 + output.push(...result);
30 + } else {
31 + output.push(result);
32 + }
33 + }
34 + } else {
35 + output = [].concat(braces.create(input, options));
36 + }
37 +
38 + if (options && options.expand === true && options.nodupes === true) {
39 + output = [...new Set(output)];
40 + }
41 + return output;
42 +};
43 +
44 +/**
45 + * Parse the given `str` with the given `options`.
46 + *
47 + * ```js
48 + * // braces.parse(pattern, [, options]);
49 + * const ast = braces.parse('a/{b,c}/d');
50 + * console.log(ast);
51 + * ```
52 + * @param {String} pattern Brace pattern to parse
53 + * @param {Object} options
54 + * @return {Object} Returns an AST
55 + * @api public
56 + */
57 +
58 +braces.parse = (input, options = {}) => parse(input, options);
59 +
60 +/**
61 + * Creates a braces string from an AST, or an AST node.
62 + *
63 + * ```js
64 + * const braces = require('braces');
65 + * let ast = braces.parse('foo/{a,b}/bar');
66 + * console.log(stringify(ast.nodes[2])); //=> '{a,b}'
67 + * ```
68 + * @param {String} `input` Brace pattern or AST.
69 + * @param {Object} `options`
70 + * @return {Array} Returns an array of expanded values.
71 + * @api public
72 + */
73 +
74 +braces.stringify = (input, options = {}) => {
75 + if (typeof input === 'string') {
76 + return stringify(braces.parse(input, options), options);
77 + }
78 + return stringify(input, options);
79 +};
80 +
81 +/**
82 + * Compiles a brace pattern into a regex-compatible, optimized string.
83 + * This method is called by the main [braces](#braces) function by default.
84 + *
85 + * ```js
86 + * const braces = require('braces');
87 + * console.log(braces.compile('a/{b,c}/d'));
88 + * //=> ['a/(b|c)/d']
89 + * ```
90 + * @param {String} `input` Brace pattern or AST.
91 + * @param {Object} `options`
92 + * @return {Array} Returns an array of expanded values.
93 + * @api public
94 + */
95 +
96 +braces.compile = (input, options = {}) => {
97 + if (typeof input === 'string') {
98 + input = braces.parse(input, options);
99 + }
100 + return compile(input, options);
101 +};
102 +
103 +/**
104 + * Expands a brace pattern into an array. This method is called by the
105 + * main [braces](#braces) function when `options.expand` is true. Before
106 + * using this method it's recommended that you read the [performance notes](#performance))
107 + * and advantages of using [.compile](#compile) instead.
108 + *
109 + * ```js
110 + * const braces = require('braces');
111 + * console.log(braces.expand('a/{b,c}/d'));
112 + * //=> ['a/b/d', 'a/c/d'];
113 + * ```
114 + * @param {String} `pattern` Brace pattern
115 + * @param {Object} `options`
116 + * @return {Array} Returns an array of expanded values.
117 + * @api public
118 + */
119 +
120 +braces.expand = (input, options = {}) => {
121 + if (typeof input === 'string') {
122 + input = braces.parse(input, options);
123 + }
124 +
125 + let result = expand(input, options);
126 +
127 + // filter out empty strings if specified
128 + if (options.noempty === true) {
129 + result = result.filter(Boolean);
130 + }
131 +
132 + // filter out duplicates if specified
133 + if (options.nodupes === true) {
134 + result = [...new Set(result)];
135 + }
136 +
137 + return result;
138 +};
139 +
140 +/**
141 + * Processes a brace pattern and returns either an expanded array
142 + * (if `options.expand` is true), a highly optimized regex-compatible string.
143 + * This method is called by the main [braces](#braces) function.
144 + *
145 + * ```js
146 + * const braces = require('braces');
147 + * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
148 + * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
149 + * ```
150 + * @param {String} `pattern` Brace pattern
151 + * @param {Object} `options`
152 + * @return {Array} Returns an array of expanded values.
153 + * @api public
154 + */
155 +
156 +braces.create = (input, options = {}) => {
157 + if (input === '' || input.length < 3) {
158 + return [input];
159 + }
160 +
161 + return options.expand !== true
162 + ? braces.compile(input, options)
163 + : braces.expand(input, options);
164 +};
165 +
166 +/**
167 + * Expose "braces"
168 + */
169 +
170 +module.exports = braces;
1 +'use strict';
2 +
3 +const fill = require('fill-range');
4 +const utils = require('./utils');
5 +
6 +const compile = (ast, options = {}) => {
7 + let walk = (node, parent = {}) => {
8 + let invalidBlock = utils.isInvalidBrace(parent);
9 + let invalidNode = node.invalid === true && options.escapeInvalid === true;
10 + let invalid = invalidBlock === true || invalidNode === true;
11 + let prefix = options.escapeInvalid === true ? '\\' : '';
12 + let output = '';
13 +
14 + if (node.isOpen === true) {
15 + return prefix + node.value;
16 + }
17 + if (node.isClose === true) {
18 + return prefix + node.value;
19 + }
20 +
21 + if (node.type === 'open') {
22 + return invalid ? (prefix + node.value) : '(';
23 + }
24 +
25 + if (node.type === 'close') {
26 + return invalid ? (prefix + node.value) : ')';
27 + }
28 +
29 + if (node.type === 'comma') {
30 + return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|');
31 + }
32 +
33 + if (node.value) {
34 + return node.value;
35 + }
36 +
37 + if (node.nodes && node.ranges > 0) {
38 + let args = utils.reduce(node.nodes);
39 + let range = fill(...args, { ...options, wrap: false, toRegex: true });
40 +
41 + if (range.length !== 0) {
42 + return args.length > 1 && range.length > 1 ? `(${range})` : range;
43 + }
44 + }
45 +
46 + if (node.nodes) {
47 + for (let child of node.nodes) {
48 + output += walk(child, node);
49 + }
50 + }
51 + return output;
52 + };
53 +
54 + return walk(ast);
55 +};
56 +
57 +module.exports = compile;
1 +'use strict';
2 +
3 +module.exports = {
4 + MAX_LENGTH: 1024 * 64,
5 +
6 + // Digits
7 + CHAR_0: '0', /* 0 */
8 + CHAR_9: '9', /* 9 */
9 +
10 + // Alphabet chars.
11 + CHAR_UPPERCASE_A: 'A', /* A */
12 + CHAR_LOWERCASE_A: 'a', /* a */
13 + CHAR_UPPERCASE_Z: 'Z', /* Z */
14 + CHAR_LOWERCASE_Z: 'z', /* z */
15 +
16 + CHAR_LEFT_PARENTHESES: '(', /* ( */
17 + CHAR_RIGHT_PARENTHESES: ')', /* ) */
18 +
19 + CHAR_ASTERISK: '*', /* * */
20 +
21 + // Non-alphabetic chars.
22 + CHAR_AMPERSAND: '&', /* & */
23 + CHAR_AT: '@', /* @ */
24 + CHAR_BACKSLASH: '\\', /* \ */
25 + CHAR_BACKTICK: '`', /* ` */
26 + CHAR_CARRIAGE_RETURN: '\r', /* \r */
27 + CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */
28 + CHAR_COLON: ':', /* : */
29 + CHAR_COMMA: ',', /* , */
30 + CHAR_DOLLAR: '$', /* . */
31 + CHAR_DOT: '.', /* . */
32 + CHAR_DOUBLE_QUOTE: '"', /* " */
33 + CHAR_EQUAL: '=', /* = */
34 + CHAR_EXCLAMATION_MARK: '!', /* ! */
35 + CHAR_FORM_FEED: '\f', /* \f */
36 + CHAR_FORWARD_SLASH: '/', /* / */
37 + CHAR_HASH: '#', /* # */
38 + CHAR_HYPHEN_MINUS: '-', /* - */
39 + CHAR_LEFT_ANGLE_BRACKET: '<', /* < */
40 + CHAR_LEFT_CURLY_BRACE: '{', /* { */
41 + CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */
42 + CHAR_LINE_FEED: '\n', /* \n */
43 + CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */
44 + CHAR_PERCENT: '%', /* % */
45 + CHAR_PLUS: '+', /* + */
46 + CHAR_QUESTION_MARK: '?', /* ? */
47 + CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */
48 + CHAR_RIGHT_CURLY_BRACE: '}', /* } */
49 + CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */
50 + CHAR_SEMICOLON: ';', /* ; */
51 + CHAR_SINGLE_QUOTE: '\'', /* ' */
52 + CHAR_SPACE: ' ', /* */
53 + CHAR_TAB: '\t', /* \t */
54 + CHAR_UNDERSCORE: '_', /* _ */
55 + CHAR_VERTICAL_LINE: '|', /* | */
56 + CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */
57 +};
1 +'use strict';
2 +
3 +const fill = require('fill-range');
4 +const stringify = require('./stringify');
5 +const utils = require('./utils');
6 +
7 +const append = (queue = '', stash = '', enclose = false) => {
8 + let result = [];
9 +
10 + queue = [].concat(queue);
11 + stash = [].concat(stash);
12 +
13 + if (!stash.length) return queue;
14 + if (!queue.length) {
15 + return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash;
16 + }
17 +
18 + for (let item of queue) {
19 + if (Array.isArray(item)) {
20 + for (let value of item) {
21 + result.push(append(value, stash, enclose));
22 + }
23 + } else {
24 + for (let ele of stash) {
25 + if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
26 + result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele));
27 + }
28 + }
29 + }
30 + return utils.flatten(result);
31 +};
32 +
33 +const expand = (ast, options = {}) => {
34 + let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit;
35 +
36 + let walk = (node, parent = {}) => {
37 + node.queue = [];
38 +
39 + let p = parent;
40 + let q = parent.queue;
41 +
42 + while (p.type !== 'brace' && p.type !== 'root' && p.parent) {
43 + p = p.parent;
44 + q = p.queue;
45 + }
46 +
47 + if (node.invalid || node.dollar) {
48 + q.push(append(q.pop(), stringify(node, options)));
49 + return;
50 + }
51 +
52 + if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) {
53 + q.push(append(q.pop(), ['{}']));
54 + return;
55 + }
56 +
57 + if (node.nodes && node.ranges > 0) {
58 + let args = utils.reduce(node.nodes);
59 +
60 + if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
61 + throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
62 + }
63 +
64 + let range = fill(...args, options);
65 + if (range.length === 0) {
66 + range = stringify(node, options);
67 + }
68 +
69 + q.push(append(q.pop(), range));
70 + node.nodes = [];
71 + return;
72 + }
73 +
74 + let enclose = utils.encloseBrace(node);
75 + let queue = node.queue;
76 + let block = node;
77 +
78 + while (block.type !== 'brace' && block.type !== 'root' && block.parent) {
79 + block = block.parent;
80 + queue = block.queue;
81 + }
82 +
83 + for (let i = 0; i < node.nodes.length; i++) {
84 + let child = node.nodes[i];
85 +
86 + if (child.type === 'comma' && node.type === 'brace') {
87 + if (i === 1) queue.push('');
88 + queue.push('');
89 + continue;
90 + }
91 +
92 + if (child.type === 'close') {
93 + q.push(append(q.pop(), queue, enclose));
94 + continue;
95 + }
96 +
97 + if (child.value && child.type !== 'open') {
98 + queue.push(append(queue.pop(), child.value));
99 + continue;
100 + }
101 +
102 + if (child.nodes) {
103 + walk(child, node);
104 + }
105 + }
106 +
107 + return queue;
108 + };
109 +
110 + return utils.flatten(walk(ast));
111 +};
112 +
113 +module.exports = expand;
1 +'use strict';
2 +
3 +const stringify = require('./stringify');
4 +
5 +/**
6 + * Constants
7 + */
8 +
9 +const {
10 + MAX_LENGTH,
11 + CHAR_BACKSLASH, /* \ */
12 + CHAR_BACKTICK, /* ` */
13 + CHAR_COMMA, /* , */
14 + CHAR_DOT, /* . */
15 + CHAR_LEFT_PARENTHESES, /* ( */
16 + CHAR_RIGHT_PARENTHESES, /* ) */
17 + CHAR_LEFT_CURLY_BRACE, /* { */
18 + CHAR_RIGHT_CURLY_BRACE, /* } */
19 + CHAR_LEFT_SQUARE_BRACKET, /* [ */
20 + CHAR_RIGHT_SQUARE_BRACKET, /* ] */
21 + CHAR_DOUBLE_QUOTE, /* " */
22 + CHAR_SINGLE_QUOTE, /* ' */
23 + CHAR_NO_BREAK_SPACE,
24 + CHAR_ZERO_WIDTH_NOBREAK_SPACE
25 +} = require('./constants');
26 +
27 +/**
28 + * parse
29 + */
30 +
31 +const parse = (input, options = {}) => {
32 + if (typeof input !== 'string') {
33 + throw new TypeError('Expected a string');
34 + }
35 +
36 + let opts = options || {};
37 + let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
38 + if (input.length > max) {
39 + throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
40 + }
41 +
42 + let ast = { type: 'root', input, nodes: [] };
43 + let stack = [ast];
44 + let block = ast;
45 + let prev = ast;
46 + let brackets = 0;
47 + let length = input.length;
48 + let index = 0;
49 + let depth = 0;
50 + let value;
51 + let memo = {};
52 +
53 + /**
54 + * Helpers
55 + */
56 +
57 + const advance = () => input[index++];
58 + const push = node => {
59 + if (node.type === 'text' && prev.type === 'dot') {
60 + prev.type = 'text';
61 + }
62 +
63 + if (prev && prev.type === 'text' && node.type === 'text') {
64 + prev.value += node.value;
65 + return;
66 + }
67 +
68 + block.nodes.push(node);
69 + node.parent = block;
70 + node.prev = prev;
71 + prev = node;
72 + return node;
73 + };
74 +
75 + push({ type: 'bos' });
76 +
77 + while (index < length) {
78 + block = stack[stack.length - 1];
79 + value = advance();
80 +
81 + /**
82 + * Invalid chars
83 + */
84 +
85 + if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
86 + continue;
87 + }
88 +
89 + /**
90 + * Escaped chars
91 + */
92 +
93 + if (value === CHAR_BACKSLASH) {
94 + push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() });
95 + continue;
96 + }
97 +
98 + /**
99 + * Right square bracket (literal): ']'
100 + */
101 +
102 + if (value === CHAR_RIGHT_SQUARE_BRACKET) {
103 + push({ type: 'text', value: '\\' + value });
104 + continue;
105 + }
106 +
107 + /**
108 + * Left square bracket: '['
109 + */
110 +
111 + if (value === CHAR_LEFT_SQUARE_BRACKET) {
112 + brackets++;
113 +
114 + let closed = true;
115 + let next;
116 +
117 + while (index < length && (next = advance())) {
118 + value += next;
119 +
120 + if (next === CHAR_LEFT_SQUARE_BRACKET) {
121 + brackets++;
122 + continue;
123 + }
124 +
125 + if (next === CHAR_BACKSLASH) {
126 + value += advance();
127 + continue;
128 + }
129 +
130 + if (next === CHAR_RIGHT_SQUARE_BRACKET) {
131 + brackets--;
132 +
133 + if (brackets === 0) {
134 + break;
135 + }
136 + }
137 + }
138 +
139 + push({ type: 'text', value });
140 + continue;
141 + }
142 +
143 + /**
144 + * Parentheses
145 + */
146 +
147 + if (value === CHAR_LEFT_PARENTHESES) {
148 + block = push({ type: 'paren', nodes: [] });
149 + stack.push(block);
150 + push({ type: 'text', value });
151 + continue;
152 + }
153 +
154 + if (value === CHAR_RIGHT_PARENTHESES) {
155 + if (block.type !== 'paren') {
156 + push({ type: 'text', value });
157 + continue;
158 + }
159 + block = stack.pop();
160 + push({ type: 'text', value });
161 + block = stack[stack.length - 1];
162 + continue;
163 + }
164 +
165 + /**
166 + * Quotes: '|"|`
167 + */
168 +
169 + if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
170 + let open = value;
171 + let next;
172 +
173 + if (options.keepQuotes !== true) {
174 + value = '';
175 + }
176 +
177 + while (index < length && (next = advance())) {
178 + if (next === CHAR_BACKSLASH) {
179 + value += next + advance();
180 + continue;
181 + }
182 +
183 + if (next === open) {
184 + if (options.keepQuotes === true) value += next;
185 + break;
186 + }
187 +
188 + value += next;
189 + }
190 +
191 + push({ type: 'text', value });
192 + continue;
193 + }
194 +
195 + /**
196 + * Left curly brace: '{'
197 + */
198 +
199 + if (value === CHAR_LEFT_CURLY_BRACE) {
200 + depth++;
201 +
202 + let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
203 + let brace = {
204 + type: 'brace',
205 + open: true,
206 + close: false,
207 + dollar,
208 + depth,
209 + commas: 0,
210 + ranges: 0,
211 + nodes: []
212 + };
213 +
214 + block = push(brace);
215 + stack.push(block);
216 + push({ type: 'open', value });
217 + continue;
218 + }
219 +
220 + /**
221 + * Right curly brace: '}'
222 + */
223 +
224 + if (value === CHAR_RIGHT_CURLY_BRACE) {
225 + if (block.type !== 'brace') {
226 + push({ type: 'text', value });
227 + continue;
228 + }
229 +
230 + let type = 'close';
231 + block = stack.pop();
232 + block.close = true;
233 +
234 + push({ type, value });
235 + depth--;
236 +
237 + block = stack[stack.length - 1];
238 + continue;
239 + }
240 +
241 + /**
242 + * Comma: ','
243 + */
244 +
245 + if (value === CHAR_COMMA && depth > 0) {
246 + if (block.ranges > 0) {
247 + block.ranges = 0;
248 + let open = block.nodes.shift();
249 + block.nodes = [open, { type: 'text', value: stringify(block) }];
250 + }
251 +
252 + push({ type: 'comma', value });
253 + block.commas++;
254 + continue;
255 + }
256 +
257 + /**
258 + * Dot: '.'
259 + */
260 +
261 + if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
262 + let siblings = block.nodes;
263 +
264 + if (depth === 0 || siblings.length === 0) {
265 + push({ type: 'text', value });
266 + continue;
267 + }
268 +
269 + if (prev.type === 'dot') {
270 + block.range = [];
271 + prev.value += value;
272 + prev.type = 'range';
273 +
274 + if (block.nodes.length !== 3 && block.nodes.length !== 5) {
275 + block.invalid = true;
276 + block.ranges = 0;
277 + prev.type = 'text';
278 + continue;
279 + }
280 +
281 + block.ranges++;
282 + block.args = [];
283 + continue;
284 + }
285 +
286 + if (prev.type === 'range') {
287 + siblings.pop();
288 +
289 + let before = siblings[siblings.length - 1];
290 + before.value += prev.value + value;
291 + prev = before;
292 + block.ranges--;
293 + continue;
294 + }
295 +
296 + push({ type: 'dot', value });
297 + continue;
298 + }
299 +
300 + /**
301 + * Text
302 + */
303 +
304 + push({ type: 'text', value });
305 + }
306 +
307 + // Mark imbalanced braces and brackets as invalid
308 + do {
309 + block = stack.pop();
310 +
311 + if (block.type !== 'root') {
312 + block.nodes.forEach(node => {
313 + if (!node.nodes) {
314 + if (node.type === 'open') node.isOpen = true;
315 + if (node.type === 'close') node.isClose = true;
316 + if (!node.nodes) node.type = 'text';
317 + node.invalid = true;
318 + }
319 + });
320 +
321 + // get the location of the block on parent.nodes (block's siblings)
322 + let parent = stack[stack.length - 1];
323 + let index = parent.nodes.indexOf(block);
324 + // replace the (invalid) block with it's nodes
325 + parent.nodes.splice(index, 1, ...block.nodes);
326 + }
327 + } while (stack.length > 0);
328 +
329 + push({ type: 'eos' });
330 + return ast;
331 +};
332 +
333 +module.exports = parse;
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.