고승완

Add base code

Showing 1000 changed files with 4746 additions and 0 deletions

Too many changes to show.

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

1 +# Auto detect text files and perform LF normalization
2 +* text=auto
1 +var express = require('express')
2 +var app = express()
3 +var bodyParser = require('body-parser')
4 +var router = require('./router/index')
5 +var passport = require('passport')
6 +var LocalStrategy = require('passport-local').Strategy
7 +var session = require('express-session')
8 +var flash = require('connect-flash')
9 +const PORT = 3000
10 +
11 +// using bodyParser
12 +app.use(bodyParser.json())
13 +app.use(bodyParser.urlencoded({extended:true}))
14 +app.use(express.static(__dirname + "/public")); // static directory
15 +app.set('view engine', 'ejs')
16 +
17 +app.use(session({
18 + secret: 'keyboard cat',
19 + resave: false,
20 + saveUninitialized: true
21 +}))
22 +app.use(passport.initialize())
23 +app.use(passport.session())
24 +app.use(flash())
25 +app.use(router) // router 정의
26 +
27 +// Server On
28 +app.listen(PORT, function(){
29 + console.log("Express server ON port "+PORT);
30 +});
...\ 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/../ejs/bin/cli.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../ejs/bin/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%\..\ejs\bin\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/../ejs/bin/cli.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../ejs/bin/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/../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/../jake/bin/cli.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../jake/bin/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%\..\jake\bin\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/../jake/bin/cli.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../jake/bin/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/../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\\KoMoGoon\\documents\\github\\web_project2\\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\\KoMoGoon\\documents\\github\\web_project2\\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\\KoMoGoon\\documents\\github\\web_project2\\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\\KoMoGoon\\documents\\github\\web_project2\\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 +# Changelog
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 +### [3.0.1](https://github.com/nexdrew/ansi-align/compare/v3.0.0...v3.0.1) (2021-09-27)
6 +
7 +
8 +### Bug Fixes
9 +
10 +* **package:** update string-width to version 4.1.0 ([#52](https://github.com/nexdrew/ansi-align/issues/52)) ([ab5b733](https://github.com/nexdrew/ansi-align/commit/ab5b733b1c30eef87b75e15459f2216db28d7ed3))
11 +
12 +<a name="3.0.0"></a>
13 +# [3.0.0](https://github.com/nexdrew/ansi-align/compare/v2.0.0...v3.0.0) (2018-12-17)
14 +
15 +
16 +### Bug Fixes
17 +
18 +* **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))
19 +
20 +
21 +### BREAKING CHANGES
22 +
23 +* **package:** Node 4 no longer supported, please update to Node 6+ or use ansi-align@2.0.0
24 +
25 +
26 +
27 +<a name="2.0.0"></a>
28 +# [2.0.0](https://github.com/nexdrew/ansi-align/compare/v1.1.0...v2.0.0) (2017-05-01)
29 +
30 +
31 +### Features
32 +
33 +* ES2015ify, dropping support for Node <4 ([#30](https://github.com/nexdrew/ansi-align/issues/30)) ([7b43f48](https://github.com/nexdrew/ansi-align/commit/7b43f48))
34 +
35 +
36 +### BREAKING CHANGES
37 +
38 +* Node 0.10 or 0.12 no longer supported, please update to Node 4+ or use ansi-align@1.1.0
39 +
40 +
41 +
42 +<a name="1.1.0"></a>
43 +# [1.1.0](https://github.com/nexdrew/ansi-align/compare/v1.0.0...v1.1.0) (2016-06-06)
44 +
45 +
46 +### Features
47 +
48 +* support left-alignment as no-op ([#3](https://github.com/nexdrew/ansi-align/issues/3)) ([e581db6](https://github.com/nexdrew/ansi-align/commit/e581db6))
49 +
50 +
51 +
52 +<a name="1.0.0"></a>
53 +# 1.0.0 (2016-04-30)
54 +
55 +
56 +### Features
57 +
58 +* 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 +{
2 + "_from": "ansi-align@^3.0.0",
3 + "_id": "ansi-align@3.0.1",
4 + "_inBundle": false,
5 + "_integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==",
6 + "_location": "/ansi-align",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "ansi-align@^3.0.0",
12 + "name": "ansi-align",
13 + "escapedName": "ansi-align",
14 + "rawSpec": "^3.0.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^3.0.0"
17 + },
18 + "_requiredBy": [
19 + "/boxen"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz",
22 + "_shasum": "0cdf12e111ace773a86e9a1fad1225c43cb19a59",
23 + "_spec": "ansi-align@^3.0.0",
24 + "_where": "C:\\Users\\KoMoGoon\\documents\\github\\web_project2\\node_modules\\boxen",
25 + "author": {
26 + "name": "nexdrew"
27 + },
28 + "bugs": {
29 + "url": "https://github.com/nexdrew/ansi-align/issues"
30 + },
31 + "bundleDependencies": false,
32 + "dependencies": {
33 + "string-width": "^4.1.0"
34 + },
35 + "deprecated": false,
36 + "description": "align-text with ANSI support for CLIs",
37 + "devDependencies": {
38 + "ava": "^2.0.0",
39 + "chalk": "^2.4.2",
40 + "coveralls": "^3.0.3",
41 + "nyc": "^14.0.0",
42 + "standard": "^14.0.0",
43 + "standard-version": "^7.0.0"
44 + },
45 + "files": [
46 + "index.js"
47 + ],
48 + "homepage": "https://github.com/nexdrew/ansi-align#readme",
49 + "keywords": [
50 + "ansi",
51 + "align",
52 + "cli",
53 + "center",
54 + "pad"
55 + ],
56 + "license": "ISC",
57 + "main": "index.js",
58 + "name": "ansi-align",
59 + "repository": {
60 + "type": "git",
61 + "url": "git+https://github.com/nexdrew/ansi-align.git"
62 + },
63 + "scripts": {
64 + "coverage": "nyc report --reporter=text-lcov | coveralls",
65 + "pretest": "standard",
66 + "release": "standard-version",
67 + "test": "nyc ava"
68 + },
69 + "version": "3.0.1"
70 +}
1 +declare namespace ansiRegex {
2 + interface Options {
3 + /**
4 + Match only the first ANSI escape.
5 +
6 + @default false
7 + */
8 + onlyFirst: boolean;
9 + }
10 +}
11 +
12 +/**
13 +Regular expression for matching ANSI escape codes.
14 +
15 +@example
16 +```
17 +import ansiRegex = require('ansi-regex');
18 +
19 +ansiRegex().test('\u001B[4mcake\u001B[0m');
20 +//=> true
21 +
22 +ansiRegex().test('cake');
23 +//=> false
24 +
25 +'\u001B[4mcake\u001B[0m'.match(ansiRegex());
26 +//=> ['\u001B[4m', '\u001B[0m']
27 +
28 +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
29 +//=> ['\u001B[4m']
30 +
31 +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
32 +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
33 +```
34 +*/
35 +declare function ansiRegex(options?: ansiRegex.Options): RegExp;
36 +
37 +export = ansiRegex;
1 +'use strict';
2 +
3 +module.exports = ({onlyFirst = false} = {}) => {
4 + const pattern = [
5 + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
6 + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
7 + ].join('|');
8 +
9 + return new RegExp(pattern, onlyFirst ? undefined : 'g');
10 +};
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@^5.0.1",
3 + "_id": "ansi-regex@5.0.1",
4 + "_inBundle": false,
5 + "_integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
6 + "_location": "/ansi-regex",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "ansi-regex@^5.0.1",
12 + "name": "ansi-regex",
13 + "escapedName": "ansi-regex",
14 + "rawSpec": "^5.0.1",
15 + "saveSpec": null,
16 + "fetchSpec": "^5.0.1"
17 + },
18 + "_requiredBy": [
19 + "/strip-ansi"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
22 + "_shasum": "082cb2c89c9fe8659a311a53bd6a4dc5301db304",
23 + "_spec": "ansi-regex@^5.0.1",
24 + "_where": "C:\\Users\\KoMoGoon\\documents\\github\\web_project2\\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": "^2.4.0",
38 + "tsd": "^0.9.0",
39 + "xo": "^0.25.3"
40 + },
41 + "engines": {
42 + "node": ">=8"
43 + },
44 + "files": [
45 + "index.js",
46 + "index.d.ts"
47 + ],
48 + "homepage": "https://github.com/chalk/ansi-regex#readme",
49 + "keywords": [
50 + "ansi",
51 + "styles",
52 + "color",
53 + "colour",
54 + "colors",
55 + "terminal",
56 + "console",
57 + "cli",
58 + "string",
59 + "tty",
60 + "escape",
61 + "formatting",
62 + "rgb",
63 + "256",
64 + "shell",
65 + "xterm",
66 + "command-line",
67 + "text",
68 + "regex",
69 + "regexp",
70 + "re",
71 + "match",
72 + "test",
73 + "find",
74 + "pattern"
75 + ],
76 + "license": "MIT",
77 + "name": "ansi-regex",
78 + "repository": {
79 + "type": "git",
80 + "url": "git+https://github.com/chalk/ansi-regex.git"
81 + },
82 + "scripts": {
83 + "test": "xo && ava && tsd",
84 + "view-supported": "node fixtures/view-codes.js"
85 + },
86 + "version": "5.0.1"
87 +}
1 +# ansi-regex
2 +
3 +> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
4 +
5 +
6 +## Install
7 +
8 +```
9 +$ npm install ansi-regex
10 +```
11 +
12 +
13 +## Usage
14 +
15 +```js
16 +const ansiRegex = require('ansi-regex');
17 +
18 +ansiRegex().test('\u001B[4mcake\u001B[0m');
19 +//=> true
20 +
21 +ansiRegex().test('cake');
22 +//=> false
23 +
24 +'\u001B[4mcake\u001B[0m'.match(ansiRegex());
25 +//=> ['\u001B[4m', '\u001B[0m']
26 +
27 +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
28 +//=> ['\u001B[4m']
29 +
30 +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
31 +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
32 +```
33 +
34 +
35 +## API
36 +
37 +### ansiRegex(options?)
38 +
39 +Returns a regex for matching ANSI escape codes.
40 +
41 +#### options
42 +
43 +Type: `object`
44 +
45 +##### onlyFirst
46 +
47 +Type: `boolean`<br>
48 +Default: `false` *(Matches any ANSI escape codes in a string)*
49 +
50 +Match only the first ANSI escape.
51 +
52 +
53 +## FAQ
54 +
55 +### Why do you test for codes not in the ECMA 48 standard?
56 +
57 +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.
58 +
59 +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.
60 +
61 +
62 +## Maintainers
63 +
64 +- [Sindre Sorhus](https://github.com/sindresorhus)
65 +- [Josh Junon](https://github.com/qix-)
66 +
67 +
68 +---
69 +
70 +<div align="center">
71 + <b>
72 + <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>
73 + </b>
74 + <br>
75 + <sub>
76 + Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
77 + </sub>
78 +</div>
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 + "/wrap-ansi"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
23 + "_shasum": "edd803628ae71c04c85ae7a0906edad34b648937",
24 + "_spec": "ansi-styles@^4.1.0",
25 + "_where": "C:\\Users\\KoMoGoon\\documents\\github\\web_project2\\node_modules\\chalk",
26 + "author": {
27 + "name": "Sindre Sorhus",
28 + "email": "sindresorhus@gmail.com",
29 + "url": "sindresorhus.com"
30 + },
31 + "bugs": {
32 + "url": "https://github.com/chalk/ansi-styles/issues"
33 + },
34 + "bundleDependencies": false,
35 + "dependencies": {
36 + "color-convert": "^2.0.1"
37 + },
38 + "deprecated": false,
39 + "description": "ANSI escape codes for styling strings in the terminal",
40 + "devDependencies": {
41 + "@types/color-convert": "^1.9.0",
42 + "ava": "^2.3.0",
43 + "svg-term-cli": "^2.1.1",
44 + "tsd": "^0.11.0",
45 + "xo": "^0.25.3"
46 + },
47 + "engines": {
48 + "node": ">=8"
49 + },
50 + "files": [
51 + "index.js",
52 + "index.d.ts"
53 + ],
54 + "funding": "https://github.com/chalk/ansi-styles?sponsor=1",
55 + "homepage": "https://github.com/chalk/ansi-styles#readme",
56 + "keywords": [
57 + "ansi",
58 + "styles",
59 + "color",
60 + "colour",
61 + "colors",
62 + "terminal",
63 + "console",
64 + "cli",
65 + "string",
66 + "tty",
67 + "escape",
68 + "formatting",
69 + "rgb",
70 + "256",
71 + "shell",
72 + "xterm",
73 + "log",
74 + "logging",
75 + "command-line",
76 + "text"
77 + ],
78 + "license": "MIT",
79 + "name": "ansi-styles",
80 + "repository": {
81 + "type": "git",
82 + "url": "git+https://github.com/chalk/ansi-styles.git"
83 + },
84 + "scripts": {
85 + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor",
86 + "test": "xo && ava && tsd"
87 + },
88 + "version": "4.3.0"
89 +}
1 +# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
2 +
3 +> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
4 +
5 +You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
6 +
7 +<img src="screenshot.svg" width="900">
8 +
9 +## Install
10 +
11 +```
12 +$ npm install ansi-styles
13 +```
14 +
15 +## Usage
16 +
17 +```js
18 +const style = require('ansi-styles');
19 +
20 +console.log(`${style.green.open}Hello world!${style.green.close}`);
21 +
22 +
23 +// Color conversion between 16/256/truecolor
24 +// NOTE: If conversion goes to 16 colors or 256 colors, the original color
25 +// may be degraded to fit that color palette. This means terminals
26 +// that do not support 16 million colors will best-match the
27 +// original color.
28 +console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
29 +console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
30 +console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close);
31 +```
32 +
33 +## API
34 +
35 +Each style has an `open` and `close` property.
36 +
37 +## Styles
38 +
39 +### Modifiers
40 +
41 +- `reset`
42 +- `bold`
43 +- `dim`
44 +- `italic` *(Not widely supported)*
45 +- `underline`
46 +- `inverse`
47 +- `hidden`
48 +- `strikethrough` *(Not widely supported)*
49 +
50 +### Colors
51 +
52 +- `black`
53 +- `red`
54 +- `green`
55 +- `yellow`
56 +- `blue`
57 +- `magenta`
58 +- `cyan`
59 +- `white`
60 +- `blackBright` (alias: `gray`, `grey`)
61 +- `redBright`
62 +- `greenBright`
63 +- `yellowBright`
64 +- `blueBright`
65 +- `magentaBright`
66 +- `cyanBright`
67 +- `whiteBright`
68 +
69 +### Background colors
70 +
71 +- `bgBlack`
72 +- `bgRed`
73 +- `bgGreen`
74 +- `bgYellow`
75 +- `bgBlue`
76 +- `bgMagenta`
77 +- `bgCyan`
78 +- `bgWhite`
79 +- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
80 +- `bgRedBright`
81 +- `bgGreenBright`
82 +- `bgYellowBright`
83 +- `bgBlueBright`
84 +- `bgMagentaBright`
85 +- `bgCyanBright`
86 +- `bgWhiteBright`
87 +
88 +## Advanced usage
89 +
90 +By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
91 +
92 +- `style.modifier`
93 +- `style.color`
94 +- `style.bgColor`
95 +
96 +###### Example
97 +
98 +```js
99 +console.log(style.color.green.open);
100 +```
101 +
102 +Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
103 +
104 +###### Example
105 +
106 +```js
107 +console.log(style.codes.get(36));
108 +//=> 39
109 +```
110 +
111 +## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
112 +
113 +`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
114 +
115 +The following color spaces from `color-convert` are supported:
116 +
117 +- `rgb`
118 +- `hex`
119 +- `keyword`
120 +- `hsl`
121 +- `hsv`
122 +- `hwb`
123 +- `ansi`
124 +- `ansi256`
125 +
126 +To use these, call the associated conversion function with the intended output, for example:
127 +
128 +```js
129 +style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
130 +style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
131 +
132 +style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
133 +style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
134 +
135 +style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
136 +style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
137 +```
138 +
139 +## Related
140 +
141 +- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
142 +
143 +## Maintainers
144 +
145 +- [Sindre Sorhus](https://github.com/sindresorhus)
146 +- [Josh Junon](https://github.com/qix-)
147 +
148 +## For enterprise
149 +
150 +Available as part of the Tidelift Subscription.
151 +
152 +The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
1 +The ISC License
2 +
3 +Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com)
4 +
5 +Permission to use, copy, modify, and/or distribute this software for any
6 +purpose with or without fee is hereby granted, provided that the above
7 +copyright notice and this permission notice appear in all copies.
8 +
9 +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15 +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1 +anymatch [![Build Status](https://travis-ci.org/micromatch/anymatch.svg?branch=master)](https://travis-ci.org/micromatch/anymatch) [![Coverage Status](https://img.shields.io/coveralls/micromatch/anymatch.svg?branch=master)](https://coveralls.io/r/micromatch/anymatch?branch=master)
2 +======
3 +Javascript module to match a string against a regular expression, glob, string,
4 +or function that takes the string as an argument and returns a truthy or falsy
5 +value. The matcher can also be an array of any or all of these. Useful for
6 +allowing a very flexible user-defined config to define things like file paths.
7 +
8 +__Note: This module has Bash-parity, please be aware that Windows-style backslashes are not supported as separators. See https://github.com/micromatch/micromatch#backslashes for more information.__
9 +
10 +
11 +Usage
12 +-----
13 +```sh
14 +npm install anymatch
15 +```
16 +
17 +#### anymatch(matchers, testString, [returnIndex], [options])
18 +* __matchers__: (_Array|String|RegExp|Function_)
19 +String to be directly matched, string with glob patterns, regular expression
20 +test, function that takes the testString as an argument and returns a truthy
21 +value if it should be matched, or an array of any number and mix of these types.
22 +* __testString__: (_String|Array_) The string to test against the matchers. If
23 +passed as an array, the first element of the array will be used as the
24 +`testString` for non-function matchers, while the entire array will be applied
25 +as the arguments for function matchers.
26 +* __options__: (_Object_ [optional]_) Any of the [picomatch](https://github.com/micromatch/picomatch#options) options.
27 + * __returnIndex__: (_Boolean [optional]_) If true, return the array index of
28 +the first matcher that that testString matched, or -1 if no match, instead of a
29 +boolean result.
30 +
31 +```js
32 +const anymatch = require('anymatch');
33 +
34 +const matchers = [ 'path/to/file.js', 'path/anyjs/**/*.js', /foo.js$/, string => string.includes('bar') && string.length > 10 ] ;
35 +
36 +anymatch(matchers, 'path/to/file.js'); // true
37 +anymatch(matchers, 'path/anyjs/baz.js'); // true
38 +anymatch(matchers, 'path/to/foo.js'); // true
39 +anymatch(matchers, 'path/to/bar.js'); // true
40 +anymatch(matchers, 'bar.js'); // false
41 +
42 +// returnIndex = true
43 +anymatch(matchers, 'foo.js', {returnIndex: true}); // 2
44 +anymatch(matchers, 'path/anyjs/foo.js', {returnIndex: true}); // 1
45 +
46 +// any picomatc
47 +
48 +// using globs to match directories and their children
49 +anymatch('node_modules', 'node_modules'); // true
50 +anymatch('node_modules', 'node_modules/somelib/index.js'); // false
51 +anymatch('node_modules/**', 'node_modules/somelib/index.js'); // true
52 +anymatch('node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // false
53 +anymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // true
54 +
55 +const matcher = anymatch(matchers);
56 +['foo.js', 'bar.js'].filter(matcher); // [ 'foo.js' ]
57 +anymatch master*
58 +
59 +```
60 +
61 +#### anymatch(matchers)
62 +You can also pass in only your matcher(s) to get a curried function that has
63 +already been bound to the provided matching criteria. This can be used as an
64 +`Array#filter` callback.
65 +
66 +```js
67 +var matcher = anymatch(matchers);
68 +
69 +matcher('path/to/file.js'); // true
70 +matcher('path/anyjs/baz.js', true); // 1
71 +
72 +['foo.js', 'bar.js'].filter(matcher); // ['foo.js']
73 +```
74 +
75 +Changelog
76 +----------
77 +[See release notes page on GitHub](https://github.com/micromatch/anymatch/releases)
78 +
79 +- **v3.0:** Removed `startIndex` and `endIndex` arguments. Node 8.x-only.
80 +- **v2.0:** [micromatch](https://github.com/jonschlinkert/micromatch) moves away from minimatch-parity and inline with Bash. This includes handling backslashes differently (see https://github.com/micromatch/micromatch#backslashes for more information).
81 +- **v1.2:** anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch)
82 +for glob pattern matching. Issues with glob pattern matching should be
83 +reported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues).
84 +
85 +License
86 +-------
87 +[ISC](https://raw.github.com/micromatch/anymatch/master/LICENSE)
1 +type AnymatchFn = (testString: string) => boolean;
2 +type AnymatchPattern = string|RegExp|AnymatchFn;
3 +type AnymatchMatcher = AnymatchPattern|AnymatchPattern[]
4 +type AnymatchTester = {
5 + (testString: string|any[], returnIndex: true): number;
6 + (testString: string|any[]): boolean;
7 +}
8 +
9 +type PicomatchOptions = {dot: boolean};
10 +
11 +declare const anymatch: {
12 + (matchers: AnymatchMatcher): AnymatchTester;
13 + (matchers: AnymatchMatcher, testString: string|any[], returnIndex: true | PicomatchOptions): number;
14 + (matchers: AnymatchMatcher, testString: string|any[]): boolean;
15 +}
16 +
17 +export {AnymatchMatcher as Matcher}
18 +export {AnymatchTester as Tester}
19 +export default anymatch
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", { value: true });
4 +
5 +const picomatch = require('picomatch');
6 +const normalizePath = require('normalize-path');
7 +
8 +/**
9 + * @typedef {(testString: string) => boolean} AnymatchFn
10 + * @typedef {string|RegExp|AnymatchFn} AnymatchPattern
11 + * @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher
12 + */
13 +const BANG = '!';
14 +const DEFAULT_OPTIONS = {returnIndex: false};
15 +const arrify = (item) => Array.isArray(item) ? item : [item];
16 +
17 +/**
18 + * @param {AnymatchPattern} matcher
19 + * @param {object} options
20 + * @returns {AnymatchFn}
21 + */
22 +const createPattern = (matcher, options) => {
23 + if (typeof matcher === 'function') {
24 + return matcher;
25 + }
26 + if (typeof matcher === 'string') {
27 + const glob = picomatch(matcher, options);
28 + return (string) => matcher === string || glob(string);
29 + }
30 + if (matcher instanceof RegExp) {
31 + return (string) => matcher.test(string);
32 + }
33 + return (string) => false;
34 +};
35 +
36 +/**
37 + * @param {Array<Function>} patterns
38 + * @param {Array<Function>} negPatterns
39 + * @param {String|Array} args
40 + * @param {Boolean} returnIndex
41 + * @returns {boolean|number}
42 + */
43 +const matchPatterns = (patterns, negPatterns, args, returnIndex) => {
44 + const isList = Array.isArray(args);
45 + const _path = isList ? args[0] : args;
46 + if (!isList && typeof _path !== 'string') {
47 + throw new TypeError('anymatch: second argument must be a string: got ' +
48 + Object.prototype.toString.call(_path))
49 + }
50 + const path = normalizePath(_path);
51 +
52 + for (let index = 0; index < negPatterns.length; index++) {
53 + const nglob = negPatterns[index];
54 + if (nglob(path)) {
55 + return returnIndex ? -1 : false;
56 + }
57 + }
58 +
59 + const applied = isList && [path].concat(args.slice(1));
60 + for (let index = 0; index < patterns.length; index++) {
61 + const pattern = patterns[index];
62 + if (isList ? pattern(...applied) : pattern(path)) {
63 + return returnIndex ? index : true;
64 + }
65 + }
66 +
67 + return returnIndex ? -1 : false;
68 +};
69 +
70 +/**
71 + * @param {AnymatchMatcher} matchers
72 + * @param {Array|string} testString
73 + * @param {object} options
74 + * @returns {boolean|number|Function}
75 + */
76 +const anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => {
77 + if (matchers == null) {
78 + throw new TypeError('anymatch: specify first argument');
79 + }
80 + const opts = typeof options === 'boolean' ? {returnIndex: options} : options;
81 + const returnIndex = opts.returnIndex || false;
82 +
83 + // Early cache for matchers.
84 + const mtchers = arrify(matchers);
85 + const negatedGlobs = mtchers
86 + .filter(item => typeof item === 'string' && item.charAt(0) === BANG)
87 + .map(item => item.slice(1))
88 + .map(item => picomatch(item, opts));
89 + const patterns = mtchers
90 + .filter(item => typeof item !== 'string' || (typeof item === 'string' && item.charAt(0) !== BANG))
91 + .map(matcher => createPattern(matcher, opts));
92 +
93 + if (testString == null) {
94 + return (testString, ri = false) => {
95 + const returnIndex = typeof ri === 'boolean' ? ri : false;
96 + return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
97 + }
98 + }
99 +
100 + return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
101 +};
102 +
103 +anymatch.default = anymatch;
104 +module.exports = anymatch;
1 +{
2 + "_from": "anymatch@~3.1.2",
3 + "_id": "anymatch@3.1.2",
4 + "_inBundle": false,
5 + "_integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
6 + "_location": "/anymatch",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "anymatch@~3.1.2",
12 + "name": "anymatch",
13 + "escapedName": "anymatch",
14 + "rawSpec": "~3.1.2",
15 + "saveSpec": null,
16 + "fetchSpec": "~3.1.2"
17 + },
18 + "_requiredBy": [
19 + "/chokidar"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
22 + "_shasum": "c0557c096af32f106198f4f4e2a383537e378716",
23 + "_spec": "anymatch@~3.1.2",
24 + "_where": "C:\\Users\\KoMoGoon\\documents\\github\\web_project2\\node_modules\\chokidar",
25 + "author": {
26 + "name": "Elan Shanker",
27 + "url": "https://github.com/es128"
28 + },
29 + "bugs": {
30 + "url": "https://github.com/micromatch/anymatch/issues"
31 + },
32 + "bundleDependencies": false,
33 + "dependencies": {
34 + "normalize-path": "^3.0.0",
35 + "picomatch": "^2.0.4"
36 + },
37 + "deprecated": false,
38 + "description": "Matches strings against configurable strings, globs, regular expressions, and/or functions",
39 + "devDependencies": {
40 + "mocha": "^6.1.3",
41 + "nyc": "^14.0.0"
42 + },
43 + "engines": {
44 + "node": ">= 8"
45 + },
46 + "files": [
47 + "index.js",
48 + "index.d.ts"
49 + ],
50 + "homepage": "https://github.com/micromatch/anymatch",
51 + "keywords": [
52 + "match",
53 + "any",
54 + "string",
55 + "file",
56 + "fs",
57 + "list",
58 + "glob",
59 + "regex",
60 + "regexp",
61 + "regular",
62 + "expression",
63 + "function"
64 + ],
65 + "license": "ISC",
66 + "name": "anymatch",
67 + "repository": {
68 + "type": "git",
69 + "url": "git+https://github.com/micromatch/anymatch.git"
70 + },
71 + "scripts": {
72 + "mocha": "mocha",
73 + "test": "nyc mocha"
74 + },
75 + "version": "3.1.2"
76 +}
1 +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\\KoMoGoon\\documents\\github\\web_project2\\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 +language: node_js
2 +node_js:
3 + - "0.10"
4 + - "0.12"
5 + - "iojs"
1 +Copyright (c) 2010-2014 Caolan McMahon
2 +
3 +Permission is hereby granted, free of charge, to any person obtaining a copy
4 +of this software and associated documentation files (the "Software"), to deal
5 +in the Software without restriction, including without limitation the rights
6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 +copies of the Software, and to permit persons to whom the Software is
8 +furnished to do so, subject to the following conditions:
9 +
10 +The above copyright notice and this permission notice shall be included in
11 +all copies or substantial portions of the Software.
12 +
13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 +THE SOFTWARE.
This diff is collapsed. Click to expand it.
1 +{
2 + "name": "async",
3 + "description": "Higher-order functions and common patterns for asynchronous code",
4 + "version": "0.9.2",
5 + "main": "lib/async.js",
6 + "keywords": [
7 + "async",
8 + "callback",
9 + "utility",
10 + "module"
11 + ],
12 + "license": "MIT",
13 + "repository": {
14 + "type": "git",
15 + "url": "https://github.com/caolan/async.git"
16 + },
17 + "devDependencies": {
18 + "nodeunit": ">0.0.0",
19 + "uglify-js": "1.2.x",
20 + "nodelint": ">0.0.0",
21 + "lodash": ">=2.4.1"
22 + },
23 + "moduleType": [
24 + "amd",
25 + "globals",
26 + "node"
27 + ],
28 + "ignore": [
29 + "**/.*",
30 + "node_modules",
31 + "bower_components",
32 + "test",
33 + "tests"
34 + ],
35 + "authors": [
36 + "Caolan McMahon"
37 + ]
38 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "async",
3 + "description": "Higher-order functions and common patterns for asynchronous code",
4 + "version": "0.9.2",
5 + "keywords": [
6 + "async",
7 + "callback",
8 + "utility",
9 + "module"
10 + ],
11 + "license": "MIT",
12 + "repository": "caolan/async",
13 + "scripts": [
14 + "lib/async.js"
15 + ]
16 +}
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
1 +{
2 + "_from": "async@0.9.x",
3 + "_id": "async@0.9.2",
4 + "_inBundle": false,
5 + "_integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=",
6 + "_location": "/async",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "async@0.9.x",
12 + "name": "async",
13 + "escapedName": "async",
14 + "rawSpec": "0.9.x",
15 + "saveSpec": null,
16 + "fetchSpec": "0.9.x"
17 + },
18 + "_requiredBy": [
19 + "/jake"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
22 + "_shasum": "aea74d5e61c1f899613bf64bda66d4c78f2fd17d",
23 + "_spec": "async@0.9.x",
24 + "_where": "C:\\Users\\KoMoGoon\\Documents\\GitHub\\Web_Project2\\node_modules\\jake",
25 + "author": {
26 + "name": "Caolan McMahon"
27 + },
28 + "bugs": {
29 + "url": "https://github.com/caolan/async/issues"
30 + },
31 + "bundleDependencies": false,
32 + "deprecated": false,
33 + "description": "Higher-order functions and common patterns for asynchronous code",
34 + "devDependencies": {
35 + "lodash": ">=2.4.1",
36 + "nodelint": ">0.0.0",
37 + "nodeunit": ">0.0.0",
38 + "uglify-js": "1.2.x"
39 + },
40 + "homepage": "https://github.com/caolan/async#readme",
41 + "jam": {
42 + "main": "lib/async.js",
43 + "include": [
44 + "lib/async.js",
45 + "README.md",
46 + "LICENSE"
47 + ],
48 + "categories": [
49 + "Utilities"
50 + ]
51 + },
52 + "keywords": [
53 + "async",
54 + "callback",
55 + "utility",
56 + "module"
57 + ],
58 + "license": "MIT",
59 + "main": "lib/async.js",
60 + "name": "async",
61 + "repository": {
62 + "type": "git",
63 + "url": "git+https://github.com/caolan/async.git"
64 + },
65 + "scripts": {
66 + "test": "nodeunit test/test-async.js"
67 + },
68 + "spm": {
69 + "main": "lib/async.js"
70 + },
71 + "version": "0.9.2",
72 + "volo": {
73 + "main": "lib/async.js",
74 + "ignore": [
75 + "**/.*",
76 + "node_modules",
77 + "bower_components",
78 + "test",
79 + "tests"
80 + ]
81 + }
82 +}
1 +#!/usr/bin/env node
2 +
3 +// This should probably be its own module but complaints about bower/etc.
4 +// support keep coming up and I'd rather just enable the workflow here for now
5 +// and figure out where this should live later. -- @beaugunderson
6 +
7 +var fs = require('fs');
8 +var _ = require('lodash');
9 +
10 +var packageJson = require('../package.json');
11 +
12 +var IGNORES = ['**/.*', 'node_modules', 'bower_components', 'test', 'tests'];
13 +var INCLUDES = ['lib/async.js', 'README.md', 'LICENSE'];
14 +var REPOSITORY_NAME = 'caolan/async';
15 +
16 +packageJson.jam = {
17 + main: packageJson.main,
18 + include: INCLUDES,
19 + categories: ['Utilities']
20 +};
21 +
22 +packageJson.spm = {
23 + main: packageJson.main
24 +};
25 +
26 +packageJson.volo = {
27 + main: packageJson.main,
28 + ignore: IGNORES
29 +};
30 +
31 +var bowerSpecific = {
32 + moduleType: ['amd', 'globals', 'node'],
33 + ignore: IGNORES,
34 + authors: [packageJson.author]
35 +};
36 +
37 +var bowerInclude = ['name', 'description', 'version', 'main', 'keywords',
38 + 'license', 'homepage', 'repository', 'devDependencies'];
39 +
40 +var componentSpecific = {
41 + repository: REPOSITORY_NAME,
42 + scripts: [packageJson.main]
43 +};
44 +
45 +var componentInclude = ['name', 'description', 'version', 'keywords',
46 + 'license'];
47 +
48 +var bowerJson = _.merge({}, _.pick(packageJson, bowerInclude), bowerSpecific);
49 +var componentJson = _.merge({}, _.pick(packageJson, componentInclude), componentSpecific);
50 +
51 +fs.writeFileSync('./bower.json', JSON.stringify(bowerJson, null, 2));
52 +fs.writeFileSync('./component.json', JSON.stringify(componentJson, null, 2));
53 +fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2));
1 +tidelift: "npm/balanced-match"
2 +patreon: juliangruber
1 +(MIT)
2 +
3 +Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy of
6 +this software and associated documentation files (the "Software"), to deal in
7 +the Software without restriction, including without limitation the rights to
8 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9 +of the Software, and to permit persons to whom the Software is furnished to do
10 +so, subject to the following conditions:
11 +
12 +The above copyright notice and this permission notice shall be included in all
13 +copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 +SOFTWARE.
1 +# balanced-match
2 +
3 +Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
4 +
5 +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match)
6 +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match)
7 +
8 +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match)
9 +
10 +## Example
11 +
12 +Get the first matching pair of braces:
13 +
14 +```js
15 +var balanced = require('balanced-match');
16 +
17 +console.log(balanced('{', '}', 'pre{in{nested}}post'));
18 +console.log(balanced('{', '}', 'pre{first}between{second}post'));
19 +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'));
20 +```
21 +
22 +The matches are:
23 +
24 +```bash
25 +$ node example.js
26 +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
27 +{ start: 3,
28 + end: 9,
29 + pre: 'pre',
30 + body: 'first',
31 + post: 'between{second}post' }
32 +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
33 +```
34 +
35 +## API
36 +
37 +### var m = balanced(a, b, str)
38 +
39 +For the first non-nested matching pair of `a` and `b` in `str`, return an
40 +object with those keys:
41 +
42 +* **start** the index of the first match of `a`
43 +* **end** the index of the matching `b`
44 +* **pre** the preamble, `a` and `b` not included
45 +* **body** the match, `a` and `b` not included
46 +* **post** the postscript, `a` and `b` not included
47 +
48 +If there's no match, `undefined` will be returned.
49 +
50 +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.
51 +
52 +### var r = balanced.range(a, b, str)
53 +
54 +For the first non-nested matching pair of `a` and `b` in `str`, return an
55 +array with indexes: `[ <a index>, <b index> ]`.
56 +
57 +If there's no match, `undefined` will be returned.
58 +
59 +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.
60 +
61 +## Installation
62 +
63 +With [npm](https://npmjs.org) do:
64 +
65 +```bash
66 +npm install balanced-match
67 +```
68 +
69 +## Security contact information
70 +
71 +To report a security vulnerability, please use the
72 +[Tidelift security contact](https://tidelift.com/security).
73 +Tidelift will coordinate the fix and disclosure.
74 +
75 +## License
76 +
77 +(MIT)
78 +
79 +Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
80 +
81 +Permission is hereby granted, free of charge, to any person obtaining a copy of
82 +this software and associated documentation files (the "Software"), to deal in
83 +the Software without restriction, including without limitation the rights to
84 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
85 +of the Software, and to permit persons to whom the Software is furnished to do
86 +so, subject to the following conditions:
87 +
88 +The above copyright notice and this permission notice shall be included in all
89 +copies or substantial portions of the Software.
90 +
91 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
92 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
93 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
94 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
95 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
96 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
97 +SOFTWARE.
1 +'use strict';
2 +module.exports = balanced;
3 +function balanced(a, b, str) {
4 + if (a instanceof RegExp) a = maybeMatch(a, str);
5 + if (b instanceof RegExp) b = maybeMatch(b, str);
6 +
7 + var r = range(a, b, str);
8 +
9 + return r && {
10 + start: r[0],
11 + end: r[1],
12 + pre: str.slice(0, r[0]),
13 + body: str.slice(r[0] + a.length, r[1]),
14 + post: str.slice(r[1] + b.length)
15 + };
16 +}
17 +
18 +function maybeMatch(reg, str) {
19 + var m = str.match(reg);
20 + return m ? m[0] : null;
21 +}
22 +
23 +balanced.range = range;
24 +function range(a, b, str) {
25 + var begs, beg, left, right, result;
26 + var ai = str.indexOf(a);
27 + var bi = str.indexOf(b, ai + 1);
28 + var i = ai;
29 +
30 + if (ai >= 0 && bi > 0) {
31 + if(a===b) {
32 + return [ai, bi];
33 + }
34 + begs = [];
35 + left = str.length;
36 +
37 + while (i >= 0 && !result) {
38 + if (i == ai) {
39 + begs.push(i);
40 + ai = str.indexOf(a, i + 1);
41 + } else if (begs.length == 1) {
42 + result = [ begs.pop(), bi ];
43 + } else {
44 + beg = begs.pop();
45 + if (beg < left) {
46 + left = beg;
47 + right = bi;
48 + }
49 +
50 + bi = str.indexOf(b, i + 1);
51 + }
52 +
53 + i = ai < bi && ai >= 0 ? ai : bi;
54 + }
55 +
56 + if (begs.length) {
57 + result = [ left, right ];
58 + }
59 + }
60 +
61 + return result;
62 +}
1 +{
2 + "_from": "balanced-match@^1.0.0",
3 + "_id": "balanced-match@1.0.2",
4 + "_inBundle": false,
5 + "_integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
6 + "_location": "/balanced-match",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "balanced-match@^1.0.0",
12 + "name": "balanced-match",
13 + "escapedName": "balanced-match",
14 + "rawSpec": "^1.0.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^1.0.0"
17 + },
18 + "_requiredBy": [
19 + "/brace-expansion"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
22 + "_shasum": "e83e3a7e3f300b34cb9d87f615fa0cbf357690ee",
23 + "_spec": "balanced-match@^1.0.0",
24 + "_where": "C:\\Users\\KoMoGoon\\documents\\github\\web_project2\\node_modules\\brace-expansion",
25 + "author": {
26 + "name": "Julian Gruber",
27 + "email": "mail@juliangruber.com",
28 + "url": "http://juliangruber.com"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/juliangruber/balanced-match/issues"
32 + },
33 + "bundleDependencies": false,
34 + "deprecated": false,
35 + "description": "Match balanced character pairs, like \"{\" and \"}\"",
36 + "devDependencies": {
37 + "matcha": "^0.7.0",
38 + "tape": "^4.6.0"
39 + },
40 + "homepage": "https://github.com/juliangruber/balanced-match",
41 + "keywords": [
42 + "match",
43 + "regexp",
44 + "test",
45 + "balanced",
46 + "parse"
47 + ],
48 + "license": "MIT",
49 + "main": "index.js",
50 + "name": "balanced-match",
51 + "repository": {
52 + "type": "git",
53 + "url": "git://github.com/juliangruber/balanced-match.git"
54 + },
55 + "scripts": {
56 + "bench": "matcha test/bench.js",
57 + "test": "tape test/test.js"
58 + },
59 + "testling": {
60 + "files": "test/*.js",
61 + "browsers": [
62 + "ie/8..latest",
63 + "firefox/20..latest",
64 + "firefox/nightly",
65 + "chrome/25..latest",
66 + "chrome/canary",
67 + "opera/12..latest",
68 + "opera/next",
69 + "safari/5.1..latest",
70 + "ipad/6.0..latest",
71 + "iphone/6.0..latest",
72 + "android-browser/4.2..latest"
73 + ]
74 + },
75 + "version": "1.0.2"
76 +}
1 +#### 9.0.0
2 +* 27/05/2019
3 +* For compatibility with legacy browsers, remove `Symbol` references.
4 +
5 +#### 8.1.1
6 +* 24/02/2019
7 +* [BUGFIX] #222 Restore missing `var` to `export BigNumber`.
8 +* Allow any key in BigNumber.Instance in *bignumber.d.ts*.
9 +
10 +#### 8.1.0
11 +* 23/02/2019
12 +* [NEW FEATURE] #220 Create a BigNumber using `{s, e, c}`.
13 +* [NEW FEATURE] `isBigNumber`: if `BigNumber.DEBUG` is `true`, also check that the BigNumber instance is well-formed.
14 +* Remove `instanceof` checks; just use `_isBigNumber` to identify a BigNumber instance.
15 +* Add `_isBigNumber` to prototype in *bignumber.mjs*.
16 +* Add tests for BigNumber creation from object.
17 +* Update *API.html*.
18 +
19 +#### 8.0.2
20 +* 13/01/2019
21 +* #209 `toPrecision` without argument should follow `toString`.
22 +* Improve *Use* section of *README*.
23 +* Optimise `toString(10)`.
24 +* Add verson number to API doc.
25 +
26 +#### 8.0.1
27 +* 01/11/2018
28 +* Rest parameter must be array type in *bignumber.d.ts*.
29 +
30 +#### 8.0.0
31 +* 01/11/2018
32 +* [NEW FEATURE] Add `BigNumber.sum` method.
33 +* [NEW FEATURE]`toFormat`: add `prefix` and `suffix` options.
34 +* [NEW FEATURE] #178 Pass custom formatting to `toFormat`.
35 +* [BREAKING CHANGE] #184 `toFraction`: return array of BigNumbers not strings.
36 +* [NEW FEATURE] #185 Enable overwrite of `valueOf` to prevent accidental addition to string.
37 +* #183 Add Node.js `crypto` requirement to documentation.
38 +* [BREAKING CHANGE] #198 Disallow signs and whitespace in custom alphabet.
39 +* [NEW FEATURE] #188 Implement `util.inspect.custom` for Node.js REPL.
40 +* #170 Make `isBigNumber` a type guard in *bignumber.d.ts*.
41 +* [BREAKING CHANGE] `BigNumber.min` and `BigNumber.max`: don't accept an array.
42 +* Update *.travis.yml*.
43 +* Remove *bower.json*.
44 +
45 +#### 7.2.1
46 +* 24/05/2018
47 +* Add `browser` field to *package.json*.
48 +
49 +#### 7.2.0
50 +* 22/05/2018
51 +* #166 Correct *.mjs* file. Remove extension from `main` field in *package.json*.
52 +
53 +#### 7.1.0
54 +* 18/05/2018
55 +* Add `module` field to *package.json* for *bignumber.mjs*.
56 +
57 +#### 7.0.2
58 +* 17/05/2018
59 +* #165 Bugfix: upper-case letters for bases 11-36 in a custom alphabet.
60 +* Add note to *README* regarding creating BigNumbers from Number values.
61 +
62 +#### 7.0.1
63 +* 26/04/2018
64 +* #158 Fix global object variable name typo.
65 +
66 +#### 7.0.0
67 +* 26/04/2018
68 +* #143 Remove global BigNumber from typings.
69 +* #144 Enable compatibility with `Object.freeze(Object.prototype)`.
70 +* #148 #123 #11 Only throw on a number primitive with more than 15 significant digits if `BigNumber.DEBUG` is `true`.
71 +* Only throw on an invalid BigNumber value if `BigNumber.DEBUG` is `true`. Return BigNumber `NaN` instead.
72 +* #154 `exponentiatedBy`: allow BigNumber exponent.
73 +* #156 Prevent Content Security Policy *unsafe-eval* issue.
74 +* `toFraction`: allow `Infinity` maximum denominator.
75 +* Comment-out some excess tests to reduce test time.
76 +* Amend indentation and other spacing.
77 +
78 +#### 6.0.0
79 +* 26/01/2018
80 +* #137 Implement `APLHABET` configuration option.
81 +* Remove `ERRORS` configuration option.
82 +* Remove `toDigits` method; extend `precision` method accordingly.
83 +* Remove s`round` method; extend `decimalPlaces` method accordingly.
84 +* Remove methods: `ceil`, `floor`, and `truncated`.
85 +* Remove method aliases: `add`, `cmp`, `isInt`, `isNeg`, `trunc`, `mul`, `neg` and `sub`.
86 +* Rename methods: `shift` to `shiftedBy`, `another` to `clone`, `toPower` to `exponentiatedBy`, and `equals` to `isEqualTo`.
87 +* Rename methods: add `is` prefix to `greaterThan`, `greaterThanOrEqualTo`, `lessThan` and `lessThanOrEqualTo`.
88 +* Add methods: `multipliedBy`, `isBigNumber`, `isPositive`, `integerValue`, `maximum` and `minimum`.
89 +* Refactor test suite.
90 +* Add *CHANGELOG.md*.
91 +* Rewrite *bignumber.d.ts*.
92 +* Redo API image.
93 +
94 +#### 5.0.0
95 +* 27/11/2017
96 +* #81 Don't throw on constructor call without `new`.
97 +
98 +#### 4.1.0
99 +* 26/09/2017
100 +* Remove node 0.6 from *.travis.yml*.
101 +* Add *bignumber.mjs*.
102 +
103 +#### 4.0.4
104 +* 03/09/2017
105 +* Add missing aliases to *bignumber.d.ts*.
106 +
107 +#### 4.0.3
108 +* 30/08/2017
109 +* Add types: *bignumber.d.ts*.
110 +
111 +#### 4.0.2
112 +* 03/05/2017
113 +* #120 Workaround Safari/Webkit bug.
114 +
115 +#### 4.0.1
116 +* 05/04/2017
117 +* #121 BigNumber.default to BigNumber['default'].
118 +
119 +#### 4.0.0
120 +* 09/01/2017
121 +* Replace BigNumber.isBigNumber method with isBigNumber prototype property.
122 +
123 +#### 3.1.2
124 +* 08/01/2017
125 +* Minor documentation edit.
126 +
127 +#### 3.1.1
128 +* 08/01/2017
129 +* Uncomment `isBigNumber` tests.
130 +* Ignore dot files.
131 +
132 +#### 3.1.0
133 +* 08/01/2017
134 +* Add `isBigNumber` method.
135 +
136 +#### 3.0.2
137 +* 08/01/2017
138 +* Bugfix: Possible incorrect value of `ERRORS` after a `BigNumber.another` call (due to `parseNumeric` declaration in outer scope).
139 +
140 +#### 3.0.1
141 +* 23/11/2016
142 +* Apply fix for old ipads with `%` issue, see #57 and #102.
143 +* Correct error message.
144 +
145 +#### 3.0.0
146 +* 09/11/2016
147 +* Remove `require('crypto')` - leave it to the user.
148 +* Add `BigNumber.set` as `BigNumber.config` alias.
149 +* Default `POW_PRECISION` to `0`.
150 +
151 +#### 2.4.0
152 +* 14/07/2016
153 +* #97 Add exports to support ES6 imports.
154 +
155 +#### 2.3.0
156 +* 07/03/2016
157 +* #86 Add modulus parameter to `toPower`.
158 +
159 +#### 2.2.0
160 +* 03/03/2016
161 +* #91 Permit larger JS integers.
162 +
163 +#### 2.1.4
164 +* 15/12/2015
165 +* Correct UMD.
166 +
167 +#### 2.1.3
168 +* 13/12/2015
169 +* Refactor re global object and crypto availability when bundling.
170 +
171 +#### 2.1.2
172 +* 10/12/2015
173 +* Bugfix: `window.crypto` not assigned to `crypto`.
174 +
175 +#### 2.1.1
176 +* 09/12/2015
177 +* Prevent code bundler from adding `crypto` shim.
178 +
179 +#### 2.1.0
180 +* 26/10/2015
181 +* For `valueOf` and `toJSON`, include the minus sign with negative zero.
182 +
183 +#### 2.0.8
184 +* 2/10/2015
185 +* Internal round function bugfix.
186 +
187 +#### 2.0.6
188 +* 31/03/2015
189 +* Add bower.json. Tweak division after in-depth review.
190 +
191 +#### 2.0.5
192 +* 25/03/2015
193 +* Amend README. Remove bitcoin address.
194 +
195 +#### 2.0.4
196 +* 25/03/2015
197 +* Critical bugfix #58: division.
198 +
199 +#### 2.0.3
200 +* 18/02/2015
201 +* Amend README. Add source map.
202 +
203 +#### 2.0.2
204 +* 18/02/2015
205 +* Correct links.
206 +
207 +#### 2.0.1
208 +* 18/02/2015
209 +* Add `max`, `min`, `precision`, `random`, `shiftedBy`, `toDigits` and `truncated` methods.
210 +* Add the short-forms: `add`, `mul`, `sd`, `sub` and `trunc`.
211 +* Add an `another` method to enable multiple independent constructors to be created.
212 +* Add support for the base 2, 8 and 16 prefixes `0b`, `0o` and `0x`.
213 +* Enable a rounding mode to be specified as a second parameter to `toExponential`, `toFixed`, `toFormat` and `toPrecision`.
214 +* Add a `CRYPTO` configuration property so cryptographically-secure pseudo-random number generation can be specified.
215 +* Add a `MODULO_MODE` configuration property to enable the rounding mode used by the `modulo` operation to be specified.
216 +* Add a `POW_PRECISION` configuration property to enable the number of significant digits calculated by the power operation to be limited.
217 +* Improve code quality.
218 +* Improve documentation.
219 +
220 +#### 2.0.0
221 +* 29/12/2014
222 +* Add `dividedToIntegerBy`, `isInteger` and `toFormat` methods.
223 +* Remove the following short-forms: `isF`, `isZ`, `toE`, `toF`, `toFr`, `toN`, `toP`, `toS`.
224 +* Store a BigNumber's coefficient in base 1e14, rather than base 10.
225 +* Add fast path for integers to BigNumber constructor.
226 +* Incorporate the library into the online documentation.
227 +
228 +#### 1.5.0
229 +* 13/11/2014
230 +* Add `toJSON` and `decimalPlaces` methods.
231 +
232 +#### 1.4.1
233 +* 08/06/2014
234 +* Amend README.
235 +
236 +#### 1.4.0
237 +* 08/05/2014
238 +* Add `toNumber`.
239 +
240 +#### 1.3.0
241 +* 08/11/2013
242 +* Ensure correct rounding of `sqrt` in all, rather than almost all, cases.
243 +* Maximum radix to 64.
244 +
245 +#### 1.2.1
246 +* 17/10/2013
247 +* Sign of zero when x < 0 and x + (-x) = 0.
248 +
249 +#### 1.2.0
250 +* 19/9/2013
251 +* Throw Error objects for stack.
252 +
253 +#### 1.1.1
254 +* 22/8/2013
255 +* Show original value in constructor error message.
256 +
257 +#### 1.1.0
258 +* 1/8/2013
259 +* Allow numbers with trailing radix point.
260 +
261 +#### 1.0.1
262 +* Bugfix: error messages with incorrect method name
263 +
264 +#### 1.0.0
265 +* 8/11/2012
266 +* Initial release
1 +The MIT Licence.
2 +
3 +Copyright (c) 2019 Michael Mclaughlin
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining
6 +a copy of this software and associated documentation files (the
7 +'Software'), to deal in the Software without restriction, including
8 +without limitation the rights to use, copy, modify, merge, publish,
9 +distribute, sublicense, and/or sell copies of the Software, and to
10 +permit persons to whom the Software is furnished to do so, subject to
11 +the following conditions:
12 +
13 +The above copyright notice and this permission notice shall be
14 +included in all copies or substantial portions of the Software.
15 +
16 +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 +
1 +![bignumber.js](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/bignumberjs.png)
2 +
3 +A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic.
4 +
5 +[![Build Status](https://travis-ci.org/MikeMcl/bignumber.js.svg)](https://travis-ci.org/MikeMcl/bignumber.js)
6 +
7 +<br />
8 +
9 +## Features
10 +
11 + - Integers and decimals
12 + - Simple API but full-featured
13 + - Faster, smaller, and perhaps easier to use than JavaScript versions of Java's BigDecimal
14 + - 8 KB minified and gzipped
15 + - Replicates the `toExponential`, `toFixed`, `toPrecision` and `toString` methods of JavaScript's Number type
16 + - Includes a `toFraction` and a correctly-rounded `squareRoot` method
17 + - Supports cryptographically-secure pseudo-random number generation
18 + - No dependencies
19 + - Wide platform compatibility: uses JavaScript 1.5 (ECMAScript 3) features only
20 + - Comprehensive [documentation](http://mikemcl.github.io/bignumber.js/) and test set
21 +
22 +![API](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/API.png)
23 +
24 +If a smaller and simpler library is required see [big.js](https://github.com/MikeMcl/big.js/).
25 +It's less than half the size but only works with decimal numbers and only has half the methods.
26 +It also does not allow `NaN` or `Infinity`, or have the configuration options of this library.
27 +
28 +See also [decimal.js](https://github.com/MikeMcl/decimal.js/), which among other things adds support for non-integer powers, and performs all operations to a specified number of significant digits.
29 +
30 +## Load
31 +
32 +The library is the single JavaScript file *bignumber.js* (or minified, *bignumber.min.js*).
33 +
34 +Browser:
35 +
36 +```html
37 +<script src='path/to/bignumber.js'></script>
38 +```
39 +
40 +[Node.js](http://nodejs.org):
41 +
42 +```bash
43 +$ npm install bignumber.js
44 +```
45 +
46 +```javascript
47 +const BigNumber = require('bignumber.js');
48 +```
49 +
50 +ES6 module:
51 +
52 +```javascript
53 +import BigNumber from "./bignumber.mjs"
54 +```
55 +
56 +AMD loader libraries such as [requireJS](http://requirejs.org/):
57 +
58 +```javascript
59 +require(['bignumber'], function(BigNumber) {
60 + // Use BigNumber here in local scope. No global BigNumber.
61 +});
62 +```
63 +
64 +## Use
65 +
66 +The library exports a single constructor function, [`BigNumber`](http://mikemcl.github.io/bignumber.js/#bignumber), which accepts a value of type Number, String or BigNumber,
67 +
68 +```javascript
69 +let x = new BigNumber(123.4567);
70 +let y = BigNumber('123456.7e-3');
71 +let z = new BigNumber(x);
72 +x.isEqualTo(y) && y.isEqualTo(z) && x.isEqualTo(z); // true
73 +```
74 +
75 +To get the string value of a BigNumber use [`toString()`](http://mikemcl.github.io/bignumber.js/#toS) or [`toFixed()`](http://mikemcl.github.io/bignumber.js/#toFix). Using `toFixed()` prevents exponential notation being returned, no matter how large or small the value.
76 +
77 +```javascript
78 +let x = new BigNumber('1111222233334444555566');
79 +x.toString(); // "1.111222233334444555566e+21"
80 +x.toFixed(); // "1111222233334444555566"
81 +```
82 +
83 +If the limited precision of Number values is not well understood, it is recommended to create BigNumbers from String values rather than Number values to avoid a potential loss of precision.
84 +
85 +*In all further examples below, `let`, semicolons and `toString` calls are not shown. If a commented-out value is in quotes it means `toString` has been called on the preceding expression.*
86 +
87 +```javascript
88 +// Precision loss from using numeric literals with more than 15 significant digits.
89 +new BigNumber(1.0000000000000001) // '1'
90 +new BigNumber(88259496234518.57) // '88259496234518.56'
91 +new BigNumber(99999999999999999999) // '100000000000000000000'
92 +
93 +// Precision loss from using numeric literals outside the range of Number values.
94 +new BigNumber(2e+308) // 'Infinity'
95 +new BigNumber(1e-324) // '0'
96 +
97 +// Precision loss from the unexpected result of arithmetic with Number values.
98 +new BigNumber(0.7 + 0.1) // '0.7999999999999999'
99 +```
100 +
101 +When creating a BigNumber from a Number, note that a BigNumber is created from a Number's decimal `toString()` value not from its underlying binary value. If the latter is required, then pass the Number's `toString(2)` value and specify base 2.
102 +
103 +```javascript
104 +new BigNumber(Number.MAX_VALUE.toString(2), 2)
105 +```
106 +
107 +BigNumbers can be created from values in bases from 2 to 36. See [`ALPHABET`](http://mikemcl.github.io/bignumber.js/#alphabet) to extend this range.
108 +
109 +```javascript
110 +a = new BigNumber(1011, 2) // "11"
111 +b = new BigNumber('zz.9', 36) // "1295.25"
112 +c = a.plus(b) // "1306.25"
113 +```
114 +
115 +Performance is better if base 10 is NOT specified for decimal values. Only specify base 10 when it is desired that the number of decimal places of the input value be limited to the current [`DECIMAL_PLACES`](http://mikemcl.github.io/bignumber.js/#decimal-places) setting.
116 +
117 +A BigNumber is immutable in the sense that it is not changed by its methods.
118 +
119 +```javascript
120 +0.3 - 0.1 // 0.19999999999999998
121 +x = new BigNumber(0.3)
122 +x.minus(0.1) // "0.2"
123 +x // "0.3"
124 +```
125 +
126 +The methods that return a BigNumber can be chained.
127 +
128 +```javascript
129 +x.dividedBy(y).plus(z).times(9)
130 +x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4444562598.111772').integerValue()
131 +```
132 +
133 +Some of the longer method names have a shorter alias.
134 +
135 +```javascript
136 +x.squareRoot().dividedBy(y).exponentiatedBy(3).isEqualTo(x.sqrt().div(y).pow(3)) // true
137 +x.modulo(y).multipliedBy(z).eq(x.mod(y).times(z)) // true
138 +```
139 +
140 +As with JavaScript's Number type, there are [`toExponential`](http://mikemcl.github.io/bignumber.js/#toE), [`toFixed`](http://mikemcl.github.io/bignumber.js/#toFix) and [`toPrecision`](http://mikemcl.github.io/bignumber.js/#toP) methods.
141 +
142 +```javascript
143 +x = new BigNumber(255.5)
144 +x.toExponential(5) // "2.55500e+2"
145 +x.toFixed(5) // "255.50000"
146 +x.toPrecision(5) // "255.50"
147 +x.toNumber() // 255.5
148 +```
149 +
150 + A base can be specified for [`toString`](http://mikemcl.github.io/bignumber.js/#toS). Performance is better if base 10 is NOT specified, i.e. use `toString()` not `toString(10)`. Only specify base 10 when it is desired that the number of decimal places be limited to the current [`DECIMAL_PLACES`](http://mikemcl.github.io/bignumber.js/#decimal-places) setting.
151 +
152 + ```javascript
153 + x.toString(16) // "ff.8"
154 + ```
155 +
156 +There is a [`toFormat`](http://mikemcl.github.io/bignumber.js/#toFor) method which may be useful for internationalisation.
157 +
158 +```javascript
159 +y = new BigNumber('1234567.898765')
160 +y.toFormat(2) // "1,234,567.90"
161 +```
162 +
163 +The maximum number of decimal places of the result of an operation involving division (i.e. a division, square root, base conversion or negative power operation) is set using the `set` or `config` method of the `BigNumber` constructor.
164 +
165 +The other arithmetic operations always give the exact result.
166 +
167 +```javascript
168 +BigNumber.set({ DECIMAL_PLACES: 10, ROUNDING_MODE: 4 })
169 +
170 +x = new BigNumber(2)
171 +y = new BigNumber(3)
172 +z = x.dividedBy(y) // "0.6666666667"
173 +z.squareRoot() // "0.8164965809"
174 +z.exponentiatedBy(-3) // "3.3749999995"
175 +z.toString(2) // "0.1010101011"
176 +z.multipliedBy(z) // "0.44444444448888888889"
177 +z.multipliedBy(z).decimalPlaces(10) // "0.4444444445"
178 +```
179 +
180 +There is a [`toFraction`](http://mikemcl.github.io/bignumber.js/#toFr) method with an optional *maximum denominator* argument
181 +
182 +```javascript
183 +y = new BigNumber(355)
184 +pi = y.dividedBy(113) // "3.1415929204"
185 +pi.toFraction() // [ "7853982301", "2500000000" ]
186 +pi.toFraction(1000) // [ "355", "113" ]
187 +```
188 +
189 +and [`isNaN`](http://mikemcl.github.io/bignumber.js/#isNaN) and [`isFinite`](http://mikemcl.github.io/bignumber.js/#isF) methods, as `NaN` and `Infinity` are valid `BigNumber` values.
190 +
191 +```javascript
192 +x = new BigNumber(NaN) // "NaN"
193 +y = new BigNumber(Infinity) // "Infinity"
194 +x.isNaN() && !y.isNaN() && !x.isFinite() && !y.isFinite() // true
195 +```
196 +
197 +The value of a BigNumber is stored in a decimal floating point format in terms of a coefficient, exponent and sign.
198 +
199 +```javascript
200 +x = new BigNumber(-123.456);
201 +x.c // [ 123, 45600000000000 ] coefficient (i.e. significand)
202 +x.e // 2 exponent
203 +x.s // -1 sign
204 +```
205 +
206 +For advanced usage, multiple BigNumber constructors can be created, each with their own independent configuration.
207 +
208 +```javascript
209 +// Set DECIMAL_PLACES for the original BigNumber constructor
210 +BigNumber.set({ DECIMAL_PLACES: 10 })
211 +
212 +// Create another BigNumber constructor, optionally passing in a configuration object
213 +BN = BigNumber.clone({ DECIMAL_PLACES: 5 })
214 +
215 +x = new BigNumber(1)
216 +y = new BN(1)
217 +
218 +x.div(3) // '0.3333333333'
219 +y.div(3) // '0.33333'
220 +```
221 +
222 +For further information see the [API](http://mikemcl.github.io/bignumber.js/) reference in the *doc* directory.
223 +
224 +## Test
225 +
226 +The *test/modules* directory contains the test scripts for each method.
227 +
228 +The tests can be run with Node.js or a browser. For Node.js use
229 +
230 + $ npm test
231 +
232 +or
233 +
234 + $ node test/test
235 +
236 +To test a single method, use, for example
237 +
238 + $ node test/methods/toFraction
239 +
240 +For the browser, open *test/test.html*.
241 +
242 +## Build
243 +
244 +For Node, if [uglify-js](https://github.com/mishoo/UglifyJS2) is installed
245 +
246 + npm install uglify-js -g
247 +
248 +then
249 +
250 + npm run build
251 +
252 +will create *bignumber.min.js*.
253 +
254 +A source map will also be created in the root directory.
255 +
256 +## Feedback
257 +
258 +Open an issue, or email
259 +
260 +Michael
261 +
262 +<a href="mailto:M8ch88l@gmail.com">M8ch88l@gmail.com</a>
263 +
264 +## Licence
265 +
266 +The MIT Licence.
267 +
268 +See [LICENCE](https://github.com/MikeMcl/bignumber.js/blob/master/LICENCE).
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +{
2 + "_from": "bignumber.js@9.0.0",
3 + "_id": "bignumber.js@9.0.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==",
6 + "_location": "/bignumber.js",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "version",
10 + "registry": true,
11 + "raw": "bignumber.js@9.0.0",
12 + "name": "bignumber.js",
13 + "escapedName": "bignumber.js",
14 + "rawSpec": "9.0.0",
15 + "saveSpec": null,
16 + "fetchSpec": "9.0.0"
17 + },
18 + "_requiredBy": [
19 + "/mysql"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
22 + "_shasum": "805880f84a329b5eac6e7cb6f8274b6d82bdf075",
23 + "_spec": "bignumber.js@9.0.0",
24 + "_where": "C:\\Users\\KoMoGoon\\Documents\\GitHub\\Web_Project2\\node_modules\\mysql",
25 + "author": {
26 + "name": "Michael Mclaughlin",
27 + "email": "M8ch88l@gmail.com"
28 + },
29 + "browser": "bignumber.js",
30 + "bugs": {
31 + "url": "https://github.com/MikeMcl/bignumber.js/issues"
32 + },
33 + "bundleDependencies": false,
34 + "dependencies": {},
35 + "deprecated": false,
36 + "description": "A library for arbitrary-precision decimal and non-decimal arithmetic",
37 + "engines": {
38 + "node": "*"
39 + },
40 + "homepage": "https://github.com/MikeMcl/bignumber.js#readme",
41 + "keywords": [
42 + "arbitrary",
43 + "precision",
44 + "arithmetic",
45 + "big",
46 + "number",
47 + "decimal",
48 + "float",
49 + "biginteger",
50 + "bigdecimal",
51 + "bignumber",
52 + "bigint",
53 + "bignum"
54 + ],
55 + "license": "MIT",
56 + "main": "bignumber",
57 + "module": "bignumber.mjs",
58 + "name": "bignumber.js",
59 + "repository": {
60 + "type": "git",
61 + "url": "git+https://github.com/MikeMcl/bignumber.js.git"
62 + },
63 + "scripts": {
64 + "build": "uglifyjs bignumber.js --source-map -c -m -o bignumber.min.js",
65 + "test": "node test/test"
66 + },
67 + "types": "bignumber.d.ts",
68 + "version": "9.0.0"
69 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff 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 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 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.
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.