Solhee

InstalledNPMandExpress

Showing 1000 changed files with 4916 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

1 +const express = require('express');
2 +const app = express();
3 +
4 +app.set('port',process.env.PORT||3000);
5 +
6 +app.get('/',(req,res)=>{
7 + res.send("Food Adtv Info Service");
8 +});
9 +
10 +app.listen(app.get('port'),()=>{
11 + console.log(app.get('port'),'번 포트에서 대기 중');
12 +});
...\ No newline at end of file ...\ No newline at end of file
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../is-ci/bin.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../is-ci/bin.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\is-ci\bin.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../is-ci/bin.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../is-ci/bin.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../mime/cli.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../mime/cli.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\mime\cli.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../mime/cli.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../mime/cli.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../nodemon/bin/nodemon.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../nodemon/bin/nodemon.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\nodemon\bin\nodemon.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../nodemon/bin/nodemon.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../nodemon/bin/nodemon.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../touch/bin/nodetouch.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../touch/bin/nodetouch.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\touch\bin\nodetouch.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../touch/bin/nodetouch.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../touch/bin/nodetouch.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../nopt/bin/nopt.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\nopt\bin\nopt.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../nopt/bin/nopt.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../rc/cli.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../rc/cli.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\rc\cli.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../rc/cli.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../rc/cli.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../semver/bin/semver" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../semver/bin/semver" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\semver\bin\semver" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../semver/bin/semver" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../semver/bin/semver" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
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": "C:\\Users\\10120\\Desktop\\OSS PJ\\project\\express\\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": "C:\\Users\\10120\\Desktop\\OSS PJ\\project\\express\\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": "C:\\Users\\10120\\Desktop\\OSS PJ\\project\\express\\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 +1.3.7 / 2019-04-29
2 +==================
3 +
4 + * deps: negotiator@0.6.2
5 + - Fix sorting charset, encoding, and language with extra parameters
6 +
7 +1.3.6 / 2019-04-28
8 +==================
9 +
10 + * deps: mime-types@~2.1.24
11 + - deps: mime-db@~1.40.0
12 +
13 +1.3.5 / 2018-02-28
14 +==================
15 +
16 + * deps: mime-types@~2.1.18
17 + - deps: mime-db@~1.33.0
18 +
19 +1.3.4 / 2017-08-22
20 +==================
21 +
22 + * deps: mime-types@~2.1.16
23 + - deps: mime-db@~1.29.0
24 +
25 +1.3.3 / 2016-05-02
26 +==================
27 +
28 + * deps: mime-types@~2.1.11
29 + - deps: mime-db@~1.23.0
30 + * deps: negotiator@0.6.1
31 + - perf: improve `Accept` parsing speed
32 + - perf: improve `Accept-Charset` parsing speed
33 + - perf: improve `Accept-Encoding` parsing speed
34 + - perf: improve `Accept-Language` parsing speed
35 +
36 +1.3.2 / 2016-03-08
37 +==================
38 +
39 + * deps: mime-types@~2.1.10
40 + - Fix extension of `application/dash+xml`
41 + - Update primary extension for `audio/mp4`
42 + - deps: mime-db@~1.22.0
43 +
44 +1.3.1 / 2016-01-19
45 +==================
46 +
47 + * deps: mime-types@~2.1.9
48 + - deps: mime-db@~1.21.0
49 +
50 +1.3.0 / 2015-09-29
51 +==================
52 +
53 + * deps: mime-types@~2.1.7
54 + - deps: mime-db@~1.19.0
55 + * deps: negotiator@0.6.0
56 + - Fix including type extensions in parameters in `Accept` parsing
57 + - Fix parsing `Accept` parameters with quoted equals
58 + - Fix parsing `Accept` parameters with quoted semicolons
59 + - Lazy-load modules from main entry point
60 + - perf: delay type concatenation until needed
61 + - perf: enable strict mode
62 + - perf: hoist regular expressions
63 + - perf: remove closures getting spec properties
64 + - perf: remove a closure from media type parsing
65 + - perf: remove property delete from media type parsing
66 +
67 +1.2.13 / 2015-09-06
68 +===================
69 +
70 + * deps: mime-types@~2.1.6
71 + - deps: mime-db@~1.18.0
72 +
73 +1.2.12 / 2015-07-30
74 +===================
75 +
76 + * deps: mime-types@~2.1.4
77 + - deps: mime-db@~1.16.0
78 +
79 +1.2.11 / 2015-07-16
80 +===================
81 +
82 + * deps: mime-types@~2.1.3
83 + - deps: mime-db@~1.15.0
84 +
85 +1.2.10 / 2015-07-01
86 +===================
87 +
88 + * deps: mime-types@~2.1.2
89 + - deps: mime-db@~1.14.0
90 +
91 +1.2.9 / 2015-06-08
92 +==================
93 +
94 + * deps: mime-types@~2.1.1
95 + - perf: fix deopt during mapping
96 +
97 +1.2.8 / 2015-06-07
98 +==================
99 +
100 + * deps: mime-types@~2.1.0
101 + - deps: mime-db@~1.13.0
102 + * perf: avoid argument reassignment & argument slice
103 + * perf: avoid negotiator recursive construction
104 + * perf: enable strict mode
105 + * perf: remove unnecessary bitwise operator
106 +
107 +1.2.7 / 2015-05-10
108 +==================
109 +
110 + * deps: negotiator@0.5.3
111 + - Fix media type parameter matching to be case-insensitive
112 +
113 +1.2.6 / 2015-05-07
114 +==================
115 +
116 + * deps: mime-types@~2.0.11
117 + - deps: mime-db@~1.9.1
118 + * deps: negotiator@0.5.2
119 + - Fix comparing media types with quoted values
120 + - Fix splitting media types with quoted commas
121 +
122 +1.2.5 / 2015-03-13
123 +==================
124 +
125 + * deps: mime-types@~2.0.10
126 + - deps: mime-db@~1.8.0
127 +
128 +1.2.4 / 2015-02-14
129 +==================
130 +
131 + * Support Node.js 0.6
132 + * deps: mime-types@~2.0.9
133 + - deps: mime-db@~1.7.0
134 + * deps: negotiator@0.5.1
135 + - Fix preference sorting to be stable for long acceptable lists
136 +
137 +1.2.3 / 2015-01-31
138 +==================
139 +
140 + * deps: mime-types@~2.0.8
141 + - deps: mime-db@~1.6.0
142 +
143 +1.2.2 / 2014-12-30
144 +==================
145 +
146 + * deps: mime-types@~2.0.7
147 + - deps: mime-db@~1.5.0
148 +
149 +1.2.1 / 2014-12-30
150 +==================
151 +
152 + * deps: mime-types@~2.0.5
153 + - deps: mime-db@~1.3.1
154 +
155 +1.2.0 / 2014-12-19
156 +==================
157 +
158 + * deps: negotiator@0.5.0
159 + - Fix list return order when large accepted list
160 + - Fix missing identity encoding when q=0 exists
161 + - Remove dynamic building of Negotiator class
162 +
163 +1.1.4 / 2014-12-10
164 +==================
165 +
166 + * deps: mime-types@~2.0.4
167 + - deps: mime-db@~1.3.0
168 +
169 +1.1.3 / 2014-11-09
170 +==================
171 +
172 + * deps: mime-types@~2.0.3
173 + - deps: mime-db@~1.2.0
174 +
175 +1.1.2 / 2014-10-14
176 +==================
177 +
178 + * deps: negotiator@0.4.9
179 + - Fix error when media type has invalid parameter
180 +
181 +1.1.1 / 2014-09-28
182 +==================
183 +
184 + * deps: mime-types@~2.0.2
185 + - deps: mime-db@~1.1.0
186 + * deps: negotiator@0.4.8
187 + - Fix all negotiations to be case-insensitive
188 + - Stable sort preferences of same quality according to client order
189 +
190 +1.1.0 / 2014-09-02
191 +==================
192 +
193 + * update `mime-types`
194 +
195 +1.0.7 / 2014-07-04
196 +==================
197 +
198 + * Fix wrong type returned from `type` when match after unknown extension
199 +
200 +1.0.6 / 2014-06-24
201 +==================
202 +
203 + * deps: negotiator@0.4.7
204 +
205 +1.0.5 / 2014-06-20
206 +==================
207 +
208 + * fix crash when unknown extension given
209 +
210 +1.0.4 / 2014-06-19
211 +==================
212 +
213 + * use `mime-types`
214 +
215 +1.0.3 / 2014-06-11
216 +==================
217 +
218 + * deps: negotiator@0.4.6
219 + - Order by specificity when quality is the same
220 +
221 +1.0.2 / 2014-05-29
222 +==================
223 +
224 + * Fix interpretation when header not in request
225 + * deps: pin negotiator@0.4.5
226 +
227 +1.0.1 / 2014-01-18
228 +==================
229 +
230 + * Identity encoding isn't always acceptable
231 + * deps: negotiator@~0.4.0
232 +
233 +1.0.0 / 2013-12-27
234 +==================
235 +
236 + * Genesis
1 +(The MIT License)
2 +
3 +Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
4 +Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
5 +
6 +Permission is hereby granted, free of charge, to any person obtaining
7 +a copy of this software and associated documentation files (the
8 +'Software'), to deal in the Software without restriction, including
9 +without limitation the rights to use, copy, modify, merge, publish,
10 +distribute, sublicense, and/or sell copies of the Software, and to
11 +permit persons to whom the Software is furnished to do so, subject to
12 +the following conditions:
13 +
14 +The above copyright notice and this permission notice shall be
15 +included in all copies or substantial portions of the Software.
16 +
17 +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 +# accepts
2 +
3 +[![NPM Version][npm-version-image]][npm-url]
4 +[![NPM Downloads][npm-downloads-image]][npm-url]
5 +[![Node.js Version][node-version-image]][node-version-url]
6 +[![Build Status][travis-image]][travis-url]
7 +[![Test Coverage][coveralls-image]][coveralls-url]
8 +
9 +Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
10 +Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
11 +
12 +In addition to negotiator, it allows:
13 +
14 +- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
15 + as well as `('text/html', 'application/json')`.
16 +- Allows type shorthands such as `json`.
17 +- Returns `false` when no types match
18 +- Treats non-existent headers as `*`
19 +
20 +## Installation
21 +
22 +This is a [Node.js](https://nodejs.org/en/) module available through the
23 +[npm registry](https://www.npmjs.com/). Installation is done using the
24 +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
25 +
26 +```sh
27 +$ npm install accepts
28 +```
29 +
30 +## API
31 +
32 +<!-- eslint-disable no-unused-vars -->
33 +
34 +```js
35 +var accepts = require('accepts')
36 +```
37 +
38 +### accepts(req)
39 +
40 +Create a new `Accepts` object for the given `req`.
41 +
42 +#### .charset(charsets)
43 +
44 +Return the first accepted charset. If nothing in `charsets` is accepted,
45 +then `false` is returned.
46 +
47 +#### .charsets()
48 +
49 +Return the charsets that the request accepts, in the order of the client's
50 +preference (most preferred first).
51 +
52 +#### .encoding(encodings)
53 +
54 +Return the first accepted encoding. If nothing in `encodings` is accepted,
55 +then `false` is returned.
56 +
57 +#### .encodings()
58 +
59 +Return the encodings that the request accepts, in the order of the client's
60 +preference (most preferred first).
61 +
62 +#### .language(languages)
63 +
64 +Return the first accepted language. If nothing in `languages` is accepted,
65 +then `false` is returned.
66 +
67 +#### .languages()
68 +
69 +Return the languages that the request accepts, in the order of the client's
70 +preference (most preferred first).
71 +
72 +#### .type(types)
73 +
74 +Return the first accepted type (and it is returned as the same text as what
75 +appears in the `types` array). If nothing in `types` is accepted, then `false`
76 +is returned.
77 +
78 +The `types` array can contain full MIME types or file extensions. Any value
79 +that is not a full MIME types is passed to `require('mime-types').lookup`.
80 +
81 +#### .types()
82 +
83 +Return the types that the request accepts, in the order of the client's
84 +preference (most preferred first).
85 +
86 +## Examples
87 +
88 +### Simple type negotiation
89 +
90 +This simple example shows how to use `accepts` to return a different typed
91 +respond body based on what the client wants to accept. The server lists it's
92 +preferences in order and will get back the best match between the client and
93 +server.
94 +
95 +```js
96 +var accepts = require('accepts')
97 +var http = require('http')
98 +
99 +function app (req, res) {
100 + var accept = accepts(req)
101 +
102 + // the order of this list is significant; should be server preferred order
103 + switch (accept.type(['json', 'html'])) {
104 + case 'json':
105 + res.setHeader('Content-Type', 'application/json')
106 + res.write('{"hello":"world!"}')
107 + break
108 + case 'html':
109 + res.setHeader('Content-Type', 'text/html')
110 + res.write('<b>hello, world!</b>')
111 + break
112 + default:
113 + // the fallback is text/plain, so no need to specify it above
114 + res.setHeader('Content-Type', 'text/plain')
115 + res.write('hello, world!')
116 + break
117 + }
118 +
119 + res.end()
120 +}
121 +
122 +http.createServer(app).listen(3000)
123 +```
124 +
125 +You can test this out with the cURL program:
126 +```sh
127 +curl -I -H'Accept: text/html' http://localhost:3000/
128 +```
129 +
130 +## License
131 +
132 +[MIT](LICENSE)
133 +
134 +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
135 +[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
136 +[node-version-image]: https://badgen.net/npm/node/accepts
137 +[node-version-url]: https://nodejs.org/en/download
138 +[npm-downloads-image]: https://badgen.net/npm/dm/accepts
139 +[npm-url]: https://npmjs.org/package/accepts
140 +[npm-version-image]: https://badgen.net/npm/v/accepts
141 +[travis-image]: https://badgen.net/travis/jshttp/accepts/master
142 +[travis-url]: https://travis-ci.org/jshttp/accepts
1 +/*!
2 + * accepts
3 + * Copyright(c) 2014 Jonathan Ong
4 + * Copyright(c) 2015 Douglas Christopher Wilson
5 + * MIT Licensed
6 + */
7 +
8 +'use strict'
9 +
10 +/**
11 + * Module dependencies.
12 + * @private
13 + */
14 +
15 +var Negotiator = require('negotiator')
16 +var mime = require('mime-types')
17 +
18 +/**
19 + * Module exports.
20 + * @public
21 + */
22 +
23 +module.exports = Accepts
24 +
25 +/**
26 + * Create a new Accepts object for the given req.
27 + *
28 + * @param {object} req
29 + * @public
30 + */
31 +
32 +function Accepts (req) {
33 + if (!(this instanceof Accepts)) {
34 + return new Accepts(req)
35 + }
36 +
37 + this.headers = req.headers
38 + this.negotiator = new Negotiator(req)
39 +}
40 +
41 +/**
42 + * Check if the given `type(s)` is acceptable, returning
43 + * the best match when true, otherwise `undefined`, in which
44 + * case you should respond with 406 "Not Acceptable".
45 + *
46 + * The `type` value may be a single mime type string
47 + * such as "application/json", the extension name
48 + * such as "json" or an array `["json", "html", "text/plain"]`. When a list
49 + * or array is given the _best_ match, if any is returned.
50 + *
51 + * Examples:
52 + *
53 + * // Accept: text/html
54 + * this.types('html');
55 + * // => "html"
56 + *
57 + * // Accept: text/*, application/json
58 + * this.types('html');
59 + * // => "html"
60 + * this.types('text/html');
61 + * // => "text/html"
62 + * this.types('json', 'text');
63 + * // => "json"
64 + * this.types('application/json');
65 + * // => "application/json"
66 + *
67 + * // Accept: text/*, application/json
68 + * this.types('image/png');
69 + * this.types('png');
70 + * // => undefined
71 + *
72 + * // Accept: text/*;q=.5, application/json
73 + * this.types(['html', 'json']);
74 + * this.types('html', 'json');
75 + * // => "json"
76 + *
77 + * @param {String|Array} types...
78 + * @return {String|Array|Boolean}
79 + * @public
80 + */
81 +
82 +Accepts.prototype.type =
83 +Accepts.prototype.types = function (types_) {
84 + var types = types_
85 +
86 + // support flattened arguments
87 + if (types && !Array.isArray(types)) {
88 + types = new Array(arguments.length)
89 + for (var i = 0; i < types.length; i++) {
90 + types[i] = arguments[i]
91 + }
92 + }
93 +
94 + // no types, return all requested types
95 + if (!types || types.length === 0) {
96 + return this.negotiator.mediaTypes()
97 + }
98 +
99 + // no accept header, return first given type
100 + if (!this.headers.accept) {
101 + return types[0]
102 + }
103 +
104 + var mimes = types.map(extToMime)
105 + var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
106 + var first = accepts[0]
107 +
108 + return first
109 + ? types[mimes.indexOf(first)]
110 + : false
111 +}
112 +
113 +/**
114 + * Return accepted encodings or best fit based on `encodings`.
115 + *
116 + * Given `Accept-Encoding: gzip, deflate`
117 + * an array sorted by quality is returned:
118 + *
119 + * ['gzip', 'deflate']
120 + *
121 + * @param {String|Array} encodings...
122 + * @return {String|Array}
123 + * @public
124 + */
125 +
126 +Accepts.prototype.encoding =
127 +Accepts.prototype.encodings = function (encodings_) {
128 + var encodings = encodings_
129 +
130 + // support flattened arguments
131 + if (encodings && !Array.isArray(encodings)) {
132 + encodings = new Array(arguments.length)
133 + for (var i = 0; i < encodings.length; i++) {
134 + encodings[i] = arguments[i]
135 + }
136 + }
137 +
138 + // no encodings, return all requested encodings
139 + if (!encodings || encodings.length === 0) {
140 + return this.negotiator.encodings()
141 + }
142 +
143 + return this.negotiator.encodings(encodings)[0] || false
144 +}
145 +
146 +/**
147 + * Return accepted charsets or best fit based on `charsets`.
148 + *
149 + * Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
150 + * an array sorted by quality is returned:
151 + *
152 + * ['utf-8', 'utf-7', 'iso-8859-1']
153 + *
154 + * @param {String|Array} charsets...
155 + * @return {String|Array}
156 + * @public
157 + */
158 +
159 +Accepts.prototype.charset =
160 +Accepts.prototype.charsets = function (charsets_) {
161 + var charsets = charsets_
162 +
163 + // support flattened arguments
164 + if (charsets && !Array.isArray(charsets)) {
165 + charsets = new Array(arguments.length)
166 + for (var i = 0; i < charsets.length; i++) {
167 + charsets[i] = arguments[i]
168 + }
169 + }
170 +
171 + // no charsets, return all requested charsets
172 + if (!charsets || charsets.length === 0) {
173 + return this.negotiator.charsets()
174 + }
175 +
176 + return this.negotiator.charsets(charsets)[0] || false
177 +}
178 +
179 +/**
180 + * Return accepted languages or best fit based on `langs`.
181 + *
182 + * Given `Accept-Language: en;q=0.8, es, pt`
183 + * an array sorted by quality is returned:
184 + *
185 + * ['es', 'pt', 'en']
186 + *
187 + * @param {String|Array} langs...
188 + * @return {Array|String}
189 + * @public
190 + */
191 +
192 +Accepts.prototype.lang =
193 +Accepts.prototype.langs =
194 +Accepts.prototype.language =
195 +Accepts.prototype.languages = function (languages_) {
196 + var languages = languages_
197 +
198 + // support flattened arguments
199 + if (languages && !Array.isArray(languages)) {
200 + languages = new Array(arguments.length)
201 + for (var i = 0; i < languages.length; i++) {
202 + languages[i] = arguments[i]
203 + }
204 + }
205 +
206 + // no languages, return all requested languages
207 + if (!languages || languages.length === 0) {
208 + return this.negotiator.languages()
209 + }
210 +
211 + return this.negotiator.languages(languages)[0] || false
212 +}
213 +
214 +/**
215 + * Convert extnames to mime.
216 + *
217 + * @param {String} type
218 + * @return {String}
219 + * @private
220 + */
221 +
222 +function extToMime (type) {
223 + return type.indexOf('/') === -1
224 + ? mime.lookup(type)
225 + : type
226 +}
227 +
228 +/**
229 + * Check if mime is valid.
230 + *
231 + * @param {String} type
232 + * @return {String}
233 + * @private
234 + */
235 +
236 +function validMime (type) {
237 + return typeof type === 'string'
238 +}
1 +{
2 + "_from": "accepts@~1.3.7",
3 + "_id": "accepts@1.3.7",
4 + "_inBundle": false,
5 + "_integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
6 + "_location": "/accepts",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "accepts@~1.3.7",
12 + "name": "accepts",
13 + "escapedName": "accepts",
14 + "rawSpec": "~1.3.7",
15 + "saveSpec": null,
16 + "fetchSpec": "~1.3.7"
17 + },
18 + "_requiredBy": [
19 + "/express"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
22 + "_shasum": "531bc726517a3b2b41f850021c6cc15eaab507cd",
23 + "_spec": "accepts@~1.3.7",
24 + "_where": "C:\\Users\\10120\\Desktop\\OSS PJ\\project\\express\\node_modules\\express",
25 + "bugs": {
26 + "url": "https://github.com/jshttp/accepts/issues"
27 + },
28 + "bundleDependencies": false,
29 + "contributors": [
30 + {
31 + "name": "Douglas Christopher Wilson",
32 + "email": "doug@somethingdoug.com"
33 + },
34 + {
35 + "name": "Jonathan Ong",
36 + "email": "me@jongleberry.com",
37 + "url": "http://jongleberry.com"
38 + }
39 + ],
40 + "dependencies": {
41 + "mime-types": "~2.1.24",
42 + "negotiator": "0.6.2"
43 + },
44 + "deprecated": false,
45 + "description": "Higher-level content negotiation",
46 + "devDependencies": {
47 + "deep-equal": "1.0.1",
48 + "eslint": "5.16.0",
49 + "eslint-config-standard": "12.0.0",
50 + "eslint-plugin-import": "2.17.2",
51 + "eslint-plugin-markdown": "1.0.0",
52 + "eslint-plugin-node": "8.0.1",
53 + "eslint-plugin-promise": "4.1.1",
54 + "eslint-plugin-standard": "4.0.0",
55 + "mocha": "6.1.4",
56 + "nyc": "14.0.0"
57 + },
58 + "engines": {
59 + "node": ">= 0.6"
60 + },
61 + "files": [
62 + "LICENSE",
63 + "HISTORY.md",
64 + "index.js"
65 + ],
66 + "homepage": "https://github.com/jshttp/accepts#readme",
67 + "keywords": [
68 + "content",
69 + "negotiation",
70 + "accept",
71 + "accepts"
72 + ],
73 + "license": "MIT",
74 + "name": "accepts",
75 + "repository": {
76 + "type": "git",
77 + "url": "git+https://github.com/jshttp/accepts.git"
78 + },
79 + "scripts": {
80 + "lint": "eslint --plugin markdown --ext js,md .",
81 + "test": "mocha --reporter spec --check-leaks --bail test/",
82 + "test-cov": "nyc --reporter=html --reporter=text npm test",
83 + "test-travis": "nyc --reporter=text npm test"
84 + },
85 + "version": "1.3.7"
86 +}
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": "C:\\Users\\10120\\Desktop\\OSS PJ\\project\\express\\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": "C:\\Users\\10120\\Desktop\\OSS PJ\\project\\express\\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": "C:\\Users\\10120\\Desktop\\OSS PJ\\project\\express\\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": "C:\\Users\\10120\\Desktop\\OSS PJ\\project\\express\\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.map(matcher => createPattern(matcher, opts));
90 +
91 + if (testString == null) {
92 + return (testString, ri = false) => {
93 + const returnIndex = typeof ri === 'boolean' ? ri : false;
94 + return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
95 + }
96 + }
97 +
98 + return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
99 +};
100 +
101 +anymatch.default = anymatch;
102 +module.exports = anymatch;
1 +{
2 + "_from": "anymatch@~3.1.1",
3 + "_id": "anymatch@3.1.1",
4 + "_inBundle": false,
5 + "_integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==",
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.1.tgz",
22 + "_shasum": "c55ecf02185e2469259399310c173ce31233b142",
23 + "_spec": "anymatch@~3.1.1",
24 + "_where": "C:\\Users\\10120\\Desktop\\OSS PJ\\project\\express\\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.1"
76 +}
1 +The MIT License (MIT)
2 +
3 +Copyright (c) 2014 Blake Embrey (hello@blakeembrey.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
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.
1 +# Array Flatten
2 +
3 +[![NPM version][npm-image]][npm-url]
4 +[![NPM downloads][downloads-image]][downloads-url]
5 +[![Build status][travis-image]][travis-url]
6 +[![Test coverage][coveralls-image]][coveralls-url]
7 +
8 +> Flatten an array of nested arrays into a single flat array. Accepts an optional depth.
9 +
10 +## Installation
11 +
12 +```
13 +npm install array-flatten --save
14 +```
15 +
16 +## Usage
17 +
18 +```javascript
19 +var flatten = require('array-flatten')
20 +
21 +flatten([1, [2, [3, [4, [5], 6], 7], 8], 9])
22 +//=> [1, 2, 3, 4, 5, 6, 7, 8, 9]
23 +
24 +flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2)
25 +//=> [1, 2, 3, [4, [5], 6], 7, 8, 9]
26 +
27 +(function () {
28 + flatten(arguments) //=> [1, 2, 3]
29 +})(1, [2, 3])
30 +```
31 +
32 +## License
33 +
34 +MIT
35 +
36 +[npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat
37 +[npm-url]: https://npmjs.org/package/array-flatten
38 +[downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat
39 +[downloads-url]: https://npmjs.org/package/array-flatten
40 +[travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat
41 +[travis-url]: https://travis-ci.org/blakeembrey/array-flatten
42 +[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat
43 +[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master
1 +'use strict'
2 +
3 +/**
4 + * Expose `arrayFlatten`.
5 + */
6 +module.exports = arrayFlatten
7 +
8 +/**
9 + * Recursive flatten function with depth.
10 + *
11 + * @param {Array} array
12 + * @param {Array} result
13 + * @param {Number} depth
14 + * @return {Array}
15 + */
16 +function flattenWithDepth (array, result, depth) {
17 + for (var i = 0; i < array.length; i++) {
18 + var value = array[i]
19 +
20 + if (depth > 0 && Array.isArray(value)) {
21 + flattenWithDepth(value, result, depth - 1)
22 + } else {
23 + result.push(value)
24 + }
25 + }
26 +
27 + return result
28 +}
29 +
30 +/**
31 + * Recursive flatten function. Omitting depth is slightly faster.
32 + *
33 + * @param {Array} array
34 + * @param {Array} result
35 + * @return {Array}
36 + */
37 +function flattenForever (array, result) {
38 + for (var i = 0; i < array.length; i++) {
39 + var value = array[i]
40 +
41 + if (Array.isArray(value)) {
42 + flattenForever(value, result)
43 + } else {
44 + result.push(value)
45 + }
46 + }
47 +
48 + return result
49 +}
50 +
51 +/**
52 + * Flatten an array, with the ability to define a depth.
53 + *
54 + * @param {Array} array
55 + * @param {Number} depth
56 + * @return {Array}
57 + */
58 +function arrayFlatten (array, depth) {
59 + if (depth == null) {
60 + return flattenForever(array, [])
61 + }
62 +
63 + return flattenWithDepth(array, [], depth)
64 +}
1 +{
2 + "_from": "array-flatten@1.1.1",
3 + "_id": "array-flatten@1.1.1",
4 + "_inBundle": false,
5 + "_integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=",
6 + "_location": "/array-flatten",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "version",
10 + "registry": true,
11 + "raw": "array-flatten@1.1.1",
12 + "name": "array-flatten",
13 + "escapedName": "array-flatten",
14 + "rawSpec": "1.1.1",
15 + "saveSpec": null,
16 + "fetchSpec": "1.1.1"
17 + },
18 + "_requiredBy": [
19 + "/express"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
22 + "_shasum": "9a5f699051b1e7073328f2a008968b64ea2955d2",
23 + "_spec": "array-flatten@1.1.1",
24 + "_where": "C:\\Users\\10120\\Desktop\\OSS PJ\\project\\express\\node_modules\\express",
25 + "author": {
26 + "name": "Blake Embrey",
27 + "email": "hello@blakeembrey.com",
28 + "url": "http://blakeembrey.me"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/blakeembrey/array-flatten/issues"
32 + },
33 + "bundleDependencies": false,
34 + "deprecated": false,
35 + "description": "Flatten an array of nested arrays into a single flat array",
36 + "devDependencies": {
37 + "istanbul": "^0.3.13",
38 + "mocha": "^2.2.4",
39 + "pre-commit": "^1.0.7",
40 + "standard": "^3.7.3"
41 + },
42 + "files": [
43 + "array-flatten.js",
44 + "LICENSE"
45 + ],
46 + "homepage": "https://github.com/blakeembrey/array-flatten",
47 + "keywords": [
48 + "array",
49 + "flatten",
50 + "arguments",
51 + "depth"
52 + ],
53 + "license": "MIT",
54 + "main": "array-flatten.js",
55 + "name": "array-flatten",
56 + "repository": {
57 + "type": "git",
58 + "url": "git://github.com/blakeembrey/array-flatten.git"
59 + },
60 + "scripts": {
61 + "test": "istanbul cover _mocha -- -R spec"
62 + },
63 + "version": "1.1.1"
64 +}
1 +test
2 +.gitignore
3 +.travis.yml
4 +Makefile
5 +example.js
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 +## License
70 +
71 +(MIT)
72 +
73 +Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
74 +
75 +Permission is hereby granted, free of charge, to any person obtaining a copy of
76 +this software and associated documentation files (the "Software"), to deal in
77 +the Software without restriction, including without limitation the rights to
78 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
79 +of the Software, and to permit persons to whom the Software is furnished to do
80 +so, subject to the following conditions:
81 +
82 +The above copyright notice and this permission notice shall be included in all
83 +copies or substantial portions of the Software.
84 +
85 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
86 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
87 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
88 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
89 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
90 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
91 +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 + begs = [];
32 + left = str.length;
33 +
34 + while (i >= 0 && !result) {
35 + if (i == ai) {
36 + begs.push(i);
37 + ai = str.indexOf(a, i + 1);
38 + } else if (begs.length == 1) {
39 + result = [ begs.pop(), bi ];
40 + } else {
41 + beg = begs.pop();
42 + if (beg < left) {
43 + left = beg;
44 + right = bi;
45 + }
46 +
47 + bi = str.indexOf(b, i + 1);
48 + }
49 +
50 + i = ai < bi && ai >= 0 ? ai : bi;
51 + }
52 +
53 + if (begs.length) {
54 + result = [ left, right ];
55 + }
56 + }
57 +
58 + return result;
59 +}
1 +{
2 + "_from": "balanced-match@^1.0.0",
3 + "_id": "balanced-match@1.0.0",
4 + "_inBundle": false,
5 + "_integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
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.0.tgz",
22 + "_shasum": "89b4d199ab2bee49de164ea02b89ce462d71b767",
23 + "_spec": "balanced-match@^1.0.0",
24 + "_where": "C:\\Users\\10120\\Desktop\\OSS PJ\\project\\express\\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 + "dependencies": {},
35 + "deprecated": false,
36 + "description": "Match balanced character pairs, like \"{\" and \"}\"",
37 + "devDependencies": {
38 + "matcha": "^0.7.0",
39 + "tape": "^4.6.0"
40 + },
41 + "homepage": "https://github.com/juliangruber/balanced-match",
42 + "keywords": [
43 + "match",
44 + "regexp",
45 + "test",
46 + "balanced",
47 + "parse"
48 + ],
49 + "license": "MIT",
50 + "main": "index.js",
51 + "name": "balanced-match",
52 + "repository": {
53 + "type": "git",
54 + "url": "git://github.com/juliangruber/balanced-match.git"
55 + },
56 + "scripts": {
57 + "bench": "make bench",
58 + "test": "make test"
59 + },
60 + "testling": {
61 + "files": "test/*.js",
62 + "browsers": [
63 + "ie/8..latest",
64 + "firefox/20..latest",
65 + "firefox/nightly",
66 + "chrome/25..latest",
67 + "chrome/canary",
68 + "opera/12..latest",
69 + "opera/next",
70 + "safari/5.1..latest",
71 + "ipad/6.0..latest",
72 + "iphone/6.0..latest",
73 + "android-browser/4.2..latest"
74 + ]
75 + },
76 + "version": "1.0.0"
77 +}
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 + "oga",
138 + "ogg",
139 + "ogv",
140 + "otf",
141 + "pages",
142 + "pbm",
143 + "pcx",
144 + "pdb",
145 + "pdf",
146 + "pea",
147 + "pgm",
148 + "pic",
149 + "png",
150 + "pnm",
151 + "pot",
152 + "potm",
153 + "potx",
154 + "ppa",
155 + "ppam",
156 + "ppm",
157 + "pps",
158 + "ppsm",
159 + "ppsx",
160 + "ppt",
161 + "pptm",
162 + "pptx",
163 + "psd",
164 + "pya",
165 + "pyc",
166 + "pyo",
167 + "pyv",
168 + "qt",
169 + "rar",
170 + "ras",
171 + "raw",
172 + "resources",
173 + "rgb",
174 + "rip",
175 + "rlc",
176 + "rmf",
177 + "rmvb",
178 + "rpm",
179 + "rtf",
180 + "rz",
181 + "s3m",
182 + "s7z",
183 + "scpt",
184 + "sgi",
185 + "shar",
186 + "snap",
187 + "sil",
188 + "sketch",
189 + "slk",
190 + "smv",
191 + "snk",
192 + "so",
193 + "stl",
194 + "suo",
195 + "sub",
196 + "swf",
197 + "tar",
198 + "tbz",
199 + "tbz2",
200 + "tga",
201 + "tgz",
202 + "thmx",
203 + "tif",
204 + "tiff",
205 + "tlz",
206 + "ttc",
207 + "ttf",
208 + "txz",
209 + "udf",
210 + "uvh",
211 + "uvi",
212 + "uvm",
213 + "uvp",
214 + "uvs",
215 + "uvu",
216 + "viv",
217 + "vob",
218 + "war",
219 + "wav",
220 + "wax",
221 + "wbmp",
222 + "wdp",
223 + "weba",
224 + "webm",
225 + "webp",
226 + "whl",
227 + "wim",
228 + "wm",
229 + "wma",
230 + "wmv",
231 + "wmx",
232 + "woff",
233 + "woff2",
234 + "wrm",
235 + "wvx",
236 + "xbm",
237 + "xif",
238 + "xla",
239 + "xlam",
240 + "xls",
241 + "xlsb",
242 + "xlsm",
243 + "xlsx",
244 + "xlt",
245 + "xltm",
246 + "xltx",
247 + "xm",
248 + "xmind",
249 + "xpi",
250 + "xpm",
251 + "xwd",
252 + "xz",
253 + "z",
254 + "zip",
255 + "zipx"
256 +]
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.1.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==",
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.1.0.tgz",
22 + "_shasum": "30fa40c9e7fe07dbc895678cd287024dea241dd9",
23 + "_spec": "binary-extensions@^2.0.0",
24 + "_where": "C:\\Users\\10120\\Desktop\\OSS PJ\\project\\express\\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.1.0"
70 +}
1 +# binary-extensions [![Build Status](https://travis-ci.org/sindresorhus/binary-extensions.svg?branch=master)](https://travis-ci.org/sindresorhus/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>
This diff is collapsed. Click to expand it.
1 +(The MIT License)
2 +
3 +Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
4 +Copyright (c) 2014-2015 Douglas Christopher Wilson <doug@somethingdoug.com>
5 +
6 +Permission is hereby granted, free of charge, to any person obtaining
7 +a copy of this software and associated documentation files (the
8 +'Software'), to deal in the Software without restriction, including
9 +without limitation the rights to use, copy, modify, merge, publish,
10 +distribute, sublicense, and/or sell copies of the Software, and to
11 +permit persons to whom the Software is furnished to do so, subject to
12 +the following conditions:
13 +
14 +The above copyright notice and this permission notice shall be
15 +included in all copies or substantial portions of the Software.
16 +
17 +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This diff is collapsed. Click to expand it.
1 +/*!
2 + * body-parser
3 + * Copyright(c) 2014-2015 Douglas Christopher Wilson
4 + * MIT Licensed
5 + */
6 +
7 +'use strict'
8 +
9 +/**
10 + * Module dependencies.
11 + * @private
12 + */
13 +
14 +var deprecate = require('depd')('body-parser')
15 +
16 +/**
17 + * Cache of loaded parsers.
18 + * @private
19 + */
20 +
21 +var parsers = Object.create(null)
22 +
23 +/**
24 + * @typedef Parsers
25 + * @type {function}
26 + * @property {function} json
27 + * @property {function} raw
28 + * @property {function} text
29 + * @property {function} urlencoded
30 + */
31 +
32 +/**
33 + * Module exports.
34 + * @type {Parsers}
35 + */
36 +
37 +exports = module.exports = deprecate.function(bodyParser,
38 + 'bodyParser: use individual json/urlencoded middlewares')
39 +
40 +/**
41 + * JSON parser.
42 + * @public
43 + */
44 +
45 +Object.defineProperty(exports, 'json', {
46 + configurable: true,
47 + enumerable: true,
48 + get: createParserGetter('json')
49 +})
50 +
51 +/**
52 + * Raw parser.
53 + * @public
54 + */
55 +
56 +Object.defineProperty(exports, 'raw', {
57 + configurable: true,
58 + enumerable: true,
59 + get: createParserGetter('raw')
60 +})
61 +
62 +/**
63 + * Text parser.
64 + * @public
65 + */
66 +
67 +Object.defineProperty(exports, 'text', {
68 + configurable: true,
69 + enumerable: true,
70 + get: createParserGetter('text')
71 +})
72 +
73 +/**
74 + * URL-encoded parser.
75 + * @public
76 + */
77 +
78 +Object.defineProperty(exports, 'urlencoded', {
79 + configurable: true,
80 + enumerable: true,
81 + get: createParserGetter('urlencoded')
82 +})
83 +
84 +/**
85 + * Create a middleware to parse json and urlencoded bodies.
86 + *
87 + * @param {object} [options]
88 + * @return {function}
89 + * @deprecated
90 + * @public
91 + */
92 +
93 +function bodyParser (options) {
94 + var opts = {}
95 +
96 + // exclude type option
97 + if (options) {
98 + for (var prop in options) {
99 + if (prop !== 'type') {
100 + opts[prop] = options[prop]
101 + }
102 + }
103 + }
104 +
105 + var _urlencoded = exports.urlencoded(opts)
106 + var _json = exports.json(opts)
107 +
108 + return function bodyParser (req, res, next) {
109 + _json(req, res, function (err) {
110 + if (err) return next(err)
111 + _urlencoded(req, res, next)
112 + })
113 + }
114 +}
115 +
116 +/**
117 + * Create a getter for loading a parser.
118 + * @private
119 + */
120 +
121 +function createParserGetter (name) {
122 + return function get () {
123 + return loadParser(name)
124 + }
125 +}
126 +
127 +/**
128 + * Load a parser module.
129 + * @private
130 + */
131 +
132 +function loadParser (parserName) {
133 + var parser = parsers[parserName]
134 +
135 + if (parser !== undefined) {
136 + return parser
137 + }
138 +
139 + // this uses a switch for static require analysis
140 + switch (parserName) {
141 + case 'json':
142 + parser = require('./lib/types/json')
143 + break
144 + case 'raw':
145 + parser = require('./lib/types/raw')
146 + break
147 + case 'text':
148 + parser = require('./lib/types/text')
149 + break
150 + case 'urlencoded':
151 + parser = require('./lib/types/urlencoded')
152 + break
153 + }
154 +
155 + // store to prevent invoking require()
156 + return (parsers[parserName] = parser)
157 +}
1 +/*!
2 + * body-parser
3 + * Copyright(c) 2014-2015 Douglas Christopher Wilson
4 + * MIT Licensed
5 + */
6 +
7 +'use strict'
8 +
9 +/**
10 + * Module dependencies.
11 + * @private
12 + */
13 +
14 +var createError = require('http-errors')
15 +var getBody = require('raw-body')
16 +var iconv = require('iconv-lite')
17 +var onFinished = require('on-finished')
18 +var zlib = require('zlib')
19 +
20 +/**
21 + * Module exports.
22 + */
23 +
24 +module.exports = read
25 +
26 +/**
27 + * Read a request into a buffer and parse.
28 + *
29 + * @param {object} req
30 + * @param {object} res
31 + * @param {function} next
32 + * @param {function} parse
33 + * @param {function} debug
34 + * @param {object} options
35 + * @private
36 + */
37 +
38 +function read (req, res, next, parse, debug, options) {
39 + var length
40 + var opts = options
41 + var stream
42 +
43 + // flag as parsed
44 + req._body = true
45 +
46 + // read options
47 + var encoding = opts.encoding !== null
48 + ? opts.encoding
49 + : null
50 + var verify = opts.verify
51 +
52 + try {
53 + // get the content stream
54 + stream = contentstream(req, debug, opts.inflate)
55 + length = stream.length
56 + stream.length = undefined
57 + } catch (err) {
58 + return next(err)
59 + }
60 +
61 + // set raw-body options
62 + opts.length = length
63 + opts.encoding = verify
64 + ? null
65 + : encoding
66 +
67 + // assert charset is supported
68 + if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) {
69 + return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
70 + charset: encoding.toLowerCase(),
71 + type: 'charset.unsupported'
72 + }))
73 + }
74 +
75 + // read body
76 + debug('read body')
77 + getBody(stream, opts, function (error, body) {
78 + if (error) {
79 + var _error
80 +
81 + if (error.type === 'encoding.unsupported') {
82 + // echo back charset
83 + _error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
84 + charset: encoding.toLowerCase(),
85 + type: 'charset.unsupported'
86 + })
87 + } else {
88 + // set status code on error
89 + _error = createError(400, error)
90 + }
91 +
92 + // read off entire request
93 + stream.resume()
94 + onFinished(req, function onfinished () {
95 + next(createError(400, _error))
96 + })
97 + return
98 + }
99 +
100 + // verify
101 + if (verify) {
102 + try {
103 + debug('verify body')
104 + verify(req, res, body, encoding)
105 + } catch (err) {
106 + next(createError(403, err, {
107 + body: body,
108 + type: err.type || 'entity.verify.failed'
109 + }))
110 + return
111 + }
112 + }
113 +
114 + // parse
115 + var str = body
116 + try {
117 + debug('parse body')
118 + str = typeof body !== 'string' && encoding !== null
119 + ? iconv.decode(body, encoding)
120 + : body
121 + req.body = parse(str)
122 + } catch (err) {
123 + next(createError(400, err, {
124 + body: str,
125 + type: err.type || 'entity.parse.failed'
126 + }))
127 + return
128 + }
129 +
130 + next()
131 + })
132 +}
133 +
134 +/**
135 + * Get the content stream of the request.
136 + *
137 + * @param {object} req
138 + * @param {function} debug
139 + * @param {boolean} [inflate=true]
140 + * @return {object}
141 + * @api private
142 + */
143 +
144 +function contentstream (req, debug, inflate) {
145 + var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
146 + var length = req.headers['content-length']
147 + var stream
148 +
149 + debug('content-encoding "%s"', encoding)
150 +
151 + if (inflate === false && encoding !== 'identity') {
152 + throw createError(415, 'content encoding unsupported', {
153 + encoding: encoding,
154 + type: 'encoding.unsupported'
155 + })
156 + }
157 +
158 + switch (encoding) {
159 + case 'deflate':
160 + stream = zlib.createInflate()
161 + debug('inflate body')
162 + req.pipe(stream)
163 + break
164 + case 'gzip':
165 + stream = zlib.createGunzip()
166 + debug('gunzip body')
167 + req.pipe(stream)
168 + break
169 + case 'identity':
170 + stream = req
171 + stream.length = length
172 + break
173 + default:
174 + throw createError(415, 'unsupported content encoding "' + encoding + '"', {
175 + encoding: encoding,
176 + type: 'encoding.unsupported'
177 + })
178 + }
179 +
180 + return stream
181 +}
1 +/*!
2 + * body-parser
3 + * Copyright(c) 2014 Jonathan Ong
4 + * Copyright(c) 2014-2015 Douglas Christopher Wilson
5 + * MIT Licensed
6 + */
7 +
8 +'use strict'
9 +
10 +/**
11 + * Module dependencies.
12 + * @private
13 + */
14 +
15 +var bytes = require('bytes')
16 +var contentType = require('content-type')
17 +var createError = require('http-errors')
18 +var debug = require('debug')('body-parser:json')
19 +var read = require('../read')
20 +var typeis = require('type-is')
21 +
22 +/**
23 + * Module exports.
24 + */
25 +
26 +module.exports = json
27 +
28 +/**
29 + * RegExp to match the first non-space in a string.
30 + *
31 + * Allowed whitespace is defined in RFC 7159:
32 + *
33 + * ws = *(
34 + * %x20 / ; Space
35 + * %x09 / ; Horizontal tab
36 + * %x0A / ; Line feed or New line
37 + * %x0D ) ; Carriage return
38 + */
39 +
40 +var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*(.)/ // eslint-disable-line no-control-regex
41 +
42 +/**
43 + * Create a middleware to parse JSON bodies.
44 + *
45 + * @param {object} [options]
46 + * @return {function}
47 + * @public
48 + */
49 +
50 +function json (options) {
51 + var opts = options || {}
52 +
53 + var limit = typeof opts.limit !== 'number'
54 + ? bytes.parse(opts.limit || '100kb')
55 + : opts.limit
56 + var inflate = opts.inflate !== false
57 + var reviver = opts.reviver
58 + var strict = opts.strict !== false
59 + var type = opts.type || 'application/json'
60 + var verify = opts.verify || false
61 +
62 + if (verify !== false && typeof verify !== 'function') {
63 + throw new TypeError('option verify must be function')
64 + }
65 +
66 + // create the appropriate type checking function
67 + var shouldParse = typeof type !== 'function'
68 + ? typeChecker(type)
69 + : type
70 +
71 + function parse (body) {
72 + if (body.length === 0) {
73 + // special-case empty json body, as it's a common client-side mistake
74 + // TODO: maybe make this configurable or part of "strict" option
75 + return {}
76 + }
77 +
78 + if (strict) {
79 + var first = firstchar(body)
80 +
81 + if (first !== '{' && first !== '[') {
82 + debug('strict violation')
83 + throw createStrictSyntaxError(body, first)
84 + }
85 + }
86 +
87 + try {
88 + debug('parse json')
89 + return JSON.parse(body, reviver)
90 + } catch (e) {
91 + throw normalizeJsonSyntaxError(e, {
92 + message: e.message,
93 + stack: e.stack
94 + })
95 + }
96 + }
97 +
98 + return function jsonParser (req, res, next) {
99 + if (req._body) {
100 + debug('body already parsed')
101 + next()
102 + return
103 + }
104 +
105 + req.body = req.body || {}
106 +
107 + // skip requests without bodies
108 + if (!typeis.hasBody(req)) {
109 + debug('skip empty body')
110 + next()
111 + return
112 + }
113 +
114 + debug('content-type %j', req.headers['content-type'])
115 +
116 + // determine if request should be parsed
117 + if (!shouldParse(req)) {
118 + debug('skip parsing')
119 + next()
120 + return
121 + }
122 +
123 + // assert charset per RFC 7159 sec 8.1
124 + var charset = getCharset(req) || 'utf-8'
125 + if (charset.substr(0, 4) !== 'utf-') {
126 + debug('invalid charset')
127 + next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
128 + charset: charset,
129 + type: 'charset.unsupported'
130 + }))
131 + return
132 + }
133 +
134 + // read
135 + read(req, res, next, parse, debug, {
136 + encoding: charset,
137 + inflate: inflate,
138 + limit: limit,
139 + verify: verify
140 + })
141 + }
142 +}
143 +
144 +/**
145 + * Create strict violation syntax error matching native error.
146 + *
147 + * @param {string} str
148 + * @param {string} char
149 + * @return {Error}
150 + * @private
151 + */
152 +
153 +function createStrictSyntaxError (str, char) {
154 + var index = str.indexOf(char)
155 + var partial = str.substring(0, index) + '#'
156 +
157 + try {
158 + JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
159 + } catch (e) {
160 + return normalizeJsonSyntaxError(e, {
161 + message: e.message.replace('#', char),
162 + stack: e.stack
163 + })
164 + }
165 +}
166 +
167 +/**
168 + * Get the first non-whitespace character in a string.
169 + *
170 + * @param {string} str
171 + * @return {function}
172 + * @private
173 + */
174 +
175 +function firstchar (str) {
176 + return FIRST_CHAR_REGEXP.exec(str)[1]
177 +}
178 +
179 +/**
180 + * Get the charset of a request.
181 + *
182 + * @param {object} req
183 + * @api private
184 + */
185 +
186 +function getCharset (req) {
187 + try {
188 + return (contentType.parse(req).parameters.charset || '').toLowerCase()
189 + } catch (e) {
190 + return undefined
191 + }
192 +}
193 +
194 +/**
195 + * Normalize a SyntaxError for JSON.parse.
196 + *
197 + * @param {SyntaxError} error
198 + * @param {object} obj
199 + * @return {SyntaxError}
200 + */
201 +
202 +function normalizeJsonSyntaxError (error, obj) {
203 + var keys = Object.getOwnPropertyNames(error)
204 +
205 + for (var i = 0; i < keys.length; i++) {
206 + var key = keys[i]
207 + if (key !== 'stack' && key !== 'message') {
208 + delete error[key]
209 + }
210 + }
211 +
212 + // replace stack before message for Node.js 0.10 and below
213 + error.stack = obj.stack.replace(error.message, obj.message)
214 + error.message = obj.message
215 +
216 + return error
217 +}
218 +
219 +/**
220 + * Get the simple type checker.
221 + *
222 + * @param {string} type
223 + * @return {function}
224 + */
225 +
226 +function typeChecker (type) {
227 + return function checkType (req) {
228 + return Boolean(typeis(req, type))
229 + }
230 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.