crabatool 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +23 -2
- package/ngp/config.js +2 -2
- package/ngp/node_modules/.bin/mime +12 -0
- package/ngp/node_modules/.bin/mime.cmd +17 -0
- package/ngp/node_modules/.bin/mime.ps1 +28 -0
- package/ngp/node_modules/.bin/uglifyjs +12 -0
- package/ngp/node_modules/.bin/uglifyjs.cmd +17 -0
- package/ngp/node_modules/.bin/uglifyjs.ps1 +28 -0
- package/ngp/node_modules/.package-lock.json +863 -0
- package/ngp/node_modules/accepts/HISTORY.md +243 -0
- package/ngp/node_modules/accepts/LICENSE +23 -0
- package/ngp/node_modules/accepts/README.md +140 -0
- package/ngp/node_modules/accepts/index.js +238 -0
- package/ngp/node_modules/accepts/package.json +47 -0
- package/ngp/node_modules/anymatch/LICENSE +15 -0
- package/ngp/node_modules/anymatch/README.md +87 -0
- package/ngp/node_modules/anymatch/index.d.ts +19 -0
- package/ngp/node_modules/anymatch/index.js +104 -0
- package/ngp/node_modules/anymatch/package.json +48 -0
- package/ngp/node_modules/array-flatten/LICENSE +21 -0
- package/ngp/node_modules/array-flatten/README.md +43 -0
- package/ngp/node_modules/array-flatten/array-flatten.js +64 -0
- package/ngp/node_modules/array-flatten/package.json +39 -0
- package/ngp/node_modules/binary-extensions/binary-extensions.json +260 -0
- package/ngp/node_modules/binary-extensions/binary-extensions.json.d.ts +3 -0
- package/ngp/node_modules/binary-extensions/index.d.ts +14 -0
- package/ngp/node_modules/binary-extensions/index.js +1 -0
- package/ngp/node_modules/binary-extensions/license +9 -0
- package/ngp/node_modules/binary-extensions/package.json +38 -0
- package/ngp/node_modules/binary-extensions/readme.md +41 -0
- package/ngp/node_modules/body-parser/HISTORY.md +651 -0
- package/ngp/node_modules/body-parser/LICENSE +23 -0
- package/ngp/node_modules/body-parser/README.md +464 -0
- package/ngp/node_modules/body-parser/SECURITY.md +25 -0
- package/ngp/node_modules/body-parser/index.js +157 -0
- package/ngp/node_modules/body-parser/lib/read.js +205 -0
- package/ngp/node_modules/body-parser/lib/types/json.js +236 -0
- package/ngp/node_modules/body-parser/lib/types/raw.js +101 -0
- package/ngp/node_modules/body-parser/lib/types/text.js +121 -0
- package/ngp/node_modules/body-parser/lib/types/urlencoded.js +284 -0
- package/ngp/node_modules/body-parser/node_modules/bytes/History.md +97 -0
- package/ngp/node_modules/body-parser/node_modules/bytes/LICENSE +23 -0
- package/ngp/node_modules/body-parser/node_modules/bytes/Readme.md +152 -0
- package/ngp/node_modules/body-parser/node_modules/bytes/index.js +170 -0
- package/ngp/node_modules/body-parser/node_modules/bytes/package.json +42 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/Changelog.md +162 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/LICENSE +21 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/README.md +156 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/dbcs-codec.js +555 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/dbcs-data.js +176 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/index.js +22 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/internal.js +188 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/sbcs-data.js +174 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/gbk-added.json +55 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/utf16.js +177 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/encodings/utf7.js +290 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/lib/bom-handling.js +52 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/lib/extend-node.js +217 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/lib/index.d.ts +24 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/lib/index.js +153 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/lib/streams.js +121 -0
- package/ngp/node_modules/body-parser/node_modules/iconv-lite/package.json +46 -0
- package/ngp/node_modules/body-parser/package.json +56 -0
- package/ngp/node_modules/braces/CHANGELOG.md +184 -0
- package/ngp/node_modules/braces/LICENSE +21 -0
- package/ngp/node_modules/braces/README.md +593 -0
- package/ngp/node_modules/braces/index.js +170 -0
- package/ngp/node_modules/braces/lib/compile.js +57 -0
- package/ngp/node_modules/braces/lib/constants.js +57 -0
- package/ngp/node_modules/braces/lib/expand.js +113 -0
- package/ngp/node_modules/braces/lib/parse.js +333 -0
- package/ngp/node_modules/braces/lib/stringify.js +32 -0
- package/ngp/node_modules/braces/lib/utils.js +112 -0
- package/ngp/node_modules/braces/package.json +77 -0
- package/ngp/node_modules/bytes/History.md +82 -0
- package/ngp/node_modules/bytes/LICENSE +23 -0
- package/ngp/node_modules/bytes/Readme.md +125 -0
- package/ngp/node_modules/bytes/index.js +159 -0
- package/ngp/node_modules/bytes/package.json +39 -0
- package/ngp/node_modules/call-bind/.eslintignore +1 -0
- package/ngp/node_modules/call-bind/.eslintrc +17 -0
- package/ngp/node_modules/call-bind/.github/FUNDING.yml +12 -0
- package/ngp/node_modules/call-bind/.nycrc +13 -0
- package/ngp/node_modules/call-bind/CHANGELOG.md +42 -0
- package/ngp/node_modules/call-bind/LICENSE +21 -0
- package/ngp/node_modules/call-bind/README.md +2 -0
- package/ngp/node_modules/call-bind/callBound.js +15 -0
- package/ngp/node_modules/call-bind/index.js +47 -0
- package/ngp/node_modules/call-bind/package.json +80 -0
- package/ngp/node_modules/call-bind/test/callBound.js +55 -0
- package/ngp/node_modules/call-bind/test/index.js +66 -0
- package/ngp/node_modules/chokidar/LICENSE +21 -0
- package/ngp/node_modules/chokidar/README.md +308 -0
- package/ngp/node_modules/chokidar/index.js +973 -0
- package/ngp/node_modules/chokidar/lib/constants.js +65 -0
- package/ngp/node_modules/chokidar/lib/fsevents-handler.js +524 -0
- package/ngp/node_modules/chokidar/lib/nodefs-handler.js +654 -0
- package/ngp/node_modules/chokidar/package.json +85 -0
- package/ngp/node_modules/chokidar/types/index.d.ts +188 -0
- package/ngp/node_modules/compressible/HISTORY.md +111 -0
- package/ngp/node_modules/compressible/LICENSE +24 -0
- package/ngp/node_modules/compressible/README.md +61 -0
- package/ngp/node_modules/compressible/index.js +58 -0
- package/ngp/node_modules/compressible/package.json +48 -0
- package/ngp/node_modules/compression/HISTORY.md +307 -0
- package/ngp/node_modules/compression/LICENSE +23 -0
- package/ngp/node_modules/compression/README.md +240 -0
- package/ngp/node_modules/compression/index.js +288 -0
- package/ngp/node_modules/compression/package.json +47 -0
- package/ngp/node_modules/content-disposition/HISTORY.md +60 -0
- package/ngp/node_modules/content-disposition/LICENSE +22 -0
- package/ngp/node_modules/content-disposition/README.md +142 -0
- package/ngp/node_modules/content-disposition/index.js +458 -0
- package/ngp/node_modules/content-disposition/node_modules/safe-buffer/LICENSE +21 -0
- package/ngp/node_modules/content-disposition/node_modules/safe-buffer/README.md +584 -0
- package/ngp/node_modules/content-disposition/node_modules/safe-buffer/index.d.ts +187 -0
- package/ngp/node_modules/content-disposition/node_modules/safe-buffer/index.js +65 -0
- package/ngp/node_modules/content-disposition/node_modules/safe-buffer/package.json +51 -0
- package/ngp/node_modules/content-disposition/package.json +44 -0
- package/ngp/node_modules/content-type/HISTORY.md +24 -0
- package/ngp/node_modules/content-type/LICENSE +22 -0
- package/ngp/node_modules/content-type/README.md +92 -0
- package/ngp/node_modules/content-type/index.js +222 -0
- package/ngp/node_modules/content-type/package.json +40 -0
- package/ngp/node_modules/cookie/HISTORY.md +142 -0
- package/ngp/node_modules/cookie/LICENSE +24 -0
- package/ngp/node_modules/cookie/README.md +302 -0
- package/ngp/node_modules/cookie/SECURITY.md +25 -0
- package/ngp/node_modules/cookie/index.js +270 -0
- package/ngp/node_modules/cookie/package.json +44 -0
- package/ngp/node_modules/cookie-signature/History.md +38 -0
- package/ngp/node_modules/cookie-signature/Readme.md +42 -0
- package/ngp/node_modules/cookie-signature/index.js +51 -0
- package/ngp/node_modules/cookie-signature/package.json +18 -0
- package/ngp/node_modules/crabatool/index.js +28 -0
- package/ngp/node_modules/crabatool/ngp/config.js +25 -0
- package/ngp/node_modules/crabatool/ngp/ngp.js +3 -0
- package/ngp/node_modules/crabatool/ngp/package.json +15 -0
- package/ngp/node_modules/crabatool/ngp/readme.md +4 -0
- package/ngp/node_modules/crabatool/package.json +25 -0
- package/ngp/node_modules/crabatool/readme.md +12 -0
- package/ngp/node_modules/crabatool/server.js +124 -0
- package/ngp/node_modules/debug/.coveralls.yml +1 -0
- package/ngp/node_modules/debug/.eslintrc +11 -0
- package/ngp/node_modules/debug/.travis.yml +14 -0
- package/ngp/node_modules/debug/CHANGELOG.md +362 -0
- package/ngp/node_modules/debug/LICENSE +19 -0
- package/ngp/node_modules/debug/Makefile +50 -0
- package/ngp/node_modules/debug/README.md +312 -0
- package/ngp/node_modules/debug/component.json +19 -0
- package/ngp/node_modules/debug/karma.conf.js +70 -0
- package/ngp/node_modules/debug/node.js +1 -0
- package/ngp/node_modules/debug/package.json +49 -0
- package/ngp/node_modules/debug/src/browser.js +185 -0
- package/ngp/node_modules/debug/src/debug.js +202 -0
- package/ngp/node_modules/debug/src/index.js +10 -0
- package/ngp/node_modules/debug/src/inspector-log.js +15 -0
- package/ngp/node_modules/debug/src/node.js +248 -0
- package/ngp/node_modules/depd/History.md +103 -0
- package/ngp/node_modules/depd/LICENSE +22 -0
- package/ngp/node_modules/depd/Readme.md +280 -0
- package/ngp/node_modules/depd/index.js +538 -0
- package/ngp/node_modules/depd/lib/browser/index.js +77 -0
- package/ngp/node_modules/depd/package.json +45 -0
- package/ngp/node_modules/destroy/LICENSE +23 -0
- package/ngp/node_modules/destroy/README.md +63 -0
- package/ngp/node_modules/destroy/index.js +209 -0
- package/ngp/node_modules/destroy/package.json +48 -0
- package/ngp/node_modules/ee-first/LICENSE +22 -0
- package/ngp/node_modules/ee-first/README.md +80 -0
- package/ngp/node_modules/ee-first/index.js +95 -0
- package/ngp/node_modules/ee-first/package.json +29 -0
- package/ngp/node_modules/encodeurl/HISTORY.md +14 -0
- package/ngp/node_modules/encodeurl/LICENSE +22 -0
- package/ngp/node_modules/encodeurl/README.md +128 -0
- package/ngp/node_modules/encodeurl/index.js +60 -0
- package/ngp/node_modules/encodeurl/package.json +40 -0
- package/ngp/node_modules/escape-html/LICENSE +24 -0
- package/ngp/node_modules/escape-html/Readme.md +43 -0
- package/ngp/node_modules/escape-html/index.js +78 -0
- package/ngp/node_modules/escape-html/package.json +24 -0
- package/ngp/node_modules/etag/HISTORY.md +83 -0
- package/ngp/node_modules/etag/LICENSE +22 -0
- package/ngp/node_modules/etag/README.md +159 -0
- package/ngp/node_modules/etag/index.js +131 -0
- package/ngp/node_modules/etag/package.json +47 -0
- package/ngp/node_modules/express/History.md +3579 -0
- package/ngp/node_modules/express/LICENSE +24 -0
- package/ngp/node_modules/express/Readme.md +166 -0
- package/ngp/node_modules/express/index.js +11 -0
- package/ngp/node_modules/express/lib/application.js +661 -0
- package/ngp/node_modules/express/lib/express.js +116 -0
- package/ngp/node_modules/express/lib/middleware/init.js +43 -0
- package/ngp/node_modules/express/lib/middleware/query.js +47 -0
- package/ngp/node_modules/express/lib/request.js +525 -0
- package/ngp/node_modules/express/lib/response.js +1169 -0
- package/ngp/node_modules/express/lib/router/index.js +673 -0
- package/ngp/node_modules/express/lib/router/layer.js +181 -0
- package/ngp/node_modules/express/lib/router/route.js +225 -0
- package/ngp/node_modules/express/lib/utils.js +304 -0
- package/ngp/node_modules/express/lib/view.js +182 -0
- package/ngp/node_modules/express/node_modules/safe-buffer/LICENSE +21 -0
- package/ngp/node_modules/express/node_modules/safe-buffer/README.md +584 -0
- package/ngp/node_modules/express/node_modules/safe-buffer/index.d.ts +187 -0
- package/ngp/node_modules/express/node_modules/safe-buffer/index.js +65 -0
- package/ngp/node_modules/express/node_modules/safe-buffer/package.json +51 -0
- package/ngp/node_modules/express/package.json +99 -0
- package/ngp/node_modules/fill-range/LICENSE +21 -0
- package/ngp/node_modules/fill-range/README.md +237 -0
- package/ngp/node_modules/fill-range/index.js +249 -0
- package/ngp/node_modules/fill-range/package.json +69 -0
- package/ngp/node_modules/finalhandler/HISTORY.md +195 -0
- package/ngp/node_modules/finalhandler/LICENSE +22 -0
- package/ngp/node_modules/finalhandler/README.md +147 -0
- package/ngp/node_modules/finalhandler/SECURITY.md +25 -0
- package/ngp/node_modules/finalhandler/index.js +336 -0
- package/ngp/node_modules/finalhandler/package.json +46 -0
- package/ngp/node_modules/forwarded/HISTORY.md +21 -0
- package/ngp/node_modules/forwarded/LICENSE +22 -0
- package/ngp/node_modules/forwarded/README.md +57 -0
- package/ngp/node_modules/forwarded/index.js +90 -0
- package/ngp/node_modules/forwarded/package.json +45 -0
- package/ngp/node_modules/fresh/HISTORY.md +70 -0
- package/ngp/node_modules/fresh/LICENSE +23 -0
- package/ngp/node_modules/fresh/README.md +119 -0
- package/ngp/node_modules/fresh/index.js +137 -0
- package/ngp/node_modules/fresh/package.json +46 -0
- package/ngp/node_modules/function-bind/.editorconfig +20 -0
- package/ngp/node_modules/function-bind/.eslintrc +15 -0
- package/ngp/node_modules/function-bind/.jscs.json +176 -0
- package/ngp/node_modules/function-bind/.travis.yml +168 -0
- package/ngp/node_modules/function-bind/LICENSE +20 -0
- package/ngp/node_modules/function-bind/README.md +48 -0
- package/ngp/node_modules/function-bind/implementation.js +52 -0
- package/ngp/node_modules/function-bind/index.js +5 -0
- package/ngp/node_modules/function-bind/package.json +63 -0
- package/ngp/node_modules/function-bind/test/.eslintrc +9 -0
- package/ngp/node_modules/function-bind/test/index.js +252 -0
- package/ngp/node_modules/get-intrinsic/.eslintignore +1 -0
- package/ngp/node_modules/get-intrinsic/.eslintrc +43 -0
- package/ngp/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
- package/ngp/node_modules/get-intrinsic/.nycrc +13 -0
- package/ngp/node_modules/get-intrinsic/CHANGELOG.md +64 -0
- package/ngp/node_modules/get-intrinsic/LICENSE +21 -0
- package/ngp/node_modules/get-intrinsic/README.md +65 -0
- package/ngp/node_modules/get-intrinsic/index.js +330 -0
- package/ngp/node_modules/get-intrinsic/package.json +78 -0
- package/ngp/node_modules/get-intrinsic/test/GetIntrinsic.js +260 -0
- package/ngp/node_modules/glob-parent/CHANGELOG.md +110 -0
- package/ngp/node_modules/glob-parent/LICENSE +15 -0
- package/ngp/node_modules/glob-parent/README.md +137 -0
- package/ngp/node_modules/glob-parent/index.js +42 -0
- package/ngp/node_modules/glob-parent/package.json +48 -0
- package/ngp/node_modules/has/LICENSE-MIT +22 -0
- package/ngp/node_modules/has/README.md +18 -0
- package/ngp/node_modules/has/package.json +48 -0
- package/ngp/node_modules/has/src/index.js +5 -0
- package/ngp/node_modules/has/test/index.js +10 -0
- package/ngp/node_modules/has-symbols/.eslintrc +11 -0
- package/ngp/node_modules/has-symbols/.github/FUNDING.yml +12 -0
- package/ngp/node_modules/has-symbols/.nycrc +9 -0
- package/ngp/node_modules/has-symbols/CHANGELOG.md +75 -0
- package/ngp/node_modules/has-symbols/LICENSE +21 -0
- package/ngp/node_modules/has-symbols/README.md +46 -0
- package/ngp/node_modules/has-symbols/index.js +13 -0
- package/ngp/node_modules/has-symbols/package.json +101 -0
- package/ngp/node_modules/has-symbols/shams.js +42 -0
- package/ngp/node_modules/has-symbols/test/index.js +22 -0
- package/ngp/node_modules/has-symbols/test/shams/core-js.js +28 -0
- package/ngp/node_modules/has-symbols/test/shams/get-own-property-symbols.js +28 -0
- package/ngp/node_modules/has-symbols/test/tests.js +56 -0
- package/ngp/node_modules/http-errors/HISTORY.md +180 -0
- package/ngp/node_modules/http-errors/LICENSE +23 -0
- package/ngp/node_modules/http-errors/README.md +169 -0
- package/ngp/node_modules/http-errors/index.js +289 -0
- package/ngp/node_modules/http-errors/package.json +50 -0
- package/ngp/node_modules/iconv-lite/Changelog.md +184 -0
- package/ngp/node_modules/iconv-lite/LICENSE +21 -0
- package/ngp/node_modules/iconv-lite/README.md +166 -0
- package/ngp/node_modules/iconv-lite/encodings/dbcs-codec.js +555 -0
- package/ngp/node_modules/iconv-lite/encodings/dbcs-data.js +176 -0
- package/ngp/node_modules/iconv-lite/encodings/index.js +23 -0
- package/ngp/node_modules/iconv-lite/encodings/internal.js +188 -0
- package/ngp/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
- package/ngp/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
- package/ngp/node_modules/iconv-lite/encodings/sbcs-data.js +179 -0
- package/ngp/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
- package/ngp/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
- package/ngp/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
- package/ngp/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
- package/ngp/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
- package/ngp/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
- package/ngp/node_modules/iconv-lite/encodings/tables/gbk-added.json +55 -0
- package/ngp/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
- package/ngp/node_modules/iconv-lite/encodings/utf16.js +177 -0
- package/ngp/node_modules/iconv-lite/encodings/utf32.js +281 -0
- package/ngp/node_modules/iconv-lite/encodings/utf7.js +290 -0
- package/ngp/node_modules/iconv-lite/lib/bom-handling.js +52 -0
- package/ngp/node_modules/iconv-lite/lib/extend-node.js +217 -0
- package/ngp/node_modules/iconv-lite/lib/index.d.ts +41 -0
- package/ngp/node_modules/iconv-lite/lib/index.js +153 -0
- package/ngp/node_modules/iconv-lite/lib/streams.js +121 -0
- package/ngp/node_modules/iconv-lite/package.json +45 -0
- package/ngp/node_modules/inherits/LICENSE +16 -0
- package/ngp/node_modules/inherits/README.md +42 -0
- package/ngp/node_modules/inherits/inherits.js +9 -0
- package/ngp/node_modules/inherits/inherits_browser.js +27 -0
- package/ngp/node_modules/inherits/package.json +29 -0
- package/ngp/node_modules/ipaddr.js/LICENSE +19 -0
- package/ngp/node_modules/ipaddr.js/README.md +233 -0
- package/ngp/node_modules/ipaddr.js/ipaddr.min.js +1 -0
- package/ngp/node_modules/ipaddr.js/lib/ipaddr.js +673 -0
- package/ngp/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +68 -0
- package/ngp/node_modules/ipaddr.js/package.json +35 -0
- package/ngp/node_modules/is-binary-path/index.d.ts +17 -0
- package/ngp/node_modules/is-binary-path/index.js +7 -0
- package/ngp/node_modules/is-binary-path/license +9 -0
- package/ngp/node_modules/is-binary-path/package.json +40 -0
- package/ngp/node_modules/is-binary-path/readme.md +34 -0
- package/ngp/node_modules/is-extglob/LICENSE +21 -0
- package/ngp/node_modules/is-extglob/README.md +107 -0
- package/ngp/node_modules/is-extglob/index.js +20 -0
- package/ngp/node_modules/is-extglob/package.json +69 -0
- package/ngp/node_modules/is-glob/LICENSE +21 -0
- package/ngp/node_modules/is-glob/README.md +206 -0
- package/ngp/node_modules/is-glob/index.js +150 -0
- package/ngp/node_modules/is-glob/package.json +81 -0
- package/ngp/node_modules/is-number/LICENSE +21 -0
- package/ngp/node_modules/is-number/README.md +187 -0
- package/ngp/node_modules/is-number/index.js +18 -0
- package/ngp/node_modules/is-number/package.json +82 -0
- package/ngp/node_modules/media-typer/HISTORY.md +22 -0
- package/ngp/node_modules/media-typer/LICENSE +22 -0
- package/ngp/node_modules/media-typer/README.md +81 -0
- package/ngp/node_modules/media-typer/index.js +270 -0
- package/ngp/node_modules/media-typer/package.json +26 -0
- package/ngp/node_modules/merge-descriptors/HISTORY.md +21 -0
- package/ngp/node_modules/merge-descriptors/LICENSE +23 -0
- package/ngp/node_modules/merge-descriptors/README.md +48 -0
- package/ngp/node_modules/merge-descriptors/index.js +60 -0
- package/ngp/node_modules/merge-descriptors/package.json +32 -0
- package/ngp/node_modules/methods/HISTORY.md +29 -0
- package/ngp/node_modules/methods/LICENSE +24 -0
- package/ngp/node_modules/methods/README.md +51 -0
- package/ngp/node_modules/methods/index.js +69 -0
- package/ngp/node_modules/methods/package.json +36 -0
- package/ngp/node_modules/mime/CHANGELOG.md +164 -0
- package/ngp/node_modules/mime/LICENSE +21 -0
- package/ngp/node_modules/mime/README.md +90 -0
- package/ngp/node_modules/mime/cli.js +8 -0
- package/ngp/node_modules/mime/mime.js +108 -0
- package/ngp/node_modules/mime/package.json +44 -0
- package/ngp/node_modules/mime/src/build.js +53 -0
- package/ngp/node_modules/mime/src/test.js +60 -0
- package/ngp/node_modules/mime/types.json +1 -0
- package/ngp/node_modules/mime-db/HISTORY.md +507 -0
- package/ngp/node_modules/mime-db/LICENSE +23 -0
- package/ngp/node_modules/mime-db/README.md +100 -0
- package/ngp/node_modules/mime-db/db.json +8519 -0
- package/ngp/node_modules/mime-db/index.js +12 -0
- package/ngp/node_modules/mime-db/package.json +60 -0
- package/ngp/node_modules/mime-types/HISTORY.md +397 -0
- package/ngp/node_modules/mime-types/LICENSE +23 -0
- package/ngp/node_modules/mime-types/README.md +113 -0
- package/ngp/node_modules/mime-types/index.js +188 -0
- package/ngp/node_modules/mime-types/package.json +44 -0
- package/ngp/node_modules/ms/index.js +152 -0
- package/ngp/node_modules/ms/license.md +21 -0
- package/ngp/node_modules/ms/package.json +37 -0
- package/ngp/node_modules/ms/readme.md +51 -0
- package/ngp/node_modules/negotiator/HISTORY.md +108 -0
- package/ngp/node_modules/negotiator/LICENSE +24 -0
- package/ngp/node_modules/negotiator/README.md +203 -0
- package/ngp/node_modules/negotiator/index.js +82 -0
- package/ngp/node_modules/negotiator/lib/charset.js +169 -0
- package/ngp/node_modules/negotiator/lib/encoding.js +184 -0
- package/ngp/node_modules/negotiator/lib/language.js +179 -0
- package/ngp/node_modules/negotiator/lib/mediaType.js +294 -0
- package/ngp/node_modules/negotiator/package.json +42 -0
- package/ngp/node_modules/normalize-path/LICENSE +21 -0
- package/ngp/node_modules/normalize-path/README.md +127 -0
- package/ngp/node_modules/normalize-path/index.js +35 -0
- package/ngp/node_modules/normalize-path/package.json +77 -0
- package/ngp/node_modules/object-inspect/.eslintrc +53 -0
- package/ngp/node_modules/object-inspect/.github/FUNDING.yml +12 -0
- package/ngp/node_modules/object-inspect/.nycrc +13 -0
- package/ngp/node_modules/object-inspect/CHANGELOG.md +360 -0
- package/ngp/node_modules/object-inspect/LICENSE +21 -0
- package/ngp/node_modules/object-inspect/example/all.js +23 -0
- package/ngp/node_modules/object-inspect/example/circular.js +6 -0
- package/ngp/node_modules/object-inspect/example/fn.js +5 -0
- package/ngp/node_modules/object-inspect/example/inspect.js +10 -0
- package/ngp/node_modules/object-inspect/index.js +512 -0
- package/ngp/node_modules/object-inspect/package-support.json +20 -0
- package/ngp/node_modules/object-inspect/package.json +94 -0
- package/ngp/node_modules/object-inspect/readme.markdown +86 -0
- package/ngp/node_modules/object-inspect/test/bigint.js +58 -0
- package/ngp/node_modules/object-inspect/test/browser/dom.js +15 -0
- package/ngp/node_modules/object-inspect/test/circular.js +16 -0
- package/ngp/node_modules/object-inspect/test/deep.js +12 -0
- package/ngp/node_modules/object-inspect/test/element.js +53 -0
- package/ngp/node_modules/object-inspect/test/err.js +48 -0
- package/ngp/node_modules/object-inspect/test/fakes.js +29 -0
- package/ngp/node_modules/object-inspect/test/fn.js +76 -0
- package/ngp/node_modules/object-inspect/test/has.js +15 -0
- package/ngp/node_modules/object-inspect/test/holes.js +15 -0
- package/ngp/node_modules/object-inspect/test/indent-option.js +271 -0
- package/ngp/node_modules/object-inspect/test/inspect.js +139 -0
- package/ngp/node_modules/object-inspect/test/lowbyte.js +12 -0
- package/ngp/node_modules/object-inspect/test/number.js +58 -0
- package/ngp/node_modules/object-inspect/test/quoteStyle.js +17 -0
- package/ngp/node_modules/object-inspect/test/toStringTag.js +40 -0
- package/ngp/node_modules/object-inspect/test/undef.js +12 -0
- package/ngp/node_modules/object-inspect/test/values.js +211 -0
- package/ngp/node_modules/object-inspect/test-core-js.js +26 -0
- package/ngp/node_modules/object-inspect/util.inspect.js +1 -0
- package/ngp/node_modules/on-finished/HISTORY.md +98 -0
- package/ngp/node_modules/on-finished/LICENSE +23 -0
- package/ngp/node_modules/on-finished/README.md +162 -0
- package/ngp/node_modules/on-finished/index.js +234 -0
- package/ngp/node_modules/on-finished/package.json +39 -0
- package/ngp/node_modules/on-headers/HISTORY.md +21 -0
- package/ngp/node_modules/on-headers/LICENSE +22 -0
- package/ngp/node_modules/on-headers/README.md +81 -0
- package/ngp/node_modules/on-headers/index.js +132 -0
- package/ngp/node_modules/on-headers/package.json +42 -0
- package/ngp/node_modules/parseurl/HISTORY.md +58 -0
- package/ngp/node_modules/parseurl/LICENSE +24 -0
- package/ngp/node_modules/parseurl/README.md +133 -0
- package/ngp/node_modules/parseurl/index.js +158 -0
- package/ngp/node_modules/parseurl/package.json +40 -0
- package/ngp/node_modules/path-to-regexp/History.md +36 -0
- package/ngp/node_modules/path-to-regexp/LICENSE +21 -0
- package/ngp/node_modules/path-to-regexp/Readme.md +35 -0
- package/ngp/node_modules/path-to-regexp/index.js +129 -0
- package/ngp/node_modules/path-to-regexp/package.json +30 -0
- package/ngp/node_modules/picomatch/CHANGELOG.md +136 -0
- package/ngp/node_modules/picomatch/LICENSE +21 -0
- package/ngp/node_modules/picomatch/README.md +708 -0
- package/ngp/node_modules/picomatch/index.js +3 -0
- package/ngp/node_modules/picomatch/lib/constants.js +179 -0
- package/ngp/node_modules/picomatch/lib/parse.js +1091 -0
- package/ngp/node_modules/picomatch/lib/picomatch.js +342 -0
- package/ngp/node_modules/picomatch/lib/scan.js +391 -0
- package/ngp/node_modules/picomatch/lib/utils.js +64 -0
- package/ngp/node_modules/picomatch/package.json +81 -0
- package/ngp/node_modules/proxy-addr/HISTORY.md +161 -0
- package/ngp/node_modules/proxy-addr/LICENSE +22 -0
- package/ngp/node_modules/proxy-addr/README.md +139 -0
- package/ngp/node_modules/proxy-addr/index.js +327 -0
- package/ngp/node_modules/proxy-addr/package.json +47 -0
- package/ngp/node_modules/qs/.editorconfig +40 -0
- package/ngp/node_modules/qs/.eslintrc +38 -0
- package/ngp/node_modules/qs/.github/FUNDING.yml +12 -0
- package/ngp/node_modules/qs/.nycrc +13 -0
- package/ngp/node_modules/qs/CHANGELOG.md +388 -0
- package/ngp/node_modules/qs/LICENSE.md +29 -0
- package/ngp/node_modules/qs/README.md +623 -0
- package/ngp/node_modules/qs/dist/qs.js +2044 -0
- package/ngp/node_modules/qs/lib/formats.js +23 -0
- package/ngp/node_modules/qs/lib/index.js +11 -0
- package/ngp/node_modules/qs/lib/parse.js +263 -0
- package/ngp/node_modules/qs/lib/stringify.js +317 -0
- package/ngp/node_modules/qs/lib/utils.js +252 -0
- package/ngp/node_modules/qs/package.json +73 -0
- package/ngp/node_modules/qs/test/parse.js +841 -0
- package/ngp/node_modules/qs/test/stringify.js +865 -0
- package/ngp/node_modules/qs/test/utils.js +136 -0
- package/ngp/node_modules/range-parser/HISTORY.md +56 -0
- package/ngp/node_modules/range-parser/LICENSE +23 -0
- package/ngp/node_modules/range-parser/README.md +84 -0
- package/ngp/node_modules/range-parser/index.js +162 -0
- package/ngp/node_modules/range-parser/package.json +44 -0
- package/ngp/node_modules/raw-body/HISTORY.md +303 -0
- package/ngp/node_modules/raw-body/LICENSE +22 -0
- package/ngp/node_modules/raw-body/README.md +223 -0
- package/ngp/node_modules/raw-body/SECURITY.md +24 -0
- package/ngp/node_modules/raw-body/index.d.ts +87 -0
- package/ngp/node_modules/raw-body/index.js +329 -0
- package/ngp/node_modules/raw-body/node_modules/bytes/History.md +97 -0
- package/ngp/node_modules/raw-body/node_modules/bytes/LICENSE +23 -0
- package/ngp/node_modules/raw-body/node_modules/bytes/Readme.md +152 -0
- package/ngp/node_modules/raw-body/node_modules/bytes/index.js +170 -0
- package/ngp/node_modules/raw-body/node_modules/bytes/package.json +42 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/Changelog.md +162 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/LICENSE +21 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/README.md +156 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/dbcs-codec.js +555 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/dbcs-data.js +176 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/index.js +22 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/internal.js +188 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/sbcs-data.js +174 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/gbk-added.json +55 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/utf16.js +177 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/encodings/utf7.js +290 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/lib/bom-handling.js +52 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/lib/extend-node.js +217 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/lib/index.d.ts +24 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/lib/index.js +153 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/lib/streams.js +121 -0
- package/ngp/node_modules/raw-body/node_modules/iconv-lite/package.json +46 -0
- package/ngp/node_modules/raw-body/package.json +49 -0
- package/ngp/node_modules/readdirp/LICENSE +21 -0
- package/ngp/node_modules/readdirp/README.md +122 -0
- package/ngp/node_modules/readdirp/index.d.ts +43 -0
- package/ngp/node_modules/readdirp/index.js +287 -0
- package/ngp/node_modules/readdirp/package.json +122 -0
- package/ngp/node_modules/safe-buffer/LICENSE +21 -0
- package/ngp/node_modules/safe-buffer/README.md +584 -0
- package/ngp/node_modules/safe-buffer/index.d.ts +187 -0
- package/ngp/node_modules/safe-buffer/index.js +62 -0
- package/ngp/node_modules/safe-buffer/package.json +37 -0
- package/ngp/node_modules/safer-buffer/LICENSE +21 -0
- package/ngp/node_modules/safer-buffer/Porting-Buffer.md +268 -0
- package/ngp/node_modules/safer-buffer/Readme.md +156 -0
- package/ngp/node_modules/safer-buffer/dangerous.js +58 -0
- package/ngp/node_modules/safer-buffer/package.json +34 -0
- package/ngp/node_modules/safer-buffer/safer.js +77 -0
- package/ngp/node_modules/safer-buffer/tests.js +406 -0
- package/ngp/node_modules/send/HISTORY.md +521 -0
- package/ngp/node_modules/send/LICENSE +23 -0
- package/ngp/node_modules/send/README.md +327 -0
- package/ngp/node_modules/send/SECURITY.md +24 -0
- package/ngp/node_modules/send/index.js +1143 -0
- package/ngp/node_modules/send/node_modules/ms/index.js +162 -0
- package/ngp/node_modules/send/node_modules/ms/license.md +21 -0
- package/ngp/node_modules/send/node_modules/ms/package.json +38 -0
- package/ngp/node_modules/send/node_modules/ms/readme.md +59 -0
- package/ngp/node_modules/send/package.json +62 -0
- package/ngp/node_modules/serve-static/HISTORY.md +471 -0
- package/ngp/node_modules/serve-static/LICENSE +25 -0
- package/ngp/node_modules/serve-static/README.md +257 -0
- package/ngp/node_modules/serve-static/index.js +210 -0
- package/ngp/node_modules/serve-static/package.json +42 -0
- package/ngp/node_modules/setprototypeof/LICENSE +13 -0
- package/ngp/node_modules/setprototypeof/README.md +31 -0
- package/ngp/node_modules/setprototypeof/index.d.ts +2 -0
- package/ngp/node_modules/setprototypeof/index.js +17 -0
- package/ngp/node_modules/setprototypeof/package.json +38 -0
- package/ngp/node_modules/setprototypeof/test/index.js +24 -0
- package/ngp/node_modules/side-channel/.eslintignore +1 -0
- package/ngp/node_modules/side-channel/.eslintrc +11 -0
- package/ngp/node_modules/side-channel/.github/FUNDING.yml +12 -0
- package/ngp/node_modules/side-channel/.nycrc +13 -0
- package/ngp/node_modules/side-channel/CHANGELOG.md +65 -0
- package/ngp/node_modules/side-channel/LICENSE +21 -0
- package/ngp/node_modules/side-channel/README.md +2 -0
- package/ngp/node_modules/side-channel/index.js +124 -0
- package/ngp/node_modules/side-channel/package.json +67 -0
- package/ngp/node_modules/side-channel/test/index.js +78 -0
- package/ngp/node_modules/statuses/HISTORY.md +82 -0
- package/ngp/node_modules/statuses/LICENSE +23 -0
- package/ngp/node_modules/statuses/README.md +136 -0
- package/ngp/node_modules/statuses/codes.json +65 -0
- package/ngp/node_modules/statuses/index.js +146 -0
- package/ngp/node_modules/statuses/package.json +49 -0
- package/ngp/node_modules/to-regex-range/LICENSE +21 -0
- package/ngp/node_modules/to-regex-range/README.md +305 -0
- package/ngp/node_modules/to-regex-range/index.js +288 -0
- package/ngp/node_modules/to-regex-range/package.json +88 -0
- package/ngp/node_modules/toidentifier/HISTORY.md +9 -0
- package/ngp/node_modules/toidentifier/LICENSE +21 -0
- package/ngp/node_modules/toidentifier/README.md +61 -0
- package/ngp/node_modules/toidentifier/index.js +32 -0
- package/ngp/node_modules/toidentifier/package.json +38 -0
- package/ngp/node_modules/type-is/HISTORY.md +259 -0
- package/ngp/node_modules/type-is/LICENSE +23 -0
- package/ngp/node_modules/type-is/README.md +170 -0
- package/ngp/node_modules/type-is/index.js +266 -0
- package/ngp/node_modules/type-is/package.json +45 -0
- package/ngp/node_modules/uglify-js/LICENSE +29 -0
- package/ngp/node_modules/uglify-js/README.md +1423 -0
- package/ngp/node_modules/uglify-js/bin/uglifyjs +603 -0
- package/ngp/node_modules/uglify-js/lib/ast.js +2132 -0
- package/ngp/node_modules/uglify-js/lib/compress.js +13762 -0
- package/ngp/node_modules/uglify-js/lib/minify.js +277 -0
- package/ngp/node_modules/uglify-js/lib/mozilla-ast.js +1274 -0
- package/ngp/node_modules/uglify-js/lib/output.js +1936 -0
- package/ngp/node_modules/uglify-js/lib/parse.js +2559 -0
- package/ngp/node_modules/uglify-js/lib/propmangle.js +259 -0
- package/ngp/node_modules/uglify-js/lib/scope.js +860 -0
- package/ngp/node_modules/uglify-js/lib/sourcemap.js +195 -0
- package/ngp/node_modules/uglify-js/lib/transform.js +250 -0
- package/ngp/node_modules/uglify-js/lib/utils.js +285 -0
- package/ngp/node_modules/uglify-js/package.json +56 -0
- package/ngp/node_modules/uglify-js/tools/domprops.html +456 -0
- package/ngp/node_modules/uglify-js/tools/domprops.json +8325 -0
- package/ngp/node_modules/uglify-js/tools/exports.js +8 -0
- package/ngp/node_modules/uglify-js/tools/node.js +110 -0
- package/ngp/node_modules/uglify-js/tools/tty.js +22 -0
- package/ngp/node_modules/unpipe/HISTORY.md +4 -0
- package/ngp/node_modules/unpipe/LICENSE +22 -0
- package/ngp/node_modules/unpipe/README.md +43 -0
- package/ngp/node_modules/unpipe/index.js +69 -0
- package/ngp/node_modules/unpipe/package.json +27 -0
- package/ngp/node_modules/utils-merge/LICENSE +20 -0
- package/ngp/node_modules/utils-merge/README.md +34 -0
- package/ngp/node_modules/utils-merge/index.js +23 -0
- package/ngp/node_modules/utils-merge/package.json +40 -0
- package/ngp/node_modules/vary/HISTORY.md +39 -0
- package/ngp/node_modules/vary/LICENSE +22 -0
- package/ngp/node_modules/vary/README.md +101 -0
- package/ngp/node_modules/vary/index.js +149 -0
- package/ngp/node_modules/vary/package.json +43 -0
- package/ngp/package-lock.json +1508 -0
- package/package.json +3 -2
- package/readme.md +0 -4
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Bytes utility
|
|
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
|
+
Utility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
This is a [Node.js](https://nodejs.org/en/) module available through the
|
|
13
|
+
[npm registry](https://www.npmjs.com/). Installation is done using the
|
|
14
|
+
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
$ npm install bytes
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
var bytes = require('bytes');
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### bytes.format(number value, [options]): string|null
|
|
27
|
+
|
|
28
|
+
Format the given value in bytes into a string. If the value is negative, it is kept as such. If it is a float, it is
|
|
29
|
+
rounded.
|
|
30
|
+
|
|
31
|
+
**Arguments**
|
|
32
|
+
|
|
33
|
+
| Name | Type | Description |
|
|
34
|
+
|---------|----------|--------------------|
|
|
35
|
+
| value | `number` | Value in bytes |
|
|
36
|
+
| options | `Object` | Conversion options |
|
|
37
|
+
|
|
38
|
+
**Options**
|
|
39
|
+
|
|
40
|
+
| Property | Type | Description |
|
|
41
|
+
|-------------------|--------|-----------------------------------------------------------------------------------------|
|
|
42
|
+
| decimalPlaces | `number`|`null` | Maximum number of decimal places to include in output. Default value to `2`. |
|
|
43
|
+
| fixedDecimals | `boolean`|`null` | Whether to always display the maximum number of decimal places. Default value to `false` |
|
|
44
|
+
| thousandsSeparator | `string`|`null` | Example of values: `' '`, `','` and `.`... Default value to `''`. |
|
|
45
|
+
| unit | `string`|`null` | The unit in which the result will be returned (B/KB/MB/GB/TB). Default value to `''` (which means auto detect). |
|
|
46
|
+
| unitSeparator | `string`|`null` | Separator to use between number and unit. Default value to `''`. |
|
|
47
|
+
|
|
48
|
+
**Returns**
|
|
49
|
+
|
|
50
|
+
| Name | Type | Description |
|
|
51
|
+
|---------|------------------|-------------------------------------------------|
|
|
52
|
+
| results | `string`|`null` | Return null upon error. String value otherwise. |
|
|
53
|
+
|
|
54
|
+
**Example**
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
bytes(1024);
|
|
58
|
+
// output: '1KB'
|
|
59
|
+
|
|
60
|
+
bytes(1000);
|
|
61
|
+
// output: '1000B'
|
|
62
|
+
|
|
63
|
+
bytes(1000, {thousandsSeparator: ' '});
|
|
64
|
+
// output: '1 000B'
|
|
65
|
+
|
|
66
|
+
bytes(1024 * 1.7, {decimalPlaces: 0});
|
|
67
|
+
// output: '2KB'
|
|
68
|
+
|
|
69
|
+
bytes(1024, {unitSeparator: ' '});
|
|
70
|
+
// output: '1 KB'
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### bytes.parse(string|number value): number|null
|
|
75
|
+
|
|
76
|
+
Parse the string value into an integer in bytes. If no unit is given, or `value`
|
|
77
|
+
is a number, it is assumed the value is in bytes.
|
|
78
|
+
|
|
79
|
+
Supported units and abbreviations are as follows and are case-insensitive:
|
|
80
|
+
|
|
81
|
+
* `b` for bytes
|
|
82
|
+
* `kb` for kilobytes
|
|
83
|
+
* `mb` for megabytes
|
|
84
|
+
* `gb` for gigabytes
|
|
85
|
+
* `tb` for terabytes
|
|
86
|
+
|
|
87
|
+
The units are in powers of two, not ten. This means 1kb = 1024b according to this parser.
|
|
88
|
+
|
|
89
|
+
**Arguments**
|
|
90
|
+
|
|
91
|
+
| Name | Type | Description |
|
|
92
|
+
|---------------|--------|--------------------|
|
|
93
|
+
| value | `string`|`number` | String to parse, or number in bytes. |
|
|
94
|
+
|
|
95
|
+
**Returns**
|
|
96
|
+
|
|
97
|
+
| Name | Type | Description |
|
|
98
|
+
|---------|-------------|-------------------------|
|
|
99
|
+
| results | `number`|`null` | Return null upon error. Value in bytes otherwise. |
|
|
100
|
+
|
|
101
|
+
**Example**
|
|
102
|
+
|
|
103
|
+
```js
|
|
104
|
+
bytes('1KB');
|
|
105
|
+
// output: 1024
|
|
106
|
+
|
|
107
|
+
bytes('1024');
|
|
108
|
+
// output: 1024
|
|
109
|
+
|
|
110
|
+
bytes(1024);
|
|
111
|
+
// output: 1024
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## License
|
|
115
|
+
|
|
116
|
+
[MIT](LICENSE)
|
|
117
|
+
|
|
118
|
+
[downloads-image]: https://img.shields.io/npm/dm/bytes.svg
|
|
119
|
+
[downloads-url]: https://npmjs.org/package/bytes
|
|
120
|
+
[npm-image]: https://img.shields.io/npm/v/bytes.svg
|
|
121
|
+
[npm-url]: https://npmjs.org/package/bytes
|
|
122
|
+
[travis-image]: https://img.shields.io/travis/visionmedia/bytes.js/master.svg
|
|
123
|
+
[travis-url]: https://travis-ci.org/visionmedia/bytes.js
|
|
124
|
+
[coveralls-image]: https://img.shields.io/coveralls/visionmedia/bytes.js/master.svg
|
|
125
|
+
[coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* bytes
|
|
3
|
+
* Copyright(c) 2012-2014 TJ Holowaychuk
|
|
4
|
+
* Copyright(c) 2015 Jed Watson
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Module exports.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
module.exports = bytes;
|
|
16
|
+
module.exports.format = format;
|
|
17
|
+
module.exports.parse = parse;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Module variables.
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
|
|
25
|
+
|
|
26
|
+
var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
|
|
27
|
+
|
|
28
|
+
var map = {
|
|
29
|
+
b: 1,
|
|
30
|
+
kb: 1 << 10,
|
|
31
|
+
mb: 1 << 20,
|
|
32
|
+
gb: 1 << 30,
|
|
33
|
+
tb: ((1 << 30) * 1024)
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb)$/i;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Convert the given value in bytes into a string or parse to string to an integer in bytes.
|
|
40
|
+
*
|
|
41
|
+
* @param {string|number} value
|
|
42
|
+
* @param {{
|
|
43
|
+
* case: [string],
|
|
44
|
+
* decimalPlaces: [number]
|
|
45
|
+
* fixedDecimals: [boolean]
|
|
46
|
+
* thousandsSeparator: [string]
|
|
47
|
+
* unitSeparator: [string]
|
|
48
|
+
* }} [options] bytes options.
|
|
49
|
+
*
|
|
50
|
+
* @returns {string|number|null}
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
function bytes(value, options) {
|
|
54
|
+
if (typeof value === 'string') {
|
|
55
|
+
return parse(value);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (typeof value === 'number') {
|
|
59
|
+
return format(value, options);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Format the given value in bytes into a string.
|
|
67
|
+
*
|
|
68
|
+
* If the value is negative, it is kept as such. If it is a float,
|
|
69
|
+
* it is rounded.
|
|
70
|
+
*
|
|
71
|
+
* @param {number} value
|
|
72
|
+
* @param {object} [options]
|
|
73
|
+
* @param {number} [options.decimalPlaces=2]
|
|
74
|
+
* @param {number} [options.fixedDecimals=false]
|
|
75
|
+
* @param {string} [options.thousandsSeparator=]
|
|
76
|
+
* @param {string} [options.unit=]
|
|
77
|
+
* @param {string} [options.unitSeparator=]
|
|
78
|
+
*
|
|
79
|
+
* @returns {string|null}
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
function format(value, options) {
|
|
84
|
+
if (!Number.isFinite(value)) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var mag = Math.abs(value);
|
|
89
|
+
var thousandsSeparator = (options && options.thousandsSeparator) || '';
|
|
90
|
+
var unitSeparator = (options && options.unitSeparator) || '';
|
|
91
|
+
var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
|
|
92
|
+
var fixedDecimals = Boolean(options && options.fixedDecimals);
|
|
93
|
+
var unit = (options && options.unit) || '';
|
|
94
|
+
|
|
95
|
+
if (!unit || !map[unit.toLowerCase()]) {
|
|
96
|
+
if (mag >= map.tb) {
|
|
97
|
+
unit = 'TB';
|
|
98
|
+
} else if (mag >= map.gb) {
|
|
99
|
+
unit = 'GB';
|
|
100
|
+
} else if (mag >= map.mb) {
|
|
101
|
+
unit = 'MB';
|
|
102
|
+
} else if (mag >= map.kb) {
|
|
103
|
+
unit = 'KB';
|
|
104
|
+
} else {
|
|
105
|
+
unit = 'B';
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
var val = value / map[unit.toLowerCase()];
|
|
110
|
+
var str = val.toFixed(decimalPlaces);
|
|
111
|
+
|
|
112
|
+
if (!fixedDecimals) {
|
|
113
|
+
str = str.replace(formatDecimalsRegExp, '$1');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (thousandsSeparator) {
|
|
117
|
+
str = str.replace(formatThousandsRegExp, thousandsSeparator);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return str + unitSeparator + unit;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Parse the string value into an integer in bytes.
|
|
125
|
+
*
|
|
126
|
+
* If no unit is given, it is assumed the value is in bytes.
|
|
127
|
+
*
|
|
128
|
+
* @param {number|string} val
|
|
129
|
+
*
|
|
130
|
+
* @returns {number|null}
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
function parse(val) {
|
|
135
|
+
if (typeof val === 'number' && !isNaN(val)) {
|
|
136
|
+
return val;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (typeof val !== 'string') {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Test if the string passed is valid
|
|
144
|
+
var results = parseRegExp.exec(val);
|
|
145
|
+
var floatValue;
|
|
146
|
+
var unit = 'b';
|
|
147
|
+
|
|
148
|
+
if (!results) {
|
|
149
|
+
// Nothing could be extracted from the given string
|
|
150
|
+
floatValue = parseInt(val, 10);
|
|
151
|
+
unit = 'b'
|
|
152
|
+
} else {
|
|
153
|
+
// Retrieve the value and the unit
|
|
154
|
+
floatValue = parseFloat(results[1]);
|
|
155
|
+
unit = results[4].toLowerCase();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return Math.floor(map[unit] * floatValue);
|
|
159
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bytes",
|
|
3
|
+
"description": "Utility to parse a string bytes to bytes and vice-versa",
|
|
4
|
+
"version": "3.0.0",
|
|
5
|
+
"author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)",
|
|
6
|
+
"contributors": [
|
|
7
|
+
"Jed Watson <jed.watson@me.com>",
|
|
8
|
+
"Théo FIDRY <theo.fidry@gmail.com>"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"byte",
|
|
13
|
+
"bytes",
|
|
14
|
+
"utility",
|
|
15
|
+
"parse",
|
|
16
|
+
"parser",
|
|
17
|
+
"convert",
|
|
18
|
+
"converter"
|
|
19
|
+
],
|
|
20
|
+
"repository": "visionmedia/bytes.js",
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"mocha": "2.5.3",
|
|
23
|
+
"nyc": "10.3.2"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"History.md",
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"Readme.md",
|
|
29
|
+
"index.js"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">= 0.8"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"test": "mocha --check-leaks --reporter spec",
|
|
36
|
+
"test-ci": "nyc --reporter=text npm test",
|
|
37
|
+
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
coverage/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
|
|
4
|
+
"extends": "@ljharb",
|
|
5
|
+
|
|
6
|
+
"rules": {
|
|
7
|
+
"func-name-matching": 0,
|
|
8
|
+
"id-length": 0,
|
|
9
|
+
"new-cap": [2, {
|
|
10
|
+
"capIsNewExceptions": [
|
|
11
|
+
"GetIntrinsic",
|
|
12
|
+
],
|
|
13
|
+
}],
|
|
14
|
+
"no-magic-numbers": 0,
|
|
15
|
+
"operator-linebreak": [2, "before"],
|
|
16
|
+
},
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# These are supported funding model platforms
|
|
2
|
+
|
|
3
|
+
github: [ljharb]
|
|
4
|
+
patreon: # Replace with a single Patreon username
|
|
5
|
+
open_collective: # Replace with a single Open Collective username
|
|
6
|
+
ko_fi: # Replace with a single Ko-fi username
|
|
7
|
+
tidelift: npm/call-bind
|
|
8
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
9
|
+
liberapay: # Replace with a single Liberapay username
|
|
10
|
+
issuehunt: # Replace with a single IssueHunt username
|
|
11
|
+
otechie: # Replace with a single Otechie username
|
|
12
|
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [v1.0.2](https://github.com/ljharb/call-bind/compare/v1.0.1...v1.0.2) - 2021-01-11
|
|
9
|
+
|
|
10
|
+
### Commits
|
|
11
|
+
|
|
12
|
+
- [Fix] properly include the receiver in the bound length [`dbae7bc`](https://github.com/ljharb/call-bind/commit/dbae7bc676c079a0d33c0a43e9ef92cb7b01345d)
|
|
13
|
+
|
|
14
|
+
## [v1.0.1](https://github.com/ljharb/call-bind/compare/v1.0.0...v1.0.1) - 2021-01-08
|
|
15
|
+
|
|
16
|
+
### Commits
|
|
17
|
+
|
|
18
|
+
- [Tests] migrate tests to Github Actions [`b6db284`](https://github.com/ljharb/call-bind/commit/b6db284c36f8ccd195b88a6764fe84b7223a0da1)
|
|
19
|
+
- [meta] do not publish github action workflow files [`ec7fe46`](https://github.com/ljharb/call-bind/commit/ec7fe46e60cfa4764ee943d2755f5e5a366e578e)
|
|
20
|
+
- [Fix] preserve original function’s length when possible [`adbceaa`](https://github.com/ljharb/call-bind/commit/adbceaa3cac4b41ea78bb19d7ccdbaaf7e0bdadb)
|
|
21
|
+
- [Tests] gather coverage data on every job [`d69e23c`](https://github.com/ljharb/call-bind/commit/d69e23cc65f101ba1d4c19bb07fa8eb0ec624be8)
|
|
22
|
+
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`2fd3586`](https://github.com/ljharb/call-bind/commit/2fd3586c5d47b335364c14293114c6b625ae1f71)
|
|
23
|
+
- [Deps] update `get-intrinsic` [`f23e931`](https://github.com/ljharb/call-bind/commit/f23e9318cc271c2add8bb38cfded85ee7baf8eee)
|
|
24
|
+
- [Deps] update `get-intrinsic` [`72d9f44`](https://github.com/ljharb/call-bind/commit/72d9f44e184465ba8dd3fb48260bbcff234985f2)
|
|
25
|
+
- [meta] fix FUNDING.yml [`e723573`](https://github.com/ljharb/call-bind/commit/e723573438c5a68dcec31fb5d96ea6b7e4a93be8)
|
|
26
|
+
- [eslint] ignore coverage output [`15e76d2`](https://github.com/ljharb/call-bind/commit/15e76d28a5f43e504696401e5b31ebb78ee1b532)
|
|
27
|
+
- [meta] add Automatic Rebase and Require Allow Edits workflows [`8fa4dab`](https://github.com/ljharb/call-bind/commit/8fa4dabb23ba3dd7bb92c9571c1241c08b56e4b6)
|
|
28
|
+
|
|
29
|
+
## v1.0.0 - 2020-10-30
|
|
30
|
+
|
|
31
|
+
### Commits
|
|
32
|
+
|
|
33
|
+
- Initial commit [`306cf98`](https://github.com/ljharb/call-bind/commit/306cf98c7ec9e7ef66b653ec152277ac1381eb50)
|
|
34
|
+
- Tests [`e10d0bb`](https://github.com/ljharb/call-bind/commit/e10d0bbdadc7a10ecedc9a1c035112d3e368b8df)
|
|
35
|
+
- Implementation [`43852ed`](https://github.com/ljharb/call-bind/commit/43852eda0f187327b7fad2423ca972149a52bd65)
|
|
36
|
+
- npm init [`408f860`](https://github.com/ljharb/call-bind/commit/408f860b773a2f610805fd3613d0d71bac1b6249)
|
|
37
|
+
- [meta] add Automatic Rebase and Require Allow Edits workflows [`fb349b2`](https://github.com/ljharb/call-bind/commit/fb349b2e48defbec8b5ec8a8395cc8f69f220b13)
|
|
38
|
+
- [meta] add `auto-changelog` [`c4001fc`](https://github.com/ljharb/call-bind/commit/c4001fc43031799ef908211c98d3b0fb2b60fde4)
|
|
39
|
+
- [meta] add "funding"; create `FUNDING.yml` [`d4d6d29`](https://github.com/ljharb/call-bind/commit/d4d6d2974a14bc2e98830468eda7fe6d6a776717)
|
|
40
|
+
- [Tests] add `npm run lint` [`dedfb98`](https://github.com/ljharb/call-bind/commit/dedfb98bd0ecefb08ddb9a94061bd10cde4332af)
|
|
41
|
+
- Only apps should have lockfiles [`54ac776`](https://github.com/ljharb/call-bind/commit/54ac77653db45a7361dc153d2f478e743f110650)
|
|
42
|
+
- [meta] add `safe-publish-latest` [`9ea8e43`](https://github.com/ljharb/call-bind/commit/9ea8e435b950ce9b705559cd651039f9bf40140f)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Jordan Harband
|
|
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.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var GetIntrinsic = require('get-intrinsic');
|
|
4
|
+
|
|
5
|
+
var callBind = require('./');
|
|
6
|
+
|
|
7
|
+
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
|
|
8
|
+
|
|
9
|
+
module.exports = function callBoundIntrinsic(name, allowMissing) {
|
|
10
|
+
var intrinsic = GetIntrinsic(name, !!allowMissing);
|
|
11
|
+
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
|
12
|
+
return callBind(intrinsic);
|
|
13
|
+
}
|
|
14
|
+
return intrinsic;
|
|
15
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var bind = require('function-bind');
|
|
4
|
+
var GetIntrinsic = require('get-intrinsic');
|
|
5
|
+
|
|
6
|
+
var $apply = GetIntrinsic('%Function.prototype.apply%');
|
|
7
|
+
var $call = GetIntrinsic('%Function.prototype.call%');
|
|
8
|
+
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
|
|
9
|
+
|
|
10
|
+
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
|
|
11
|
+
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
|
12
|
+
var $max = GetIntrinsic('%Math.max%');
|
|
13
|
+
|
|
14
|
+
if ($defineProperty) {
|
|
15
|
+
try {
|
|
16
|
+
$defineProperty({}, 'a', { value: 1 });
|
|
17
|
+
} catch (e) {
|
|
18
|
+
// IE 8 has a broken defineProperty
|
|
19
|
+
$defineProperty = null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = function callBind(originalFunction) {
|
|
24
|
+
var func = $reflectApply(bind, $call, arguments);
|
|
25
|
+
if ($gOPD && $defineProperty) {
|
|
26
|
+
var desc = $gOPD(func, 'length');
|
|
27
|
+
if (desc.configurable) {
|
|
28
|
+
// original length, plus the receiver, minus any additional arguments (after the receiver)
|
|
29
|
+
$defineProperty(
|
|
30
|
+
func,
|
|
31
|
+
'length',
|
|
32
|
+
{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return func;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var applyBind = function applyBind() {
|
|
40
|
+
return $reflectApply(bind, $apply, arguments);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
if ($defineProperty) {
|
|
44
|
+
$defineProperty(module.exports, 'apply', { value: applyBind });
|
|
45
|
+
} else {
|
|
46
|
+
module.exports.apply = applyBind;
|
|
47
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "call-bind",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Robustly `.call.bind()` a function",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": [
|
|
8
|
+
{
|
|
9
|
+
"default": "./index.js"
|
|
10
|
+
},
|
|
11
|
+
"./index.js"
|
|
12
|
+
],
|
|
13
|
+
"./callBound": [
|
|
14
|
+
{
|
|
15
|
+
"default": "./callBound.js"
|
|
16
|
+
},
|
|
17
|
+
"./callBound.js"
|
|
18
|
+
],
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"prepublish": "safe-publish-latest",
|
|
23
|
+
"lint": "eslint --ext=.js,.mjs .",
|
|
24
|
+
"pretest": "npm run lint",
|
|
25
|
+
"tests-only": "nyc tape 'test/*'",
|
|
26
|
+
"test": "npm run tests-only",
|
|
27
|
+
"posttest": "aud --production",
|
|
28
|
+
"version": "auto-changelog && git add CHANGELOG.md",
|
|
29
|
+
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/ljharb/call-bind.git"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"javascript",
|
|
37
|
+
"ecmascript",
|
|
38
|
+
"es",
|
|
39
|
+
"js",
|
|
40
|
+
"callbind",
|
|
41
|
+
"callbound",
|
|
42
|
+
"call",
|
|
43
|
+
"bind",
|
|
44
|
+
"bound",
|
|
45
|
+
"call-bind",
|
|
46
|
+
"call-bound",
|
|
47
|
+
"function",
|
|
48
|
+
"es-abstract"
|
|
49
|
+
],
|
|
50
|
+
"author": "Jordan Harband <ljharb@gmail.com>",
|
|
51
|
+
"funding": {
|
|
52
|
+
"url": "https://github.com/sponsors/ljharb"
|
|
53
|
+
},
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://github.com/ljharb/call-bind/issues"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://github.com/ljharb/call-bind#readme",
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@ljharb/eslint-config": "^17.3.0",
|
|
61
|
+
"aud": "^1.1.3",
|
|
62
|
+
"auto-changelog": "^2.2.1",
|
|
63
|
+
"eslint": "^7.17.0",
|
|
64
|
+
"nyc": "^10.3.2",
|
|
65
|
+
"safe-publish-latest": "^1.1.4",
|
|
66
|
+
"tape": "^5.1.1"
|
|
67
|
+
},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"function-bind": "^1.1.1",
|
|
70
|
+
"get-intrinsic": "^1.0.2"
|
|
71
|
+
},
|
|
72
|
+
"auto-changelog": {
|
|
73
|
+
"output": "CHANGELOG.md",
|
|
74
|
+
"template": "keepachangelog",
|
|
75
|
+
"unreleased": false,
|
|
76
|
+
"commitLimit": false,
|
|
77
|
+
"backfillLimit": false,
|
|
78
|
+
"hideCredit": true
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var test = require('tape');
|
|
4
|
+
|
|
5
|
+
var callBound = require('../callBound');
|
|
6
|
+
|
|
7
|
+
test('callBound', function (t) {
|
|
8
|
+
// static primitive
|
|
9
|
+
t.equal(callBound('Array.length'), Array.length, 'Array.length yields itself');
|
|
10
|
+
t.equal(callBound('%Array.length%'), Array.length, '%Array.length% yields itself');
|
|
11
|
+
|
|
12
|
+
// static non-function object
|
|
13
|
+
t.equal(callBound('Array.prototype'), Array.prototype, 'Array.prototype yields itself');
|
|
14
|
+
t.equal(callBound('%Array.prototype%'), Array.prototype, '%Array.prototype% yields itself');
|
|
15
|
+
t.equal(callBound('Array.constructor'), Array.constructor, 'Array.constructor yields itself');
|
|
16
|
+
t.equal(callBound('%Array.constructor%'), Array.constructor, '%Array.constructor% yields itself');
|
|
17
|
+
|
|
18
|
+
// static function
|
|
19
|
+
t.equal(callBound('Date.parse'), Date.parse, 'Date.parse yields itself');
|
|
20
|
+
t.equal(callBound('%Date.parse%'), Date.parse, '%Date.parse% yields itself');
|
|
21
|
+
|
|
22
|
+
// prototype primitive
|
|
23
|
+
t.equal(callBound('Error.prototype.message'), Error.prototype.message, 'Error.prototype.message yields itself');
|
|
24
|
+
t.equal(callBound('%Error.prototype.message%'), Error.prototype.message, '%Error.prototype.message% yields itself');
|
|
25
|
+
|
|
26
|
+
// prototype function
|
|
27
|
+
t.notEqual(callBound('Object.prototype.toString'), Object.prototype.toString, 'Object.prototype.toString does not yield itself');
|
|
28
|
+
t.notEqual(callBound('%Object.prototype.toString%'), Object.prototype.toString, '%Object.prototype.toString% does not yield itself');
|
|
29
|
+
t.equal(callBound('Object.prototype.toString')(true), Object.prototype.toString.call(true), 'call-bound Object.prototype.toString calls into the original');
|
|
30
|
+
t.equal(callBound('%Object.prototype.toString%')(true), Object.prototype.toString.call(true), 'call-bound %Object.prototype.toString% calls into the original');
|
|
31
|
+
|
|
32
|
+
t['throws'](
|
|
33
|
+
function () { callBound('does not exist'); },
|
|
34
|
+
SyntaxError,
|
|
35
|
+
'nonexistent intrinsic throws'
|
|
36
|
+
);
|
|
37
|
+
t['throws'](
|
|
38
|
+
function () { callBound('does not exist', true); },
|
|
39
|
+
SyntaxError,
|
|
40
|
+
'allowMissing arg still throws for unknown intrinsic'
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
/* globals WeakRef: false */
|
|
44
|
+
t.test('real but absent intrinsic', { skip: typeof WeakRef !== 'undefined' }, function (st) {
|
|
45
|
+
st['throws'](
|
|
46
|
+
function () { callBound('WeakRef'); },
|
|
47
|
+
TypeError,
|
|
48
|
+
'real but absent intrinsic throws'
|
|
49
|
+
);
|
|
50
|
+
st.equal(callBound('WeakRef', true), undefined, 'allowMissing arg avoids exception');
|
|
51
|
+
st.end();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
t.end();
|
|
55
|
+
});
|