mirror of
https://gitee.com/dcloud/uni-preset-vue
synced 2026-01-30 00:05:29 +08:00
ignore bin
This commit is contained in:
1
node_modules/.bin/mkdirp
generated
vendored
1
node_modules/.bin/mkdirp
generated
vendored
@@ -1 +0,0 @@
|
||||
../mkdirp/bin/cmd.js
|
||||
1
node_modules/.bin/rimraf
generated
vendored
1
node_modules/.bin/rimraf
generated
vendored
@@ -1 +0,0 @@
|
||||
../rimraf/bin.js
|
||||
1
node_modules/.bin/seek-bunzip
generated
vendored
1
node_modules/.bin/seek-bunzip
generated
vendored
@@ -1 +0,0 @@
|
||||
../seek-bzip/bin/seek-bunzip
|
||||
1
node_modules/.bin/seek-table
generated
vendored
1
node_modules/.bin/seek-table
generated
vendored
@@ -1 +0,0 @@
|
||||
../seek-bzip/bin/seek-bzip-table
|
||||
147
node_modules/.yarn-integrity
generated
vendored
147
node_modules/.yarn-integrity
generated
vendored
@@ -1,147 +0,0 @@
|
||||
{
|
||||
"systemParams": "darwin-x64-64",
|
||||
"modulesFolders": [
|
||||
"node_modules"
|
||||
],
|
||||
"flags": [],
|
||||
"linkedModules": [],
|
||||
"topLevelPatterns": [
|
||||
"download-git-repo@^1.1.0",
|
||||
"glob@^7.1.3",
|
||||
"ora@^3.0.0",
|
||||
"rimraf@^2.6.2",
|
||||
"user-home@^2.0.0"
|
||||
],
|
||||
"lockfileEntries": {
|
||||
"ansi-regex@^3.0.0": "http://registry.npm.taobao.org/ansi-regex/download/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998",
|
||||
"ansi-styles@^3.2.1": "http://registry.npm.taobao.org/ansi-styles/download/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d",
|
||||
"balanced-match@^1.0.0": "http://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767",
|
||||
"base64-js@0.0.8": "http://registry.npm.taobao.org/base64-js/download/base64-js-0.0.8.tgz#1101e9544f4a76b1bc3b26d452ca96d7a35e7978",
|
||||
"bl@^1.0.0": "http://registry.npm.taobao.org/bl/download/bl-1.2.2.tgz#a160911717103c07410cef63ef51b397c025af9c",
|
||||
"brace-expansion@^1.1.7": "http://registry.npm.taobao.org/brace-expansion/download/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd",
|
||||
"buffer-alloc-unsafe@^1.1.0": "http://registry.npm.taobao.org/buffer-alloc-unsafe/download/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0",
|
||||
"buffer-alloc@^1.2.0": "http://registry.npm.taobao.org/buffer-alloc/download/buffer-alloc-1.2.0.tgz#890dd90d923a873e08e10e5fd51a57e5b7cce0ec",
|
||||
"buffer-crc32@~0.2.3": "http://registry.npm.taobao.org/buffer-crc32/download/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242",
|
||||
"buffer-fill@^1.0.0": "http://registry.npm.taobao.org/buffer-fill/download/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c",
|
||||
"buffer@^3.0.1": "http://registry.npm.taobao.org/buffer/download/buffer-3.6.0.tgz#a72c936f77b96bf52f5f7e7b467180628551defb",
|
||||
"capture-stack-trace@^1.0.0": "http://registry.npm.taobao.org/capture-stack-trace/download/capture-stack-trace-1.0.1.tgz#a6c0bbe1f38f3aa0b92238ecb6ff42c344d4135d",
|
||||
"caw@^2.0.0": "http://registry.npm.taobao.org/caw/download/caw-2.0.1.tgz#6c3ca071fc194720883c2dc5da9b074bfc7e9e95",
|
||||
"chalk@^2.0.1": "http://registry.npm.taobao.org/chalk/download/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e",
|
||||
"chalk@^2.3.1": "http://registry.npm.taobao.org/chalk/download/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e",
|
||||
"cli-cursor@^2.1.0": "http://registry.npm.taobao.org/cli-cursor/download/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5",
|
||||
"cli-spinners@^1.1.0": "http://registry.npm.taobao.org/cli-spinners/download/cli-spinners-1.3.1.tgz#002c1990912d0d59580c93bd36c056de99e4259a",
|
||||
"clone@^1.0.2": "http://registry.npm.taobao.org/clone/download/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e",
|
||||
"color-convert@^1.9.0": "http://registry.npm.taobao.org/color-convert/download/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8",
|
||||
"color-name@1.1.3": "http://registry.npm.taobao.org/color-name/download/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25",
|
||||
"commander@~2.8.1": "http://registry.npm.taobao.org/commander/download/commander-2.8.1.tgz#06be367febfda0c330aa1e2a072d3dc9762425d4",
|
||||
"concat-map@0.0.1": "http://registry.npm.taobao.org/concat-map/download/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b",
|
||||
"config-chain@^1.1.11": "http://registry.npm.taobao.org/config-chain/download/config-chain-1.1.12.tgz#0fde8d091200eb5e808caf25fe618c02f48e4efa",
|
||||
"core-util-is@~1.0.0": "http://registry.npm.taobao.org/core-util-is/download/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7",
|
||||
"create-error-class@^3.0.0": "http://registry.npm.taobao.org/create-error-class/download/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6",
|
||||
"decompress-tar@^4.0.0": "http://registry.npm.taobao.org/decompress-tar/download/decompress-tar-4.1.1.tgz#718cbd3fcb16209716e70a26b84e7ba4592e5af1",
|
||||
"decompress-tar@^4.1.0": "http://registry.npm.taobao.org/decompress-tar/download/decompress-tar-4.1.1.tgz#718cbd3fcb16209716e70a26b84e7ba4592e5af1",
|
||||
"decompress-tar@^4.1.1": "http://registry.npm.taobao.org/decompress-tar/download/decompress-tar-4.1.1.tgz#718cbd3fcb16209716e70a26b84e7ba4592e5af1",
|
||||
"decompress-tarbz2@^4.0.0": "http://registry.npm.taobao.org/decompress-tarbz2/download/decompress-tarbz2-4.1.1.tgz#3082a5b880ea4043816349f378b56c516be1a39b",
|
||||
"decompress-targz@^4.0.0": "http://registry.npm.taobao.org/decompress-targz/download/decompress-targz-4.1.1.tgz#c09bc35c4d11f3de09f2d2da53e9de23e7ce1eee",
|
||||
"decompress-unzip@^4.0.1": "http://registry.npm.taobao.org/decompress-unzip/download/decompress-unzip-4.0.1.tgz#deaaccdfd14aeaf85578f733ae8210f9b4848f69",
|
||||
"decompress@^4.0.0": "http://registry.npm.taobao.org/decompress/download/decompress-4.2.0.tgz#7aedd85427e5a92dacfe55674a7c505e96d01f9d",
|
||||
"defaults@^1.0.3": "http://registry.npm.taobao.org/defaults/download/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d",
|
||||
"download-git-repo@^1.1.0": "http://registry.npm.taobao.org/download-git-repo/download/download-git-repo-1.1.0.tgz#7dc88a82ced064b1372a0002f8a3aebf10eb1d3c",
|
||||
"download@^5.0.3": "http://registry.npm.taobao.org/download/download/download-5.0.3.tgz#63537f977f99266a30eb8a2a2fbd1f20b8000f7a",
|
||||
"duplexer3@^0.1.4": "http://registry.npm.taobao.org/duplexer3/download/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2",
|
||||
"end-of-stream@^1.0.0": "http://registry.npm.taobao.org/end-of-stream/download/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43",
|
||||
"escape-string-regexp@^1.0.2": "http://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4",
|
||||
"escape-string-regexp@^1.0.5": "http://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4",
|
||||
"fd-slicer@~1.1.0": "http://registry.npm.taobao.org/fd-slicer/download/fd-slicer-1.1.0.tgz#25c7c89cb1f9077f8891bbe61d8f390eae256f1e",
|
||||
"file-type@^3.8.0": "http://registry.npm.taobao.org/file-type/download/file-type-3.9.0.tgz#257a078384d1db8087bc449d107d52a52672b9e9",
|
||||
"file-type@^5.2.0": "http://registry.npm.taobao.org/file-type/download/file-type-5.2.0.tgz#2ddbea7c73ffe36368dfae49dc338c058c2b8ad6",
|
||||
"file-type@^6.1.0": "http://registry.npm.taobao.org/file-type/download/file-type-6.2.0.tgz#e50cd75d356ffed4e306dc4f5bcf52a79903a919",
|
||||
"filename-reserved-regex@^2.0.0": "http://registry.npm.taobao.org/filename-reserved-regex/download/filename-reserved-regex-2.0.0.tgz#abf73dfab735d045440abfea2d91f389ebbfa229",
|
||||
"filenamify@^2.0.0": "http://registry.npm.taobao.org/filenamify/download/filenamify-2.1.0.tgz#88faf495fb1b47abfd612300002a16228c677ee9",
|
||||
"fs-constants@^1.0.0": "http://registry.npm.taobao.org/fs-constants/download/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad",
|
||||
"fs.realpath@^1.0.0": "http://registry.npm.taobao.org/fs.realpath/download/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f",
|
||||
"get-proxy@^2.0.0": "http://registry.npm.taobao.org/get-proxy/download/get-proxy-2.1.0.tgz#349f2b4d91d44c4d4d4e9cba2ad90143fac5ef93",
|
||||
"get-stream@^2.2.0": "http://registry.npm.taobao.org/get-stream/download/get-stream-2.3.1.tgz#5f38f93f346009666ee0150a054167f91bdd95de",
|
||||
"get-stream@^3.0.0": "http://registry.npm.taobao.org/get-stream/download/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14",
|
||||
"git-clone@^0.1.0": "http://registry.npm.taobao.org/git-clone/download/git-clone-0.1.0.tgz#0d76163778093aef7f1c30238f2a9ef3f07a2eb9",
|
||||
"glob@^7.0.5": "http://registry.npm.taobao.org/glob/download/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1",
|
||||
"glob@^7.1.3": "http://registry.npm.taobao.org/glob/download/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1",
|
||||
"got@^6.3.0": "http://registry.npm.taobao.org/got/download/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0",
|
||||
"graceful-fs@^4.1.10": "http://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00",
|
||||
"graceful-readlink@>= 1.0.0": "http://registry.npm.taobao.org/graceful-readlink/download/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725",
|
||||
"has-flag@^3.0.0": "http://registry.npm.taobao.org/has-flag/download/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd",
|
||||
"has-symbol-support-x@^1.4.1": "http://registry.npm.taobao.org/has-symbol-support-x/download/has-symbol-support-x-1.4.2.tgz#1409f98bc00247da45da67cee0a36f282ff26455",
|
||||
"has-to-string-tag-x@^1.2.0": "http://registry.npm.taobao.org/has-to-string-tag-x/download/has-to-string-tag-x-1.4.1.tgz#a045ab383d7b4b2012a00148ab0aa5f290044d4d",
|
||||
"ieee754@^1.1.4": "http://registry.npm.taobao.org/ieee754/download/ieee754-1.1.12.tgz#50bf24e5b9c8bb98af4964c941cdb0918da7b60b",
|
||||
"inflight@^1.0.4": "http://registry.npm.taobao.org/inflight/download/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9",
|
||||
"inherits@2": "http://registry.npm.taobao.org/inherits/download/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de",
|
||||
"inherits@~2.0.3": "http://registry.npm.taobao.org/inherits/download/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de",
|
||||
"ini@^1.3.4": "http://registry.npm.taobao.org/ini/download/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927",
|
||||
"is-natural-number@^4.0.1": "http://registry.npm.taobao.org/is-natural-number/download/is-natural-number-4.0.1.tgz#ab9d76e1db4ced51e35de0c72ebecf09f734cde8",
|
||||
"is-object@^1.0.1": "http://registry.npm.taobao.org/is-object/download/is-object-1.0.1.tgz#8952688c5ec2ffd6b03ecc85e769e02903083470",
|
||||
"is-redirect@^1.0.0": "http://registry.npm.taobao.org/is-redirect/download/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24",
|
||||
"is-retry-allowed@^1.0.0": "http://registry.npm.taobao.org/is-retry-allowed/download/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34",
|
||||
"is-stream@^1.0.0": "http://registry.npm.taobao.org/is-stream/download/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44",
|
||||
"is-stream@^1.1.0": "http://registry.npm.taobao.org/is-stream/download/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44",
|
||||
"isarray@^1.0.0": "http://registry.npm.taobao.org/isarray/download/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11",
|
||||
"isarray@~1.0.0": "http://registry.npm.taobao.org/isarray/download/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11",
|
||||
"isurl@^1.0.0-alpha5": "http://registry.npm.taobao.org/isurl/download/isurl-1.0.0.tgz#b27f4f49f3cdaa3ea44a0a5b7f3462e6edc39d67",
|
||||
"log-symbols@^2.2.0": "http://registry.npm.taobao.org/log-symbols/download/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a",
|
||||
"lowercase-keys@^1.0.0": "http://registry.npm.taobao.org/lowercase-keys/download/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f",
|
||||
"make-dir@^1.0.0": "http://registry.npm.taobao.org/make-dir/download/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c",
|
||||
"mimic-fn@^1.0.0": "http://registry.npm.taobao.org/mimic-fn/download/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022",
|
||||
"minimatch@^3.0.4": "http://registry.npm.taobao.org/minimatch/download/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083",
|
||||
"minimist@0.0.8": "http://registry.npm.taobao.org/minimist/download/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d",
|
||||
"mkdirp@^0.5.1": "http://registry.npm.taobao.org/mkdirp/download/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903",
|
||||
"npm-conf@^1.1.0": "http://registry.npm.taobao.org/npm-conf/download/npm-conf-1.1.3.tgz#256cc47bd0e218c259c4e9550bf413bc2192aff9",
|
||||
"object-assign@^4.0.1": "http://registry.npm.taobao.org/object-assign/download/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863",
|
||||
"once@^1.3.0": "http://registry.npm.taobao.org/once/download/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1",
|
||||
"once@^1.4.0": "http://registry.npm.taobao.org/once/download/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1",
|
||||
"onetime@^2.0.0": "http://registry.npm.taobao.org/onetime/download/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4",
|
||||
"ora@^3.0.0": "http://registry.npm.taobao.org/ora/download/ora-3.0.0.tgz#8179e3525b9aafd99242d63cc206fd64732741d0",
|
||||
"os-homedir@^1.0.0": "http://registry.npm.taobao.org/os-homedir/download/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3",
|
||||
"path-is-absolute@^1.0.0": "http://registry.npm.taobao.org/path-is-absolute/download/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f",
|
||||
"pend@~1.2.0": "http://registry.npm.taobao.org/pend/download/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50",
|
||||
"pify@^2.3.0": "http://registry.npm.taobao.org/pify/download/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c",
|
||||
"pify@^3.0.0": "http://registry.npm.taobao.org/pify/download/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176",
|
||||
"pinkie-promise@^2.0.0": "http://registry.npm.taobao.org/pinkie-promise/download/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa",
|
||||
"pinkie@^2.0.0": "http://registry.npm.taobao.org/pinkie/download/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870",
|
||||
"prepend-http@^1.0.1": "http://registry.npm.taobao.org/prepend-http/download/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc",
|
||||
"process-nextick-args@~2.0.0": "http://registry.npm.taobao.org/process-nextick-args/download/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa",
|
||||
"proto-list@~1.2.1": "http://registry.npm.taobao.org/proto-list/download/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849",
|
||||
"readable-stream@^2.3.0": "http://registry.npm.taobao.org/readable-stream/download/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf",
|
||||
"readable-stream@^2.3.5": "http://registry.npm.taobao.org/readable-stream/download/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf",
|
||||
"restore-cursor@^2.0.0": "http://registry.npm.taobao.org/restore-cursor/download/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf",
|
||||
"rimraf@^2.6.1": "http://registry.npm.taobao.org/rimraf/download/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36",
|
||||
"rimraf@^2.6.2": "http://registry.npm.taobao.org/rimraf/download/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36",
|
||||
"safe-buffer@^5.0.1": "http://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d",
|
||||
"safe-buffer@^5.1.1": "http://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d",
|
||||
"safe-buffer@~5.1.0": "http://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d",
|
||||
"safe-buffer@~5.1.1": "http://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d",
|
||||
"seek-bzip@^1.0.5": "http://registry.npm.taobao.org/seek-bzip/download/seek-bzip-1.0.5.tgz#cfe917cb3d274bcffac792758af53173eb1fabdc",
|
||||
"signal-exit@^3.0.2": "http://registry.npm.taobao.org/signal-exit/download/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d",
|
||||
"string_decoder@~1.1.1": "http://registry.npm.taobao.org/string_decoder/download/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8",
|
||||
"strip-ansi@^4.0.0": "http://registry.npm.taobao.org/strip-ansi/download/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f",
|
||||
"strip-dirs@^2.0.0": "http://registry.npm.taobao.org/strip-dirs/download/strip-dirs-2.1.0.tgz#4987736264fc344cf20f6c34aca9d13d1d4ed6c5",
|
||||
"strip-outer@^1.0.0": "http://registry.npm.taobao.org/strip-outer/download/strip-outer-1.0.1.tgz#b2fd2abf6604b9d1e6013057195df836b8a9d631",
|
||||
"supports-color@^5.3.0": "http://registry.npm.taobao.org/supports-color/download/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f",
|
||||
"tar-stream@^1.5.2": "http://registry.npm.taobao.org/tar-stream/download/tar-stream-1.6.2.tgz#8ea55dab37972253d9a9af90fdcd559ae435c555",
|
||||
"through@^2.3.6": "http://registry.npm.taobao.org/through/download/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5",
|
||||
"timed-out@^4.0.0": "http://registry.npm.taobao.org/timed-out/download/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f",
|
||||
"to-buffer@^1.1.1": "http://registry.npm.taobao.org/to-buffer/download/to-buffer-1.1.1.tgz#493bd48f62d7c43fcded313a03dcadb2e1213a80",
|
||||
"trim-repeated@^1.0.0": "http://registry.npm.taobao.org/trim-repeated/download/trim-repeated-1.0.0.tgz#e3646a2ea4e891312bf7eace6cfb05380bc01c21",
|
||||
"tunnel-agent@^0.6.0": "http://registry.npm.taobao.org/tunnel-agent/download/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd",
|
||||
"unbzip2-stream@^1.0.9": "http://registry.npm.taobao.org/unbzip2-stream/download/unbzip2-stream-1.3.1.tgz#7854da51622a7e63624221196357803b552966a1",
|
||||
"unzip-response@^2.0.1": "http://registry.npm.taobao.org/unzip-response/download/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97",
|
||||
"url-parse-lax@^1.0.0": "http://registry.npm.taobao.org/url-parse-lax/download/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73",
|
||||
"url-to-options@^1.0.1": "http://registry.npm.taobao.org/url-to-options/download/url-to-options-1.0.1.tgz#1505a03a289a48cbd7a434efbaeec5055f5633a9",
|
||||
"user-home@^2.0.0": "http://registry.npm.taobao.org/user-home/download/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f",
|
||||
"util-deprecate@~1.0.1": "http://registry.npm.taobao.org/util-deprecate/download/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf",
|
||||
"wcwidth@^1.0.1": "http://registry.npm.taobao.org/wcwidth/download/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8",
|
||||
"wrappy@1": "http://registry.npm.taobao.org/wrappy/download/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f",
|
||||
"xtend@^4.0.0": "http://registry.npm.taobao.org/xtend/download/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af",
|
||||
"yauzl@^2.4.2": "http://registry.npm.taobao.org/yauzl/download/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9"
|
||||
},
|
||||
"files": [],
|
||||
"artifacts": {}
|
||||
}
|
||||
10
node_modules/ansi-regex/index.js
generated
vendored
10
node_modules/ansi-regex/index.js
generated
vendored
@@ -1,10 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = () => {
|
||||
const pattern = [
|
||||
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)',
|
||||
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))'
|
||||
].join('|');
|
||||
|
||||
return new RegExp(pattern, 'g');
|
||||
};
|
||||
9
node_modules/ansi-regex/license
generated
vendored
9
node_modules/ansi-regex/license
generated
vendored
@@ -1,9 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
53
node_modules/ansi-regex/package.json
generated
vendored
53
node_modules/ansi-regex/package.json
generated
vendored
@@ -1,53 +0,0 @@
|
||||
{
|
||||
"name": "ansi-regex",
|
||||
"version": "3.0.0",
|
||||
"description": "Regular expression for matching ANSI escape codes",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/ansi-regex",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava",
|
||||
"view-supported": "node fixtures/view-codes.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"text",
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"match",
|
||||
"test",
|
||||
"find",
|
||||
"pattern"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
46
node_modules/ansi-regex/readme.md
generated
vendored
46
node_modules/ansi-regex/readme.md
generated
vendored
@@ -1,46 +0,0 @@
|
||||
# ansi-regex [](https://travis-ci.org/chalk/ansi-regex)
|
||||
|
||||
> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install ansi-regex
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const ansiRegex = require('ansi-regex');
|
||||
|
||||
ansiRegex().test('\u001B[4mcake\u001B[0m');
|
||||
//=> true
|
||||
|
||||
ansiRegex().test('cake');
|
||||
//=> false
|
||||
|
||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex());
|
||||
//=> ['\u001B[4m', '\u001B[0m']
|
||||
```
|
||||
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why do you test for codes not in the ECMA 48 standard?
|
||||
|
||||
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
|
||||
|
||||
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
165
node_modules/ansi-styles/index.js
generated
vendored
165
node_modules/ansi-styles/index.js
generated
vendored
@@ -1,165 +0,0 @@
|
||||
'use strict';
|
||||
const colorConvert = require('color-convert');
|
||||
|
||||
const wrapAnsi16 = (fn, offset) => function () {
|
||||
const code = fn.apply(colorConvert, arguments);
|
||||
return `\u001B[${code + offset}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi256 = (fn, offset) => function () {
|
||||
const code = fn.apply(colorConvert, arguments);
|
||||
return `\u001B[${38 + offset};5;${code}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi16m = (fn, offset) => function () {
|
||||
const rgb = fn.apply(colorConvert, arguments);
|
||||
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
||||
};
|
||||
|
||||
function assembleStyles() {
|
||||
const codes = new Map();
|
||||
const styles = {
|
||||
modifier: {
|
||||
reset: [0, 0],
|
||||
// 21 isn't widely supported and 22 does the same thing
|
||||
bold: [1, 22],
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29]
|
||||
},
|
||||
color: {
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
gray: [90, 39],
|
||||
|
||||
// Bright color
|
||||
redBright: [91, 39],
|
||||
greenBright: [92, 39],
|
||||
yellowBright: [93, 39],
|
||||
blueBright: [94, 39],
|
||||
magentaBright: [95, 39],
|
||||
cyanBright: [96, 39],
|
||||
whiteBright: [97, 39]
|
||||
},
|
||||
bgColor: {
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49],
|
||||
|
||||
// Bright color
|
||||
bgBlackBright: [100, 49],
|
||||
bgRedBright: [101, 49],
|
||||
bgGreenBright: [102, 49],
|
||||
bgYellowBright: [103, 49],
|
||||
bgBlueBright: [104, 49],
|
||||
bgMagentaBright: [105, 49],
|
||||
bgCyanBright: [106, 49],
|
||||
bgWhiteBright: [107, 49]
|
||||
}
|
||||
};
|
||||
|
||||
// Fix humans
|
||||
styles.color.grey = styles.color.gray;
|
||||
|
||||
for (const groupName of Object.keys(styles)) {
|
||||
const group = styles[groupName];
|
||||
|
||||
for (const styleName of Object.keys(group)) {
|
||||
const style = group[styleName];
|
||||
|
||||
styles[styleName] = {
|
||||
open: `\u001B[${style[0]}m`,
|
||||
close: `\u001B[${style[1]}m`
|
||||
};
|
||||
|
||||
group[styleName] = styles[styleName];
|
||||
|
||||
codes.set(style[0], style[1]);
|
||||
}
|
||||
|
||||
Object.defineProperty(styles, groupName, {
|
||||
value: group,
|
||||
enumerable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(styles, 'codes', {
|
||||
value: codes,
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
|
||||
const ansi2ansi = n => n;
|
||||
const rgb2rgb = (r, g, b) => [r, g, b];
|
||||
|
||||
styles.color.close = '\u001B[39m';
|
||||
styles.bgColor.close = '\u001B[49m';
|
||||
|
||||
styles.color.ansi = {
|
||||
ansi: wrapAnsi16(ansi2ansi, 0)
|
||||
};
|
||||
styles.color.ansi256 = {
|
||||
ansi256: wrapAnsi256(ansi2ansi, 0)
|
||||
};
|
||||
styles.color.ansi16m = {
|
||||
rgb: wrapAnsi16m(rgb2rgb, 0)
|
||||
};
|
||||
|
||||
styles.bgColor.ansi = {
|
||||
ansi: wrapAnsi16(ansi2ansi, 10)
|
||||
};
|
||||
styles.bgColor.ansi256 = {
|
||||
ansi256: wrapAnsi256(ansi2ansi, 10)
|
||||
};
|
||||
styles.bgColor.ansi16m = {
|
||||
rgb: wrapAnsi16m(rgb2rgb, 10)
|
||||
};
|
||||
|
||||
for (let key of Object.keys(colorConvert)) {
|
||||
if (typeof colorConvert[key] !== 'object') {
|
||||
continue;
|
||||
}
|
||||
|
||||
const suite = colorConvert[key];
|
||||
|
||||
if (key === 'ansi16') {
|
||||
key = 'ansi';
|
||||
}
|
||||
|
||||
if ('ansi16' in suite) {
|
||||
styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
|
||||
styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
|
||||
}
|
||||
|
||||
if ('ansi256' in suite) {
|
||||
styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
|
||||
styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
|
||||
}
|
||||
|
||||
if ('rgb' in suite) {
|
||||
styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
|
||||
styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
|
||||
}
|
||||
}
|
||||
|
||||
return styles;
|
||||
}
|
||||
|
||||
// Make the export immutable
|
||||
Object.defineProperty(module, 'exports', {
|
||||
enumerable: true,
|
||||
get: assembleStyles
|
||||
});
|
||||
9
node_modules/ansi-styles/license
generated
vendored
9
node_modules/ansi-styles/license
generated
vendored
@@ -1,9 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
56
node_modules/ansi-styles/package.json
generated
vendored
56
node_modules/ansi-styles/package.json
generated
vendored
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"name": "ansi-styles",
|
||||
"version": "3.2.1",
|
||||
"description": "ANSI escape codes for styling strings in the terminal",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/ansi-styles",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava",
|
||||
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"color-convert": "^1.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"babel-polyfill": "^6.23.0",
|
||||
"svg-term-cli": "^2.1.1",
|
||||
"xo": "*"
|
||||
},
|
||||
"ava": {
|
||||
"require": "babel-polyfill"
|
||||
}
|
||||
}
|
||||
147
node_modules/ansi-styles/readme.md
generated
vendored
147
node_modules/ansi-styles/readme.md
generated
vendored
@@ -1,147 +0,0 @@
|
||||
# ansi-styles [](https://travis-ci.org/chalk/ansi-styles)
|
||||
|
||||
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
||||
|
||||
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
||||
|
||||
<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install ansi-styles
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const style = require('ansi-styles');
|
||||
|
||||
console.log(`${style.green.open}Hello world!${style.green.close}`);
|
||||
|
||||
|
||||
// Color conversion between 16/256/truecolor
|
||||
// NOTE: If conversion goes to 16 colors or 256 colors, the original color
|
||||
// may be degraded to fit that color palette. This means terminals
|
||||
// that do not support 16 million colors will best-match the
|
||||
// original color.
|
||||
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
|
||||
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
|
||||
console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Each style has an `open` and `close` property.
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(Not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(Not widely supported)*
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `gray` ("bright black")
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright`
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
|
||||
## Advanced usage
|
||||
|
||||
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
|
||||
|
||||
- `style.modifier`
|
||||
- `style.color`
|
||||
- `style.bgColor`
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(style.color.green.open);
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(style.codes.get(36));
|
||||
//=> 39
|
||||
```
|
||||
|
||||
|
||||
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
|
||||
|
||||
`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.
|
||||
|
||||
To use these, call the associated conversion function with the intended output, for example:
|
||||
|
||||
```js
|
||||
style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
|
||||
style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
|
||||
|
||||
style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||
style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||
|
||||
style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
|
||||
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
5
node_modules/balanced-match/.npmignore
generated
vendored
5
node_modules/balanced-match/.npmignore
generated
vendored
@@ -1,5 +0,0 @@
|
||||
test
|
||||
.gitignore
|
||||
.travis.yml
|
||||
Makefile
|
||||
example.js
|
||||
21
node_modules/balanced-match/LICENSE.md
generated
vendored
21
node_modules/balanced-match/LICENSE.md
generated
vendored
@@ -1,21 +0,0 @@
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
91
node_modules/balanced-match/README.md
generated
vendored
91
node_modules/balanced-match/README.md
generated
vendored
@@ -1,91 +0,0 @@
|
||||
# balanced-match
|
||||
|
||||
Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
|
||||
|
||||
[](http://travis-ci.org/juliangruber/balanced-match)
|
||||
[](https://www.npmjs.org/package/balanced-match)
|
||||
|
||||
[](https://ci.testling.com/juliangruber/balanced-match)
|
||||
|
||||
## Example
|
||||
|
||||
Get the first matching pair of braces:
|
||||
|
||||
```js
|
||||
var balanced = require('balanced-match');
|
||||
|
||||
console.log(balanced('{', '}', 'pre{in{nested}}post'));
|
||||
console.log(balanced('{', '}', 'pre{first}between{second}post'));
|
||||
console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'));
|
||||
```
|
||||
|
||||
The matches are:
|
||||
|
||||
```bash
|
||||
$ node example.js
|
||||
{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
|
||||
{ start: 3,
|
||||
end: 9,
|
||||
pre: 'pre',
|
||||
body: 'first',
|
||||
post: 'between{second}post' }
|
||||
{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### var m = balanced(a, b, str)
|
||||
|
||||
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||
object with those keys:
|
||||
|
||||
* **start** the index of the first match of `a`
|
||||
* **end** the index of the matching `b`
|
||||
* **pre** the preamble, `a` and `b` not included
|
||||
* **body** the match, `a` and `b` not included
|
||||
* **post** the postscript, `a` and `b` not included
|
||||
|
||||
If there's no match, `undefined` will be returned.
|
||||
|
||||
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.
|
||||
|
||||
### var r = balanced.range(a, b, str)
|
||||
|
||||
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||
array with indexes: `[ <a index>, <b index> ]`.
|
||||
|
||||
If there's no match, `undefined` will be returned.
|
||||
|
||||
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```bash
|
||||
npm install balanced-match
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
59
node_modules/balanced-match/index.js
generated
vendored
59
node_modules/balanced-match/index.js
generated
vendored
@@ -1,59 +0,0 @@
|
||||
'use strict';
|
||||
module.exports = balanced;
|
||||
function balanced(a, b, str) {
|
||||
if (a instanceof RegExp) a = maybeMatch(a, str);
|
||||
if (b instanceof RegExp) b = maybeMatch(b, str);
|
||||
|
||||
var r = range(a, b, str);
|
||||
|
||||
return r && {
|
||||
start: r[0],
|
||||
end: r[1],
|
||||
pre: str.slice(0, r[0]),
|
||||
body: str.slice(r[0] + a.length, r[1]),
|
||||
post: str.slice(r[1] + b.length)
|
||||
};
|
||||
}
|
||||
|
||||
function maybeMatch(reg, str) {
|
||||
var m = str.match(reg);
|
||||
return m ? m[0] : null;
|
||||
}
|
||||
|
||||
balanced.range = range;
|
||||
function range(a, b, str) {
|
||||
var begs, beg, left, right, result;
|
||||
var ai = str.indexOf(a);
|
||||
var bi = str.indexOf(b, ai + 1);
|
||||
var i = ai;
|
||||
|
||||
if (ai >= 0 && bi > 0) {
|
||||
begs = [];
|
||||
left = str.length;
|
||||
|
||||
while (i >= 0 && !result) {
|
||||
if (i == ai) {
|
||||
begs.push(i);
|
||||
ai = str.indexOf(a, i + 1);
|
||||
} else if (begs.length == 1) {
|
||||
result = [ begs.pop(), bi ];
|
||||
} else {
|
||||
beg = begs.pop();
|
||||
if (beg < left) {
|
||||
left = beg;
|
||||
right = bi;
|
||||
}
|
||||
|
||||
bi = str.indexOf(b, i + 1);
|
||||
}
|
||||
|
||||
i = ai < bi && ai >= 0 ? ai : bi;
|
||||
}
|
||||
|
||||
if (begs.length) {
|
||||
result = [ left, right ];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
49
node_modules/balanced-match/package.json
generated
vendored
49
node_modules/balanced-match/package.json
generated
vendored
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"name": "balanced-match",
|
||||
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
||||
"version": "1.0.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/balanced-match.git"
|
||||
},
|
||||
"homepage": "https://github.com/juliangruber/balanced-match",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "make test",
|
||||
"bench": "make bench"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"matcha": "^0.7.0",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"keywords": [
|
||||
"match",
|
||||
"regexp",
|
||||
"test",
|
||||
"balanced",
|
||||
"parse"
|
||||
],
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"firefox/20..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/25..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
}
|
||||
}
|
||||
5
node_modules/base64-js/.travis.yml
generated
vendored
5
node_modules/base64-js/.travis.yml
generated
vendored
@@ -1,5 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
- "0.11"
|
||||
21
node_modules/base64-js/LICENSE.MIT
generated
vendored
21
node_modules/base64-js/LICENSE.MIT
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
31
node_modules/base64-js/README.md
generated
vendored
31
node_modules/base64-js/README.md
generated
vendored
@@ -1,31 +0,0 @@
|
||||
base64-js
|
||||
=========
|
||||
|
||||
`base64-js` does basic base64 encoding/decoding in pure JS.
|
||||
|
||||
[](http://travis-ci.org/beatgammit/base64-js)
|
||||
|
||||
[](https://ci.testling.com/beatgammit/base64-js)
|
||||
|
||||
Many browsers already have base64 encoding/decoding functionality, but it is for text data, not all-purpose binary data.
|
||||
|
||||
Sometimes encoding/decoding binary data in the browser is useful, and that is what this module does.
|
||||
|
||||
## install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
`npm install base64-js`
|
||||
|
||||
## methods
|
||||
|
||||
`var base64 = require('base64-js')`
|
||||
|
||||
`base64` has two exposed functions, `toByteArray` and `fromByteArray`, which both take a single argument.
|
||||
|
||||
* `toByteArray` - Takes a base64 string and returns a byte array
|
||||
* `fromByteArray` - Takes a byte array and returns a base64 string
|
||||
|
||||
## license
|
||||
|
||||
MIT
|
||||
19
node_modules/base64-js/bench/bench.js
generated
vendored
19
node_modules/base64-js/bench/bench.js
generated
vendored
@@ -1,19 +0,0 @@
|
||||
var random = require('crypto').pseudoRandomBytes
|
||||
|
||||
var b64 = require('../')
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var data = random(1e6).toString('base64')
|
||||
//fs.readFileSync(path.join(__dirname, 'example.b64'), 'ascii').split('\n').join('')
|
||||
var start = Date.now()
|
||||
var raw = b64.toByteArray(data)
|
||||
var middle = Date.now()
|
||||
var data = b64.fromByteArray(raw)
|
||||
var end = Date.now()
|
||||
|
||||
console.log('decode ms, decode ops/ms, encode ms, encode ops/ms')
|
||||
console.log(
|
||||
middle - start, data.length / (middle - start),
|
||||
end - middle, data.length / (end - middle))
|
||||
//console.log(data)
|
||||
|
||||
124
node_modules/base64-js/lib/b64.js
generated
vendored
124
node_modules/base64-js/lib/b64.js
generated
vendored
@@ -1,124 +0,0 @@
|
||||
var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||
|
||||
;(function (exports) {
|
||||
'use strict';
|
||||
|
||||
var Arr = (typeof Uint8Array !== 'undefined')
|
||||
? Uint8Array
|
||||
: Array
|
||||
|
||||
var PLUS = '+'.charCodeAt(0)
|
||||
var SLASH = '/'.charCodeAt(0)
|
||||
var NUMBER = '0'.charCodeAt(0)
|
||||
var LOWER = 'a'.charCodeAt(0)
|
||||
var UPPER = 'A'.charCodeAt(0)
|
||||
var PLUS_URL_SAFE = '-'.charCodeAt(0)
|
||||
var SLASH_URL_SAFE = '_'.charCodeAt(0)
|
||||
|
||||
function decode (elt) {
|
||||
var code = elt.charCodeAt(0)
|
||||
if (code === PLUS ||
|
||||
code === PLUS_URL_SAFE)
|
||||
return 62 // '+'
|
||||
if (code === SLASH ||
|
||||
code === SLASH_URL_SAFE)
|
||||
return 63 // '/'
|
||||
if (code < NUMBER)
|
||||
return -1 //no match
|
||||
if (code < NUMBER + 10)
|
||||
return code - NUMBER + 26 + 26
|
||||
if (code < UPPER + 26)
|
||||
return code - UPPER
|
||||
if (code < LOWER + 26)
|
||||
return code - LOWER + 26
|
||||
}
|
||||
|
||||
function b64ToByteArray (b64) {
|
||||
var i, j, l, tmp, placeHolders, arr
|
||||
|
||||
if (b64.length % 4 > 0) {
|
||||
throw new Error('Invalid string. Length must be a multiple of 4')
|
||||
}
|
||||
|
||||
// the number of equal signs (place holders)
|
||||
// if there are two placeholders, than the two characters before it
|
||||
// represent one byte
|
||||
// if there is only one, then the three characters before it represent 2 bytes
|
||||
// this is just a cheap hack to not do indexOf twice
|
||||
var len = b64.length
|
||||
placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
|
||||
|
||||
// base64 is 4/3 + up to two characters of the original data
|
||||
arr = new Arr(b64.length * 3 / 4 - placeHolders)
|
||||
|
||||
// if there are placeholders, only get up to the last complete 4 chars
|
||||
l = placeHolders > 0 ? b64.length - 4 : b64.length
|
||||
|
||||
var L = 0
|
||||
|
||||
function push (v) {
|
||||
arr[L++] = v
|
||||
}
|
||||
|
||||
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
||||
tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
|
||||
push((tmp & 0xFF0000) >> 16)
|
||||
push((tmp & 0xFF00) >> 8)
|
||||
push(tmp & 0xFF)
|
||||
}
|
||||
|
||||
if (placeHolders === 2) {
|
||||
tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
|
||||
push(tmp & 0xFF)
|
||||
} else if (placeHolders === 1) {
|
||||
tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
|
||||
push((tmp >> 8) & 0xFF)
|
||||
push(tmp & 0xFF)
|
||||
}
|
||||
|
||||
return arr
|
||||
}
|
||||
|
||||
function uint8ToBase64 (uint8) {
|
||||
var i,
|
||||
extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
|
||||
output = "",
|
||||
temp, length
|
||||
|
||||
function encode (num) {
|
||||
return lookup.charAt(num)
|
||||
}
|
||||
|
||||
function tripletToBase64 (num) {
|
||||
return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
|
||||
}
|
||||
|
||||
// go through the array every three bytes, we'll deal with trailing stuff later
|
||||
for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
|
||||
temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
|
||||
output += tripletToBase64(temp)
|
||||
}
|
||||
|
||||
// pad the end with zeros, but make sure to not forget the extra bytes
|
||||
switch (extraBytes) {
|
||||
case 1:
|
||||
temp = uint8[uint8.length - 1]
|
||||
output += encode(temp >> 2)
|
||||
output += encode((temp << 4) & 0x3F)
|
||||
output += '=='
|
||||
break
|
||||
case 2:
|
||||
temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
|
||||
output += encode(temp >> 10)
|
||||
output += encode((temp >> 4) & 0x3F)
|
||||
output += encode((temp << 2) & 0x3F)
|
||||
output += '='
|
||||
break
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
exports.toByteArray = b64ToByteArray
|
||||
exports.fromByteArray = uint8ToBase64
|
||||
}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
|
||||
34
node_modules/base64-js/package.json
generated
vendored
34
node_modules/base64-js/package.json
generated
vendored
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"author": "T. Jameson Little <t.jameson.little@gmail.com>",
|
||||
"name": "base64-js",
|
||||
"description": "Base64 encoding/decoding in pure JS",
|
||||
"version": "0.0.8",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/beatgammit/base64-js.git"
|
||||
},
|
||||
"main": "lib/b64.js",
|
||||
"scripts": {
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": [
|
||||
"ie/6..latest",
|
||||
"chrome/4..latest",
|
||||
"firefox/3..latest",
|
||||
"safari/5.1..latest",
|
||||
"opera/11.0..latest",
|
||||
"iphone/6",
|
||||
"ipad/6"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"tape": "~2.3.2"
|
||||
}
|
||||
}
|
||||
51
node_modules/base64-js/test/convert.js
generated
vendored
51
node_modules/base64-js/test/convert.js
generated
vendored
@@ -1,51 +0,0 @@
|
||||
var test = require('tape'),
|
||||
b64 = require('../lib/b64'),
|
||||
checks = [
|
||||
'a',
|
||||
'aa',
|
||||
'aaa',
|
||||
'hi',
|
||||
'hi!',
|
||||
'hi!!',
|
||||
'sup',
|
||||
'sup?',
|
||||
'sup?!'
|
||||
];
|
||||
|
||||
test('convert to base64 and back', function (t) {
|
||||
t.plan(checks.length);
|
||||
|
||||
for (var i = 0; i < checks.length; i++) {
|
||||
var check = checks[i],
|
||||
b64Str,
|
||||
arr,
|
||||
str;
|
||||
|
||||
b64Str = b64.fromByteArray(map(check, function (char) { return char.charCodeAt(0); }));
|
||||
|
||||
arr = b64.toByteArray(b64Str);
|
||||
str = map(arr, function (byte) { return String.fromCharCode(byte); }).join('');
|
||||
|
||||
t.equal(check, str, 'Checked ' + check);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function map (arr, callback) {
|
||||
var res = [],
|
||||
kValue,
|
||||
mappedValue;
|
||||
|
||||
for (var k = 0, len = arr.length; k < len; k++) {
|
||||
if ((typeof arr === 'string' && !!arr.charAt(k))) {
|
||||
kValue = arr.charAt(k);
|
||||
mappedValue = callback(kValue, k, arr);
|
||||
res[k] = mappedValue;
|
||||
} else if (typeof arr !== 'string' && k in arr) {
|
||||
kValue = arr[k];
|
||||
mappedValue = callback(kValue, k, arr);
|
||||
res[k] = mappedValue;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
18
node_modules/base64-js/test/url-safe.js
generated
vendored
18
node_modules/base64-js/test/url-safe.js
generated
vendored
@@ -1,18 +0,0 @@
|
||||
var test = require('tape'),
|
||||
b64 = require('../lib/b64');
|
||||
|
||||
test('decode url-safe style base64 strings', function (t) {
|
||||
var expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff];
|
||||
|
||||
var actual = b64.toByteArray('//++/++/++//');
|
||||
for (var i = 0; i < actual.length; i++) {
|
||||
t.equal(actual[i], expected[i])
|
||||
}
|
||||
|
||||
actual = b64.toByteArray('__--_--_--__');
|
||||
for (var i = 0; i < actual.length; i++) {
|
||||
t.equal(actual[i], expected[i])
|
||||
}
|
||||
|
||||
t.end();
|
||||
});
|
||||
59
node_modules/bl/.jshintrc
generated
vendored
59
node_modules/bl/.jshintrc
generated
vendored
@@ -1,59 +0,0 @@
|
||||
{
|
||||
"predef": [ ]
|
||||
, "bitwise": false
|
||||
, "camelcase": false
|
||||
, "curly": false
|
||||
, "eqeqeq": false
|
||||
, "forin": false
|
||||
, "immed": false
|
||||
, "latedef": false
|
||||
, "noarg": true
|
||||
, "noempty": true
|
||||
, "nonew": true
|
||||
, "plusplus": false
|
||||
, "quotmark": true
|
||||
, "regexp": false
|
||||
, "undef": true
|
||||
, "unused": true
|
||||
, "strict": false
|
||||
, "trailing": true
|
||||
, "maxlen": 120
|
||||
, "asi": true
|
||||
, "boss": true
|
||||
, "debug": true
|
||||
, "eqnull": true
|
||||
, "esnext": true
|
||||
, "evil": true
|
||||
, "expr": true
|
||||
, "funcscope": false
|
||||
, "globalstrict": false
|
||||
, "iterator": false
|
||||
, "lastsemic": true
|
||||
, "laxbreak": true
|
||||
, "laxcomma": true
|
||||
, "loopfunc": true
|
||||
, "multistr": false
|
||||
, "onecase": false
|
||||
, "proto": false
|
||||
, "regexdash": false
|
||||
, "scripturl": true
|
||||
, "smarttabs": false
|
||||
, "shadow": false
|
||||
, "sub": true
|
||||
, "supernew": false
|
||||
, "validthis": true
|
||||
, "browser": true
|
||||
, "couch": false
|
||||
, "devel": false
|
||||
, "dojo": false
|
||||
, "mootools": false
|
||||
, "node": true
|
||||
, "nonstandard": true
|
||||
, "prototypejs": false
|
||||
, "rhino": false
|
||||
, "worker": true
|
||||
, "wsh": false
|
||||
, "nomen": false
|
||||
, "onevar": false
|
||||
, "passfail": false
|
||||
}
|
||||
16
node_modules/bl/.travis.yml
generated
vendored
16
node_modules/bl/.travis.yml
generated
vendored
@@ -1,16 +0,0 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- '0.10'
|
||||
- '0.12'
|
||||
- '4'
|
||||
- '6'
|
||||
- '8'
|
||||
- '9'
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
notifications:
|
||||
email:
|
||||
- rod@vagg.org
|
||||
- matteo.collina@gmail.com
|
||||
13
node_modules/bl/LICENSE.md
generated
vendored
13
node_modules/bl/LICENSE.md
generated
vendored
@@ -1,13 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
=====================
|
||||
|
||||
Copyright (c) 2013-2016 bl contributors
|
||||
----------------------------------
|
||||
|
||||
*bl contributors listed at <https://github.com/rvagg/bl#contributors>*
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
208
node_modules/bl/README.md
generated
vendored
208
node_modules/bl/README.md
generated
vendored
@@ -1,208 +0,0 @@
|
||||
# bl *(BufferList)*
|
||||
|
||||
[](https://travis-ci.org/rvagg/bl)
|
||||
|
||||
**A Node.js Buffer list collector, reader and streamer thingy.**
|
||||
|
||||
[](https://nodei.co/npm/bl/)
|
||||
[](https://nodei.co/npm/bl/)
|
||||
|
||||
**bl** is a storage object for collections of Node Buffers, exposing them with the main Buffer readable API. Also works as a duplex stream so you can collect buffers from a stream that emits them and emit buffers to a stream that consumes them!
|
||||
|
||||
The original buffers are kept intact and copies are only done as necessary. Any reads that require the use of a single original buffer will return a slice of that buffer only (which references the same memory as the original buffer). Reads that span buffers perform concatenation as required and return the results transparently.
|
||||
|
||||
```js
|
||||
const BufferList = require('bl')
|
||||
|
||||
var bl = new BufferList()
|
||||
bl.append(new Buffer('abcd'))
|
||||
bl.append(new Buffer('efg'))
|
||||
bl.append('hi') // bl will also accept & convert Strings
|
||||
bl.append(new Buffer('j'))
|
||||
bl.append(new Buffer([ 0x3, 0x4 ]))
|
||||
|
||||
console.log(bl.length) // 12
|
||||
|
||||
console.log(bl.slice(0, 10).toString('ascii')) // 'abcdefghij'
|
||||
console.log(bl.slice(3, 10).toString('ascii')) // 'defghij'
|
||||
console.log(bl.slice(3, 6).toString('ascii')) // 'def'
|
||||
console.log(bl.slice(3, 8).toString('ascii')) // 'defgh'
|
||||
console.log(bl.slice(5, 10).toString('ascii')) // 'fghij'
|
||||
|
||||
// or just use toString!
|
||||
console.log(bl.toString()) // 'abcdefghij\u0003\u0004'
|
||||
console.log(bl.toString('ascii', 3, 8)) // 'defgh'
|
||||
console.log(bl.toString('ascii', 5, 10)) // 'fghij'
|
||||
|
||||
// other standard Buffer readables
|
||||
console.log(bl.readUInt16BE(10)) // 0x0304
|
||||
console.log(bl.readUInt16LE(10)) // 0x0403
|
||||
```
|
||||
|
||||
Give it a callback in the constructor and use it just like **[concat-stream](https://github.com/maxogden/node-concat-stream)**:
|
||||
|
||||
```js
|
||||
const bl = require('bl')
|
||||
, fs = require('fs')
|
||||
|
||||
fs.createReadStream('README.md')
|
||||
.pipe(bl(function (err, data) { // note 'new' isn't strictly required
|
||||
// `data` is a complete Buffer object containing the full data
|
||||
console.log(data.toString())
|
||||
}))
|
||||
```
|
||||
|
||||
Note that when you use the *callback* method like this, the resulting `data` parameter is a concatenation of all `Buffer` objects in the list. If you want to avoid the overhead of this concatenation (in cases of extreme performance consciousness), then avoid the *callback* method and just listen to `'end'` instead, like a standard Stream.
|
||||
|
||||
Or to fetch a URL using [hyperquest](https://github.com/substack/hyperquest) (should work with [request](http://github.com/mikeal/request) and even plain Node http too!):
|
||||
```js
|
||||
const hyperquest = require('hyperquest')
|
||||
, bl = require('bl')
|
||||
, url = 'https://raw.github.com/rvagg/bl/master/README.md'
|
||||
|
||||
hyperquest(url).pipe(bl(function (err, data) {
|
||||
console.log(data.toString())
|
||||
}))
|
||||
```
|
||||
|
||||
Or, use it as a readable stream to recompose a list of Buffers to an output source:
|
||||
|
||||
```js
|
||||
const BufferList = require('bl')
|
||||
, fs = require('fs')
|
||||
|
||||
var bl = new BufferList()
|
||||
bl.append(new Buffer('abcd'))
|
||||
bl.append(new Buffer('efg'))
|
||||
bl.append(new Buffer('hi'))
|
||||
bl.append(new Buffer('j'))
|
||||
|
||||
bl.pipe(fs.createWriteStream('gibberish.txt'))
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
* <a href="#ctor"><code><b>new BufferList([ callback ])</b></code></a>
|
||||
* <a href="#length"><code>bl.<b>length</b></code></a>
|
||||
* <a href="#append"><code>bl.<b>append(buffer)</b></code></a>
|
||||
* <a href="#get"><code>bl.<b>get(index)</b></code></a>
|
||||
* <a href="#slice"><code>bl.<b>slice([ start[, end ] ])</b></code></a>
|
||||
* <a href="#shallowSlice"><code>bl.<b>shallowSlice([ start[, end ] ])</b></code></a>
|
||||
* <a href="#copy"><code>bl.<b>copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])</b></code></a>
|
||||
* <a href="#duplicate"><code>bl.<b>duplicate()</b></code></a>
|
||||
* <a href="#consume"><code>bl.<b>consume(bytes)</b></code></a>
|
||||
* <a href="#toString"><code>bl.<b>toString([encoding, [ start, [ end ]]])</b></code></a>
|
||||
* <a href="#readXX"><code>bl.<b>readDoubleBE()</b></code>, <code>bl.<b>readDoubleLE()</b></code>, <code>bl.<b>readFloatBE()</b></code>, <code>bl.<b>readFloatLE()</b></code>, <code>bl.<b>readInt32BE()</b></code>, <code>bl.<b>readInt32LE()</b></code>, <code>bl.<b>readUInt32BE()</b></code>, <code>bl.<b>readUInt32LE()</b></code>, <code>bl.<b>readInt16BE()</b></code>, <code>bl.<b>readInt16LE()</b></code>, <code>bl.<b>readUInt16BE()</b></code>, <code>bl.<b>readUInt16LE()</b></code>, <code>bl.<b>readInt8()</b></code>, <code>bl.<b>readUInt8()</b></code></a>
|
||||
* <a href="#streams">Streams</a>
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="ctor"></a>
|
||||
### new BufferList([ callback | Buffer | Buffer array | BufferList | BufferList array | String ])
|
||||
The constructor takes an optional callback, if supplied, the callback will be called with an error argument followed by a reference to the **bl** instance, when `bl.end()` is called (i.e. from a piped stream). This is a convenient method of collecting the entire contents of a stream, particularly when the stream is *chunky*, such as a network stream.
|
||||
|
||||
Normally, no arguments are required for the constructor, but you can initialise the list by passing in a single `Buffer` object or an array of `Buffer` object.
|
||||
|
||||
`new` is not strictly required, if you don't instantiate a new object, it will be done automatically for you so you can create a new instance simply with:
|
||||
|
||||
```js
|
||||
var bl = require('bl')
|
||||
var myinstance = bl()
|
||||
|
||||
// equivalent to:
|
||||
|
||||
var BufferList = require('bl')
|
||||
var myinstance = new BufferList()
|
||||
```
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="length"></a>
|
||||
### bl.length
|
||||
Get the length of the list in bytes. This is the sum of the lengths of all of the buffers contained in the list, minus any initial offset for a semi-consumed buffer at the beginning. Should accurately represent the total number of bytes that can be read from the list.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="append"></a>
|
||||
### bl.append(Buffer | Buffer array | BufferList | BufferList array | String)
|
||||
`append(buffer)` adds an additional buffer or BufferList to the internal list. `this` is returned so it can be chained.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="get"></a>
|
||||
### bl.get(index)
|
||||
`get()` will return the byte at the specified index.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="slice"></a>
|
||||
### bl.slice([ start, [ end ] ])
|
||||
`slice()` returns a new `Buffer` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively.
|
||||
|
||||
If the requested range spans a single internal buffer then a slice of that buffer will be returned which shares the original memory range of that Buffer. If the range spans multiple buffers then copy operations will likely occur to give you a uniform Buffer.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="shallowSlice"></a>
|
||||
### bl.shallowSlice([ start, [ end ] ])
|
||||
`shallowSlice()` returns a new `BufferList` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively.
|
||||
|
||||
No copies will be performed. All buffers in the result share memory with the original list.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="copy"></a>
|
||||
### bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])
|
||||
`copy()` copies the content of the list in the `dest` buffer, starting from `destStart` and containing the bytes within the range specified with `srcStart` to `srcEnd`. `destStart`, `start` and `end` are optional and will default to the beginning of the `dest` buffer, and the beginning and end of the list respectively.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="duplicate"></a>
|
||||
### bl.duplicate()
|
||||
`duplicate()` performs a **shallow-copy** of the list. The internal Buffers remains the same, so if you change the underlying Buffers, the change will be reflected in both the original and the duplicate. This method is needed if you want to call `consume()` or `pipe()` and still keep the original list.Example:
|
||||
|
||||
```js
|
||||
var bl = new BufferList()
|
||||
|
||||
bl.append('hello')
|
||||
bl.append(' world')
|
||||
bl.append('\n')
|
||||
|
||||
bl.duplicate().pipe(process.stdout, { end: false })
|
||||
|
||||
console.log(bl.toString())
|
||||
```
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="consume"></a>
|
||||
### bl.consume(bytes)
|
||||
`consume()` will shift bytes *off the start of the list*. The number of bytes consumed don't need to line up with the sizes of the internal Buffers—initial offsets will be calculated accordingly in order to give you a consistent view of the data.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="toString"></a>
|
||||
### bl.toString([encoding, [ start, [ end ]]])
|
||||
`toString()` will return a string representation of the buffer. The optional `start` and `end` arguments are passed on to `slice()`, while the `encoding` is passed on to `toString()` of the resulting Buffer. See the [Buffer#toString()](http://nodejs.org/docs/latest/api/buffer.html#buffer_buf_tostring_encoding_start_end) documentation for more information.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="readXX"></a>
|
||||
### bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8()
|
||||
|
||||
All of the standard byte-reading methods of the `Buffer` interface are implemented and will operate across internal Buffer boundaries transparently.
|
||||
|
||||
See the <b><code>[Buffer](http://nodejs.org/docs/latest/api/buffer.html)</code></b> documentation for how these work.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="streams"></a>
|
||||
### Streams
|
||||
**bl** is a Node **[Duplex Stream](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_duplex)**, so it can be read from and written to like a standard Node stream. You can also `pipe()` to and from a **bl** instance.
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
## Contributors
|
||||
|
||||
**bl** is brought to you by the following hackers:
|
||||
|
||||
* [Rod Vagg](https://github.com/rvagg)
|
||||
* [Matteo Collina](https://github.com/mcollina)
|
||||
* [Jarett Cruger](https://github.com/jcrugzz)
|
||||
|
||||
=======
|
||||
|
||||
<a name="license"></a>
|
||||
## License & copyright
|
||||
|
||||
Copyright (c) 2013-2016 bl contributors (listed above).
|
||||
|
||||
bl is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
|
||||
281
node_modules/bl/bl.js
generated
vendored
281
node_modules/bl/bl.js
generated
vendored
@@ -1,281 +0,0 @@
|
||||
var DuplexStream = require('readable-stream/duplex')
|
||||
, util = require('util')
|
||||
, Buffer = require('safe-buffer').Buffer
|
||||
|
||||
|
||||
function BufferList (callback) {
|
||||
if (!(this instanceof BufferList))
|
||||
return new BufferList(callback)
|
||||
|
||||
this._bufs = []
|
||||
this.length = 0
|
||||
|
||||
if (typeof callback == 'function') {
|
||||
this._callback = callback
|
||||
|
||||
var piper = function piper (err) {
|
||||
if (this._callback) {
|
||||
this._callback(err)
|
||||
this._callback = null
|
||||
}
|
||||
}.bind(this)
|
||||
|
||||
this.on('pipe', function onPipe (src) {
|
||||
src.on('error', piper)
|
||||
})
|
||||
this.on('unpipe', function onUnpipe (src) {
|
||||
src.removeListener('error', piper)
|
||||
})
|
||||
} else {
|
||||
this.append(callback)
|
||||
}
|
||||
|
||||
DuplexStream.call(this)
|
||||
}
|
||||
|
||||
|
||||
util.inherits(BufferList, DuplexStream)
|
||||
|
||||
|
||||
BufferList.prototype._offset = function _offset (offset) {
|
||||
var tot = 0, i = 0, _t
|
||||
if (offset === 0) return [ 0, 0 ]
|
||||
for (; i < this._bufs.length; i++) {
|
||||
_t = tot + this._bufs[i].length
|
||||
if (offset < _t || i == this._bufs.length - 1)
|
||||
return [ i, offset - tot ]
|
||||
tot = _t
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype.append = function append (buf) {
|
||||
var i = 0
|
||||
|
||||
if (Buffer.isBuffer(buf)) {
|
||||
this._appendBuffer(buf);
|
||||
} else if (Array.isArray(buf)) {
|
||||
for (; i < buf.length; i++)
|
||||
this.append(buf[i])
|
||||
} else if (buf instanceof BufferList) {
|
||||
// unwrap argument into individual BufferLists
|
||||
for (; i < buf._bufs.length; i++)
|
||||
this.append(buf._bufs[i])
|
||||
} else if (buf != null) {
|
||||
// coerce number arguments to strings, since Buffer(number) does
|
||||
// uninitialized memory allocation
|
||||
if (typeof buf == 'number')
|
||||
buf = buf.toString()
|
||||
|
||||
this._appendBuffer(Buffer.from(buf));
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype._appendBuffer = function appendBuffer (buf) {
|
||||
this._bufs.push(buf)
|
||||
this.length += buf.length
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype._write = function _write (buf, encoding, callback) {
|
||||
this._appendBuffer(buf)
|
||||
|
||||
if (typeof callback == 'function')
|
||||
callback()
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype._read = function _read (size) {
|
||||
if (!this.length)
|
||||
return this.push(null)
|
||||
|
||||
size = Math.min(size, this.length)
|
||||
this.push(this.slice(0, size))
|
||||
this.consume(size)
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype.end = function end (chunk) {
|
||||
DuplexStream.prototype.end.call(this, chunk)
|
||||
|
||||
if (this._callback) {
|
||||
this._callback(null, this.slice())
|
||||
this._callback = null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype.get = function get (index) {
|
||||
return this.slice(index, index + 1)[0]
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype.slice = function slice (start, end) {
|
||||
if (typeof start == 'number' && start < 0)
|
||||
start += this.length
|
||||
if (typeof end == 'number' && end < 0)
|
||||
end += this.length
|
||||
return this.copy(null, 0, start, end)
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) {
|
||||
if (typeof srcStart != 'number' || srcStart < 0)
|
||||
srcStart = 0
|
||||
if (typeof srcEnd != 'number' || srcEnd > this.length)
|
||||
srcEnd = this.length
|
||||
if (srcStart >= this.length)
|
||||
return dst || Buffer.alloc(0)
|
||||
if (srcEnd <= 0)
|
||||
return dst || Buffer.alloc(0)
|
||||
|
||||
var copy = !!dst
|
||||
, off = this._offset(srcStart)
|
||||
, len = srcEnd - srcStart
|
||||
, bytes = len
|
||||
, bufoff = (copy && dstStart) || 0
|
||||
, start = off[1]
|
||||
, l
|
||||
, i
|
||||
|
||||
// copy/slice everything
|
||||
if (srcStart === 0 && srcEnd == this.length) {
|
||||
if (!copy) { // slice, but full concat if multiple buffers
|
||||
return this._bufs.length === 1
|
||||
? this._bufs[0]
|
||||
: Buffer.concat(this._bufs, this.length)
|
||||
}
|
||||
|
||||
// copy, need to copy individual buffers
|
||||
for (i = 0; i < this._bufs.length; i++) {
|
||||
this._bufs[i].copy(dst, bufoff)
|
||||
bufoff += this._bufs[i].length
|
||||
}
|
||||
|
||||
return dst
|
||||
}
|
||||
|
||||
// easy, cheap case where it's a subset of one of the buffers
|
||||
if (bytes <= this._bufs[off[0]].length - start) {
|
||||
return copy
|
||||
? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes)
|
||||
: this._bufs[off[0]].slice(start, start + bytes)
|
||||
}
|
||||
|
||||
if (!copy) // a slice, we need something to copy in to
|
||||
dst = Buffer.allocUnsafe(len)
|
||||
|
||||
for (i = off[0]; i < this._bufs.length; i++) {
|
||||
l = this._bufs[i].length - start
|
||||
|
||||
if (bytes > l) {
|
||||
this._bufs[i].copy(dst, bufoff, start)
|
||||
} else {
|
||||
this._bufs[i].copy(dst, bufoff, start, start + bytes)
|
||||
break
|
||||
}
|
||||
|
||||
bufoff += l
|
||||
bytes -= l
|
||||
|
||||
if (start)
|
||||
start = 0
|
||||
}
|
||||
|
||||
return dst
|
||||
}
|
||||
|
||||
BufferList.prototype.shallowSlice = function shallowSlice (start, end) {
|
||||
start = start || 0
|
||||
end = end || this.length
|
||||
|
||||
if (start < 0)
|
||||
start += this.length
|
||||
if (end < 0)
|
||||
end += this.length
|
||||
|
||||
var startOffset = this._offset(start)
|
||||
, endOffset = this._offset(end)
|
||||
, buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1)
|
||||
|
||||
if (endOffset[1] == 0)
|
||||
buffers.pop()
|
||||
else
|
||||
buffers[buffers.length-1] = buffers[buffers.length-1].slice(0, endOffset[1])
|
||||
|
||||
if (startOffset[1] != 0)
|
||||
buffers[0] = buffers[0].slice(startOffset[1])
|
||||
|
||||
return new BufferList(buffers)
|
||||
}
|
||||
|
||||
BufferList.prototype.toString = function toString (encoding, start, end) {
|
||||
return this.slice(start, end).toString(encoding)
|
||||
}
|
||||
|
||||
BufferList.prototype.consume = function consume (bytes) {
|
||||
while (this._bufs.length) {
|
||||
if (bytes >= this._bufs[0].length) {
|
||||
bytes -= this._bufs[0].length
|
||||
this.length -= this._bufs[0].length
|
||||
this._bufs.shift()
|
||||
} else {
|
||||
this._bufs[0] = this._bufs[0].slice(bytes)
|
||||
this.length -= bytes
|
||||
break
|
||||
}
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype.duplicate = function duplicate () {
|
||||
var i = 0
|
||||
, copy = new BufferList()
|
||||
|
||||
for (; i < this._bufs.length; i++)
|
||||
copy.append(this._bufs[i])
|
||||
|
||||
return copy
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype.destroy = function destroy () {
|
||||
this._bufs.length = 0
|
||||
this.length = 0
|
||||
this.push(null)
|
||||
}
|
||||
|
||||
|
||||
;(function () {
|
||||
var methods = {
|
||||
'readDoubleBE' : 8
|
||||
, 'readDoubleLE' : 8
|
||||
, 'readFloatBE' : 4
|
||||
, 'readFloatLE' : 4
|
||||
, 'readInt32BE' : 4
|
||||
, 'readInt32LE' : 4
|
||||
, 'readUInt32BE' : 4
|
||||
, 'readUInt32LE' : 4
|
||||
, 'readInt16BE' : 2
|
||||
, 'readInt16LE' : 2
|
||||
, 'readUInt16BE' : 2
|
||||
, 'readUInt16LE' : 2
|
||||
, 'readInt8' : 1
|
||||
, 'readUInt8' : 1
|
||||
}
|
||||
|
||||
for (var m in methods) {
|
||||
(function (m) {
|
||||
BufferList.prototype[m] = function (offset) {
|
||||
return this.slice(offset, offset + methods[m])[m](0)
|
||||
}
|
||||
}(m))
|
||||
}
|
||||
}())
|
||||
|
||||
|
||||
module.exports = BufferList
|
||||
35
node_modules/bl/package.json
generated
vendored
35
node_modules/bl/package.json
generated
vendored
@@ -1,35 +0,0 @@
|
||||
{
|
||||
"name": "bl",
|
||||
"version": "1.2.2",
|
||||
"description": "Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!",
|
||||
"main": "bl.js",
|
||||
"scripts": {
|
||||
"test": "node test/test.js | faucet"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/rvagg/bl.git"
|
||||
},
|
||||
"homepage": "https://github.com/rvagg/bl",
|
||||
"authors": [
|
||||
"Rod Vagg <rod@vagg.org> (https://github.com/rvagg)",
|
||||
"Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)",
|
||||
"Jarett Cruger <jcrugzz@gmail.com> (https://github.com/jcrugzz)"
|
||||
],
|
||||
"keywords": [
|
||||
"buffer",
|
||||
"buffers",
|
||||
"stream",
|
||||
"awesomesauce"
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"readable-stream": "^2.3.5",
|
||||
"safe-buffer": "^5.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"faucet": "0.0.1",
|
||||
"hash_file": "~0.1.1",
|
||||
"tape": "~4.9.0"
|
||||
}
|
||||
}
|
||||
702
node_modules/bl/test/test.js
generated
vendored
702
node_modules/bl/test/test.js
generated
vendored
@@ -1,702 +0,0 @@
|
||||
var tape = require('tape')
|
||||
, crypto = require('crypto')
|
||||
, fs = require('fs')
|
||||
, hash = require('hash_file')
|
||||
, BufferList = require('../')
|
||||
, Buffer = require('safe-buffer').Buffer
|
||||
|
||||
, encodings =
|
||||
('hex utf8 utf-8 ascii binary base64'
|
||||
+ (process.browser ? '' : ' ucs2 ucs-2 utf16le utf-16le')).split(' ')
|
||||
|
||||
tape('single bytes from single buffer', function (t) {
|
||||
var bl = new BufferList()
|
||||
bl.append(Buffer.from('abcd'))
|
||||
|
||||
t.equal(bl.length, 4)
|
||||
|
||||
t.equal(bl.get(0), 97)
|
||||
t.equal(bl.get(1), 98)
|
||||
t.equal(bl.get(2), 99)
|
||||
t.equal(bl.get(3), 100)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('single bytes from multiple buffers', function (t) {
|
||||
var bl = new BufferList()
|
||||
bl.append(Buffer.from('abcd'))
|
||||
bl.append(Buffer.from('efg'))
|
||||
bl.append(Buffer.from('hi'))
|
||||
bl.append(Buffer.from('j'))
|
||||
|
||||
t.equal(bl.length, 10)
|
||||
|
||||
t.equal(bl.get(0), 97)
|
||||
t.equal(bl.get(1), 98)
|
||||
t.equal(bl.get(2), 99)
|
||||
t.equal(bl.get(3), 100)
|
||||
t.equal(bl.get(4), 101)
|
||||
t.equal(bl.get(5), 102)
|
||||
t.equal(bl.get(6), 103)
|
||||
t.equal(bl.get(7), 104)
|
||||
t.equal(bl.get(8), 105)
|
||||
t.equal(bl.get(9), 106)
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('multi bytes from single buffer', function (t) {
|
||||
var bl = new BufferList()
|
||||
bl.append(Buffer.from('abcd'))
|
||||
|
||||
t.equal(bl.length, 4)
|
||||
|
||||
t.equal(bl.slice(0, 4).toString('ascii'), 'abcd')
|
||||
t.equal(bl.slice(0, 3).toString('ascii'), 'abc')
|
||||
t.equal(bl.slice(1, 4).toString('ascii'), 'bcd')
|
||||
t.equal(bl.slice(-4, -1).toString('ascii'), 'abc')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('multi bytes from single buffer (negative indexes)', function (t) {
|
||||
var bl = new BufferList()
|
||||
bl.append(Buffer.from('buffer'))
|
||||
|
||||
t.equal(bl.length, 6)
|
||||
|
||||
t.equal(bl.slice(-6, -1).toString('ascii'), 'buffe')
|
||||
t.equal(bl.slice(-6, -2).toString('ascii'), 'buff')
|
||||
t.equal(bl.slice(-5, -2).toString('ascii'), 'uff')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('multiple bytes from multiple buffers', function (t) {
|
||||
var bl = new BufferList()
|
||||
|
||||
bl.append(Buffer.from('abcd'))
|
||||
bl.append(Buffer.from('efg'))
|
||||
bl.append(Buffer.from('hi'))
|
||||
bl.append(Buffer.from('j'))
|
||||
|
||||
t.equal(bl.length, 10)
|
||||
|
||||
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||
t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
|
||||
t.equal(bl.slice(3, 6).toString('ascii'), 'def')
|
||||
t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
|
||||
t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
|
||||
t.equal(bl.slice(-7, -4).toString('ascii'), 'def')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('multiple bytes from multiple buffer lists', function (t) {
|
||||
var bl = new BufferList()
|
||||
|
||||
bl.append(new BufferList([ Buffer.from('abcd'), Buffer.from('efg') ]))
|
||||
bl.append(new BufferList([ Buffer.from('hi'), Buffer.from('j') ]))
|
||||
|
||||
t.equal(bl.length, 10)
|
||||
|
||||
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||
|
||||
t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
|
||||
t.equal(bl.slice(3, 6).toString('ascii'), 'def')
|
||||
t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
|
||||
t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
// same data as previous test, just using nested constructors
|
||||
tape('multiple bytes from crazy nested buffer lists', function (t) {
|
||||
var bl = new BufferList()
|
||||
|
||||
bl.append(new BufferList([
|
||||
new BufferList([
|
||||
new BufferList(Buffer.from('abc'))
|
||||
, Buffer.from('d')
|
||||
, new BufferList(Buffer.from('efg'))
|
||||
])
|
||||
, new BufferList([ Buffer.from('hi') ])
|
||||
, new BufferList(Buffer.from('j'))
|
||||
]))
|
||||
|
||||
t.equal(bl.length, 10)
|
||||
|
||||
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||
|
||||
t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
|
||||
t.equal(bl.slice(3, 6).toString('ascii'), 'def')
|
||||
t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
|
||||
t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('append accepts arrays of Buffers', function (t) {
|
||||
var bl = new BufferList()
|
||||
bl.append(Buffer.from('abc'))
|
||||
bl.append([ Buffer.from('def') ])
|
||||
bl.append([ Buffer.from('ghi'), Buffer.from('jkl') ])
|
||||
bl.append([ Buffer.from('mnop'), Buffer.from('qrstu'), Buffer.from('vwxyz') ])
|
||||
t.equal(bl.length, 26)
|
||||
t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('append accepts arrays of BufferLists', function (t) {
|
||||
var bl = new BufferList()
|
||||
bl.append(Buffer.from('abc'))
|
||||
bl.append([ new BufferList('def') ])
|
||||
bl.append(new BufferList([ Buffer.from('ghi'), new BufferList('jkl') ]))
|
||||
bl.append([ Buffer.from('mnop'), new BufferList([ Buffer.from('qrstu'), Buffer.from('vwxyz') ]) ])
|
||||
t.equal(bl.length, 26)
|
||||
t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('append chainable', function (t) {
|
||||
var bl = new BufferList()
|
||||
t.ok(bl.append(Buffer.from('abcd')) === bl)
|
||||
t.ok(bl.append([ Buffer.from('abcd') ]) === bl)
|
||||
t.ok(bl.append(new BufferList(Buffer.from('abcd'))) === bl)
|
||||
t.ok(bl.append([ new BufferList(Buffer.from('abcd')) ]) === bl)
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('append chainable (test results)', function (t) {
|
||||
var bl = new BufferList('abc')
|
||||
.append([ new BufferList('def') ])
|
||||
.append(new BufferList([ Buffer.from('ghi'), new BufferList('jkl') ]))
|
||||
.append([ Buffer.from('mnop'), new BufferList([ Buffer.from('qrstu'), Buffer.from('vwxyz') ]) ])
|
||||
|
||||
t.equal(bl.length, 26)
|
||||
t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('consuming from multiple buffers', function (t) {
|
||||
var bl = new BufferList()
|
||||
|
||||
bl.append(Buffer.from('abcd'))
|
||||
bl.append(Buffer.from('efg'))
|
||||
bl.append(Buffer.from('hi'))
|
||||
bl.append(Buffer.from('j'))
|
||||
|
||||
t.equal(bl.length, 10)
|
||||
|
||||
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||
|
||||
bl.consume(3)
|
||||
t.equal(bl.length, 7)
|
||||
t.equal(bl.slice(0, 7).toString('ascii'), 'defghij')
|
||||
|
||||
bl.consume(2)
|
||||
t.equal(bl.length, 5)
|
||||
t.equal(bl.slice(0, 5).toString('ascii'), 'fghij')
|
||||
|
||||
bl.consume(1)
|
||||
t.equal(bl.length, 4)
|
||||
t.equal(bl.slice(0, 4).toString('ascii'), 'ghij')
|
||||
|
||||
bl.consume(1)
|
||||
t.equal(bl.length, 3)
|
||||
t.equal(bl.slice(0, 3).toString('ascii'), 'hij')
|
||||
|
||||
bl.consume(2)
|
||||
t.equal(bl.length, 1)
|
||||
t.equal(bl.slice(0, 1).toString('ascii'), 'j')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('complete consumption', function (t) {
|
||||
var bl = new BufferList()
|
||||
|
||||
bl.append(Buffer.from('a'))
|
||||
bl.append(Buffer.from('b'))
|
||||
|
||||
bl.consume(2)
|
||||
|
||||
t.equal(bl.length, 0)
|
||||
t.equal(bl._bufs.length, 0)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test readUInt8 / readInt8', function (t) {
|
||||
var buf1 = Buffer.alloc(1)
|
||||
, buf2 = Buffer.alloc(3)
|
||||
, buf3 = Buffer.alloc(3)
|
||||
, bl = new BufferList()
|
||||
|
||||
buf2[1] = 0x3
|
||||
buf2[2] = 0x4
|
||||
buf3[0] = 0x23
|
||||
buf3[1] = 0x42
|
||||
|
||||
bl.append(buf1)
|
||||
bl.append(buf2)
|
||||
bl.append(buf3)
|
||||
|
||||
t.equal(bl.readUInt8(2), 0x3)
|
||||
t.equal(bl.readInt8(2), 0x3)
|
||||
t.equal(bl.readUInt8(3), 0x4)
|
||||
t.equal(bl.readInt8(3), 0x4)
|
||||
t.equal(bl.readUInt8(4), 0x23)
|
||||
t.equal(bl.readInt8(4), 0x23)
|
||||
t.equal(bl.readUInt8(5), 0x42)
|
||||
t.equal(bl.readInt8(5), 0x42)
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test readUInt16LE / readUInt16BE / readInt16LE / readInt16BE', function (t) {
|
||||
var buf1 = Buffer.alloc(1)
|
||||
, buf2 = Buffer.alloc(3)
|
||||
, buf3 = Buffer.alloc(3)
|
||||
, bl = new BufferList()
|
||||
|
||||
buf2[1] = 0x3
|
||||
buf2[2] = 0x4
|
||||
buf3[0] = 0x23
|
||||
buf3[1] = 0x42
|
||||
|
||||
bl.append(buf1)
|
||||
bl.append(buf2)
|
||||
bl.append(buf3)
|
||||
|
||||
t.equal(bl.readUInt16BE(2), 0x0304)
|
||||
t.equal(bl.readUInt16LE(2), 0x0403)
|
||||
t.equal(bl.readInt16BE(2), 0x0304)
|
||||
t.equal(bl.readInt16LE(2), 0x0403)
|
||||
t.equal(bl.readUInt16BE(3), 0x0423)
|
||||
t.equal(bl.readUInt16LE(3), 0x2304)
|
||||
t.equal(bl.readInt16BE(3), 0x0423)
|
||||
t.equal(bl.readInt16LE(3), 0x2304)
|
||||
t.equal(bl.readUInt16BE(4), 0x2342)
|
||||
t.equal(bl.readUInt16LE(4), 0x4223)
|
||||
t.equal(bl.readInt16BE(4), 0x2342)
|
||||
t.equal(bl.readInt16LE(4), 0x4223)
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test readUInt32LE / readUInt32BE / readInt32LE / readInt32BE', function (t) {
|
||||
var buf1 = Buffer.alloc(1)
|
||||
, buf2 = Buffer.alloc(3)
|
||||
, buf3 = Buffer.alloc(3)
|
||||
, bl = new BufferList()
|
||||
|
||||
buf2[1] = 0x3
|
||||
buf2[2] = 0x4
|
||||
buf3[0] = 0x23
|
||||
buf3[1] = 0x42
|
||||
|
||||
bl.append(buf1)
|
||||
bl.append(buf2)
|
||||
bl.append(buf3)
|
||||
|
||||
t.equal(bl.readUInt32BE(2), 0x03042342)
|
||||
t.equal(bl.readUInt32LE(2), 0x42230403)
|
||||
t.equal(bl.readInt32BE(2), 0x03042342)
|
||||
t.equal(bl.readInt32LE(2), 0x42230403)
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test readFloatLE / readFloatBE', function (t) {
|
||||
var buf1 = Buffer.alloc(1)
|
||||
, buf2 = Buffer.alloc(3)
|
||||
, buf3 = Buffer.alloc(3)
|
||||
, bl = new BufferList()
|
||||
|
||||
buf2[1] = 0x00
|
||||
buf2[2] = 0x00
|
||||
buf3[0] = 0x80
|
||||
buf3[1] = 0x3f
|
||||
|
||||
bl.append(buf1)
|
||||
bl.append(buf2)
|
||||
bl.append(buf3)
|
||||
|
||||
t.equal(bl.readFloatLE(2), 0x01)
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test readDoubleLE / readDoubleBE', function (t) {
|
||||
var buf1 = Buffer.alloc(1)
|
||||
, buf2 = Buffer.alloc(3)
|
||||
, buf3 = Buffer.alloc(10)
|
||||
, bl = new BufferList()
|
||||
|
||||
buf2[1] = 0x55
|
||||
buf2[2] = 0x55
|
||||
buf3[0] = 0x55
|
||||
buf3[1] = 0x55
|
||||
buf3[2] = 0x55
|
||||
buf3[3] = 0x55
|
||||
buf3[4] = 0xd5
|
||||
buf3[5] = 0x3f
|
||||
|
||||
bl.append(buf1)
|
||||
bl.append(buf2)
|
||||
bl.append(buf3)
|
||||
|
||||
t.equal(bl.readDoubleLE(2), 0.3333333333333333)
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test toString', function (t) {
|
||||
var bl = new BufferList()
|
||||
|
||||
bl.append(Buffer.from('abcd'))
|
||||
bl.append(Buffer.from('efg'))
|
||||
bl.append(Buffer.from('hi'))
|
||||
bl.append(Buffer.from('j'))
|
||||
|
||||
t.equal(bl.toString('ascii', 0, 10), 'abcdefghij')
|
||||
t.equal(bl.toString('ascii', 3, 10), 'defghij')
|
||||
t.equal(bl.toString('ascii', 3, 6), 'def')
|
||||
t.equal(bl.toString('ascii', 3, 8), 'defgh')
|
||||
t.equal(bl.toString('ascii', 5, 10), 'fghij')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test toString encoding', function (t) {
|
||||
var bl = new BufferList()
|
||||
, b = Buffer.from('abcdefghij\xff\x00')
|
||||
|
||||
bl.append(Buffer.from('abcd'))
|
||||
bl.append(Buffer.from('efg'))
|
||||
bl.append(Buffer.from('hi'))
|
||||
bl.append(Buffer.from('j'))
|
||||
bl.append(Buffer.from('\xff\x00'))
|
||||
|
||||
encodings.forEach(function (enc) {
|
||||
t.equal(bl.toString(enc), b.toString(enc), enc)
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
!process.browser && tape('test stream', function (t) {
|
||||
var random = crypto.randomBytes(65534)
|
||||
, rndhash = hash(random, 'md5')
|
||||
, md5sum = crypto.createHash('md5')
|
||||
, bl = new BufferList(function (err, buf) {
|
||||
t.ok(Buffer.isBuffer(buf))
|
||||
t.ok(err === null)
|
||||
t.equal(rndhash, hash(bl.slice(), 'md5'))
|
||||
t.equal(rndhash, hash(buf, 'md5'))
|
||||
|
||||
bl.pipe(fs.createWriteStream('/tmp/bl_test_rnd_out.dat'))
|
||||
.on('close', function () {
|
||||
var s = fs.createReadStream('/tmp/bl_test_rnd_out.dat')
|
||||
s.on('data', md5sum.update.bind(md5sum))
|
||||
s.on('end', function() {
|
||||
t.equal(rndhash, md5sum.digest('hex'), 'woohoo! correct hash!')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
fs.writeFileSync('/tmp/bl_test_rnd.dat', random)
|
||||
fs.createReadStream('/tmp/bl_test_rnd.dat').pipe(bl)
|
||||
})
|
||||
|
||||
tape('instantiation with Buffer', function (t) {
|
||||
var buf = crypto.randomBytes(1024)
|
||||
, buf2 = crypto.randomBytes(1024)
|
||||
, b = BufferList(buf)
|
||||
|
||||
t.equal(buf.toString('hex'), b.slice().toString('hex'), 'same buffer')
|
||||
b = BufferList([ buf, buf2 ])
|
||||
t.equal(b.slice().toString('hex'), Buffer.concat([ buf, buf2 ]).toString('hex'), 'same buffer')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test String appendage', function (t) {
|
||||
var bl = new BufferList()
|
||||
, b = Buffer.from('abcdefghij\xff\x00')
|
||||
|
||||
bl.append('abcd')
|
||||
bl.append('efg')
|
||||
bl.append('hi')
|
||||
bl.append('j')
|
||||
bl.append('\xff\x00')
|
||||
|
||||
encodings.forEach(function (enc) {
|
||||
t.equal(bl.toString(enc), b.toString(enc))
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test Number appendage', function (t) {
|
||||
var bl = new BufferList()
|
||||
, b = Buffer.from('1234567890')
|
||||
|
||||
bl.append(1234)
|
||||
bl.append(567)
|
||||
bl.append(89)
|
||||
bl.append(0)
|
||||
|
||||
encodings.forEach(function (enc) {
|
||||
t.equal(bl.toString(enc), b.toString(enc))
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('write nothing, should get empty buffer', function (t) {
|
||||
t.plan(3)
|
||||
BufferList(function (err, data) {
|
||||
t.notOk(err, 'no error')
|
||||
t.ok(Buffer.isBuffer(data), 'got a buffer')
|
||||
t.equal(0, data.length, 'got a zero-length buffer')
|
||||
t.end()
|
||||
}).end()
|
||||
})
|
||||
|
||||
tape('unicode string', function (t) {
|
||||
t.plan(2)
|
||||
var inp1 = '\u2600'
|
||||
, inp2 = '\u2603'
|
||||
, exp = inp1 + ' and ' + inp2
|
||||
, bl = BufferList()
|
||||
bl.write(inp1)
|
||||
bl.write(' and ')
|
||||
bl.write(inp2)
|
||||
t.equal(exp, bl.toString())
|
||||
t.equal(Buffer.from(exp).toString('hex'), bl.toString('hex'))
|
||||
})
|
||||
|
||||
tape('should emit finish', function (t) {
|
||||
var source = BufferList()
|
||||
, dest = BufferList()
|
||||
|
||||
source.write('hello')
|
||||
source.pipe(dest)
|
||||
|
||||
dest.on('finish', function () {
|
||||
t.equal(dest.toString('utf8'), 'hello')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
tape('basic copy', function (t) {
|
||||
var buf = crypto.randomBytes(1024)
|
||||
, buf2 = Buffer.alloc(1024)
|
||||
, b = BufferList(buf)
|
||||
|
||||
b.copy(buf2)
|
||||
t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('copy after many appends', function (t) {
|
||||
var buf = crypto.randomBytes(512)
|
||||
, buf2 = Buffer.alloc(1024)
|
||||
, b = BufferList(buf)
|
||||
|
||||
b.append(buf)
|
||||
b.copy(buf2)
|
||||
t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('copy at a precise position', function (t) {
|
||||
var buf = crypto.randomBytes(1004)
|
||||
, buf2 = Buffer.alloc(1024)
|
||||
, b = BufferList(buf)
|
||||
|
||||
b.copy(buf2, 20)
|
||||
t.equal(b.slice().toString('hex'), buf2.slice(20).toString('hex'), 'same buffer')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('copy starting from a precise location', function (t) {
|
||||
var buf = crypto.randomBytes(10)
|
||||
, buf2 = Buffer.alloc(5)
|
||||
, b = BufferList(buf)
|
||||
|
||||
b.copy(buf2, 0, 5)
|
||||
t.equal(b.slice(5).toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('copy in an interval', function (t) {
|
||||
var rnd = crypto.randomBytes(10)
|
||||
, b = BufferList(rnd) // put the random bytes there
|
||||
, actual = Buffer.alloc(3)
|
||||
, expected = Buffer.alloc(3)
|
||||
|
||||
rnd.copy(expected, 0, 5, 8)
|
||||
b.copy(actual, 0, 5, 8)
|
||||
|
||||
t.equal(actual.toString('hex'), expected.toString('hex'), 'same buffer')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('copy an interval between two buffers', function (t) {
|
||||
var buf = crypto.randomBytes(10)
|
||||
, buf2 = Buffer.alloc(10)
|
||||
, b = BufferList(buf)
|
||||
|
||||
b.append(buf)
|
||||
b.copy(buf2, 0, 5, 15)
|
||||
|
||||
t.equal(b.slice(5, 15).toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('shallow slice across buffer boundaries', function (t) {
|
||||
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||
|
||||
t.equal(bl.shallowSlice(3, 13).toString(), 'stSecondTh')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('shallow slice within single buffer', function (t) {
|
||||
t.plan(2)
|
||||
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||
|
||||
t.equal(bl.shallowSlice(5, 10).toString(), 'Secon')
|
||||
t.equal(bl.shallowSlice(7, 10).toString(), 'con')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('shallow slice single buffer', function (t) {
|
||||
t.plan(3)
|
||||
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||
|
||||
t.equal(bl.shallowSlice(0, 5).toString(), 'First')
|
||||
t.equal(bl.shallowSlice(5, 11).toString(), 'Second')
|
||||
t.equal(bl.shallowSlice(11, 16).toString(), 'Third')
|
||||
})
|
||||
|
||||
tape('shallow slice with negative or omitted indices', function (t) {
|
||||
t.plan(4)
|
||||
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||
|
||||
t.equal(bl.shallowSlice().toString(), 'FirstSecondThird')
|
||||
t.equal(bl.shallowSlice(5).toString(), 'SecondThird')
|
||||
t.equal(bl.shallowSlice(5, -3).toString(), 'SecondTh')
|
||||
t.equal(bl.shallowSlice(-8).toString(), 'ondThird')
|
||||
})
|
||||
|
||||
tape('shallow slice does not make a copy', function (t) {
|
||||
t.plan(1)
|
||||
var buffers = [Buffer.from('First'), Buffer.from('Second'), Buffer.from('Third')]
|
||||
var bl = (new BufferList(buffers)).shallowSlice(5, -3)
|
||||
|
||||
buffers[1].fill('h')
|
||||
buffers[2].fill('h')
|
||||
|
||||
t.equal(bl.toString(), 'hhhhhhhh')
|
||||
})
|
||||
|
||||
tape('duplicate', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
var bl = new BufferList('abcdefghij\xff\x00')
|
||||
, dup = bl.duplicate()
|
||||
|
||||
t.equal(bl.prototype, dup.prototype)
|
||||
t.equal(bl.toString('hex'), dup.toString('hex'))
|
||||
})
|
||||
|
||||
tape('destroy no pipe', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
var bl = new BufferList('alsdkfja;lsdkfja;lsdk')
|
||||
bl.destroy()
|
||||
|
||||
t.equal(bl._bufs.length, 0)
|
||||
t.equal(bl.length, 0)
|
||||
})
|
||||
|
||||
!process.browser && tape('destroy with pipe before read end', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
var bl = new BufferList()
|
||||
fs.createReadStream(__dirname + '/test.js')
|
||||
.pipe(bl)
|
||||
|
||||
bl.destroy()
|
||||
|
||||
t.equal(bl._bufs.length, 0)
|
||||
t.equal(bl.length, 0)
|
||||
|
||||
})
|
||||
|
||||
!process.browser && tape('destroy with pipe before read end with race', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
var bl = new BufferList()
|
||||
fs.createReadStream(__dirname + '/test.js')
|
||||
.pipe(bl)
|
||||
|
||||
setTimeout(function () {
|
||||
bl.destroy()
|
||||
setTimeout(function () {
|
||||
t.equal(bl._bufs.length, 0)
|
||||
t.equal(bl.length, 0)
|
||||
}, 500)
|
||||
}, 500)
|
||||
})
|
||||
|
||||
!process.browser && tape('destroy with pipe after read end', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
var bl = new BufferList()
|
||||
fs.createReadStream(__dirname + '/test.js')
|
||||
.on('end', onEnd)
|
||||
.pipe(bl)
|
||||
|
||||
function onEnd () {
|
||||
bl.destroy()
|
||||
|
||||
t.equal(bl._bufs.length, 0)
|
||||
t.equal(bl.length, 0)
|
||||
}
|
||||
})
|
||||
|
||||
!process.browser && tape('destroy with pipe while writing to a destination', function (t) {
|
||||
t.plan(4)
|
||||
|
||||
var bl = new BufferList()
|
||||
, ds = new BufferList()
|
||||
|
||||
fs.createReadStream(__dirname + '/test.js')
|
||||
.on('end', onEnd)
|
||||
.pipe(bl)
|
||||
|
||||
function onEnd () {
|
||||
bl.pipe(ds)
|
||||
|
||||
setTimeout(function () {
|
||||
bl.destroy()
|
||||
|
||||
t.equals(bl._bufs.length, 0)
|
||||
t.equals(bl.length, 0)
|
||||
|
||||
ds.destroy()
|
||||
|
||||
t.equals(bl._bufs.length, 0)
|
||||
t.equals(bl.length, 0)
|
||||
|
||||
}, 100)
|
||||
}
|
||||
})
|
||||
|
||||
!process.browser && tape('handle error', function (t) {
|
||||
t.plan(2)
|
||||
fs.createReadStream('/does/not/exist').pipe(BufferList(function (err, data) {
|
||||
t.ok(err instanceof Error, 'has error')
|
||||
t.notOk(data, 'no data')
|
||||
}))
|
||||
})
|
||||
21
node_modules/brace-expansion/LICENSE
generated
vendored
21
node_modules/brace-expansion/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
129
node_modules/brace-expansion/README.md
generated
vendored
129
node_modules/brace-expansion/README.md
generated
vendored
@@ -1,129 +0,0 @@
|
||||
# brace-expansion
|
||||
|
||||
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
|
||||
as known from sh/bash, in JavaScript.
|
||||
|
||||
[](http://travis-ci.org/juliangruber/brace-expansion)
|
||||
[](https://www.npmjs.org/package/brace-expansion)
|
||||
[](https://greenkeeper.io/)
|
||||
|
||||
[](https://ci.testling.com/juliangruber/brace-expansion)
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
|
||||
expand('file-{a,b,c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('-v{,,}')
|
||||
// => ['-v', '-v', '-v']
|
||||
|
||||
expand('file{0..2}.jpg')
|
||||
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
|
||||
|
||||
expand('file-{a..c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('file{2..0}.jpg')
|
||||
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
|
||||
|
||||
expand('file{0..4..2}.jpg')
|
||||
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
|
||||
|
||||
expand('file-{a..e..2}.jpg')
|
||||
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
|
||||
|
||||
expand('file{00..10..5}.jpg')
|
||||
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
|
||||
|
||||
expand('{{A..C},{a..c}}')
|
||||
// => ['A', 'B', 'C', 'a', 'b', 'c']
|
||||
|
||||
expand('ppp{,config,oe{,conf}}')
|
||||
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
```
|
||||
|
||||
### var expanded = expand(str)
|
||||
|
||||
Return an array of all possible and valid expansions of `str`. If none are
|
||||
found, `[str]` is returned.
|
||||
|
||||
Valid expansions are:
|
||||
|
||||
```js
|
||||
/^(.*,)+(.+)?$/
|
||||
// {a,b,...}
|
||||
```
|
||||
|
||||
A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
A numeric sequence from `x` to `y` inclusive, with optional increment.
|
||||
If `x` or `y` start with a leading `0`, all the numbers will be padded
|
||||
to have equal length. Negative numbers and backwards iteration work too.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
An alphabetic sequence from `x` to `y` inclusive, with optional increment.
|
||||
`x` and `y` must be exactly one character, and if given, `incr` must be a
|
||||
number.
|
||||
|
||||
For compatibility reasons, the string `${` is not eligible for brace expansion.
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```bash
|
||||
npm install brace-expansion
|
||||
```
|
||||
|
||||
## Contributors
|
||||
|
||||
- [Julian Gruber](https://github.com/juliangruber)
|
||||
- [Isaac Z. Schlueter](https://github.com/isaacs)
|
||||
|
||||
## Sponsors
|
||||
|
||||
This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
|
||||
|
||||
Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
201
node_modules/brace-expansion/index.js
generated
vendored
201
node_modules/brace-expansion/index.js
generated
vendored
@@ -1,201 +0,0 @@
|
||||
var concatMap = require('concat-map');
|
||||
var balanced = require('balanced-match');
|
||||
|
||||
module.exports = expandTop;
|
||||
|
||||
var escSlash = '\0SLASH'+Math.random()+'\0';
|
||||
var escOpen = '\0OPEN'+Math.random()+'\0';
|
||||
var escClose = '\0CLOSE'+Math.random()+'\0';
|
||||
var escComma = '\0COMMA'+Math.random()+'\0';
|
||||
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
||||
|
||||
function numeric(str) {
|
||||
return parseInt(str, 10) == str
|
||||
? parseInt(str, 10)
|
||||
: str.charCodeAt(0);
|
||||
}
|
||||
|
||||
function escapeBraces(str) {
|
||||
return str.split('\\\\').join(escSlash)
|
||||
.split('\\{').join(escOpen)
|
||||
.split('\\}').join(escClose)
|
||||
.split('\\,').join(escComma)
|
||||
.split('\\.').join(escPeriod);
|
||||
}
|
||||
|
||||
function unescapeBraces(str) {
|
||||
return str.split(escSlash).join('\\')
|
||||
.split(escOpen).join('{')
|
||||
.split(escClose).join('}')
|
||||
.split(escComma).join(',')
|
||||
.split(escPeriod).join('.');
|
||||
}
|
||||
|
||||
|
||||
// Basically just str.split(","), but handling cases
|
||||
// where we have nested braced sections, which should be
|
||||
// treated as individual members, like {a,{b,c},d}
|
||||
function parseCommaParts(str) {
|
||||
if (!str)
|
||||
return [''];
|
||||
|
||||
var parts = [];
|
||||
var m = balanced('{', '}', str);
|
||||
|
||||
if (!m)
|
||||
return str.split(',');
|
||||
|
||||
var pre = m.pre;
|
||||
var body = m.body;
|
||||
var post = m.post;
|
||||
var p = pre.split(',');
|
||||
|
||||
p[p.length-1] += '{' + body + '}';
|
||||
var postParts = parseCommaParts(post);
|
||||
if (post.length) {
|
||||
p[p.length-1] += postParts.shift();
|
||||
p.push.apply(p, postParts);
|
||||
}
|
||||
|
||||
parts.push.apply(parts, p);
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
function expandTop(str) {
|
||||
if (!str)
|
||||
return [];
|
||||
|
||||
// I don't know why Bash 4.3 does this, but it does.
|
||||
// Anything starting with {} will have the first two bytes preserved
|
||||
// but *only* at the top level, so {},a}b will not expand to anything,
|
||||
// but a{},b}c will be expanded to [a}c,abc].
|
||||
// One could argue that this is a bug in Bash, but since the goal of
|
||||
// this module is to match Bash's rules, we escape a leading {}
|
||||
if (str.substr(0, 2) === '{}') {
|
||||
str = '\\{\\}' + str.substr(2);
|
||||
}
|
||||
|
||||
return expand(escapeBraces(str), true).map(unescapeBraces);
|
||||
}
|
||||
|
||||
function identity(e) {
|
||||
return e;
|
||||
}
|
||||
|
||||
function embrace(str) {
|
||||
return '{' + str + '}';
|
||||
}
|
||||
function isPadded(el) {
|
||||
return /^-?0\d/.test(el);
|
||||
}
|
||||
|
||||
function lte(i, y) {
|
||||
return i <= y;
|
||||
}
|
||||
function gte(i, y) {
|
||||
return i >= y;
|
||||
}
|
||||
|
||||
function expand(str, isTop) {
|
||||
var expansions = [];
|
||||
|
||||
var m = balanced('{', '}', str);
|
||||
if (!m || /\$$/.test(m.pre)) return [str];
|
||||
|
||||
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isSequence = isNumericSequence || isAlphaSequence;
|
||||
var isOptions = m.body.indexOf(',') >= 0;
|
||||
if (!isSequence && !isOptions) {
|
||||
// {a},b}
|
||||
if (m.post.match(/,.*\}/)) {
|
||||
str = m.pre + '{' + m.body + escClose + m.post;
|
||||
return expand(str);
|
||||
}
|
||||
return [str];
|
||||
}
|
||||
|
||||
var n;
|
||||
if (isSequence) {
|
||||
n = m.body.split(/\.\./);
|
||||
} else {
|
||||
n = parseCommaParts(m.body);
|
||||
if (n.length === 1) {
|
||||
// x{{a,b}}y ==> x{a}y x{b}y
|
||||
n = expand(n[0], false).map(embrace);
|
||||
if (n.length === 1) {
|
||||
var post = m.post.length
|
||||
? expand(m.post, false)
|
||||
: [''];
|
||||
return post.map(function(p) {
|
||||
return m.pre + n[0] + p;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// at this point, n is the parts, and we know it's not a comma set
|
||||
// with a single entry.
|
||||
|
||||
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
||||
var pre = m.pre;
|
||||
var post = m.post.length
|
||||
? expand(m.post, false)
|
||||
: [''];
|
||||
|
||||
var N;
|
||||
|
||||
if (isSequence) {
|
||||
var x = numeric(n[0]);
|
||||
var y = numeric(n[1]);
|
||||
var width = Math.max(n[0].length, n[1].length)
|
||||
var incr = n.length == 3
|
||||
? Math.abs(numeric(n[2]))
|
||||
: 1;
|
||||
var test = lte;
|
||||
var reverse = y < x;
|
||||
if (reverse) {
|
||||
incr *= -1;
|
||||
test = gte;
|
||||
}
|
||||
var pad = n.some(isPadded);
|
||||
|
||||
N = [];
|
||||
|
||||
for (var i = x; test(i, y); i += incr) {
|
||||
var c;
|
||||
if (isAlphaSequence) {
|
||||
c = String.fromCharCode(i);
|
||||
if (c === '\\')
|
||||
c = '';
|
||||
} else {
|
||||
c = String(i);
|
||||
if (pad) {
|
||||
var need = width - c.length;
|
||||
if (need > 0) {
|
||||
var z = new Array(need + 1).join('0');
|
||||
if (i < 0)
|
||||
c = '-' + z + c.slice(1);
|
||||
else
|
||||
c = z + c;
|
||||
}
|
||||
}
|
||||
}
|
||||
N.push(c);
|
||||
}
|
||||
} else {
|
||||
N = concatMap(n, function(el) { return expand(el, false) });
|
||||
}
|
||||
|
||||
for (var j = 0; j < N.length; j++) {
|
||||
for (var k = 0; k < post.length; k++) {
|
||||
var expansion = pre + N[j] + post[k];
|
||||
if (!isTop || isSequence || expansion)
|
||||
expansions.push(expansion);
|
||||
}
|
||||
}
|
||||
|
||||
return expansions;
|
||||
}
|
||||
|
||||
47
node_modules/brace-expansion/package.json
generated
vendored
47
node_modules/brace-expansion/package.json
generated
vendored
@@ -1,47 +0,0 @@
|
||||
{
|
||||
"name": "brace-expansion",
|
||||
"description": "Brace expansion as known from sh/bash",
|
||||
"version": "1.1.11",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/brace-expansion.git"
|
||||
},
|
||||
"homepage": "https://github.com/juliangruber/brace-expansion",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tape test/*.js",
|
||||
"gentest": "bash test/generate.sh",
|
||||
"bench": "matcha test/perf/bench.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"matcha": "^0.7.0",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"firefox/20..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/25..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
}
|
||||
}
|
||||
17
node_modules/buffer-alloc-unsafe/index.js
generated
vendored
17
node_modules/buffer-alloc-unsafe/index.js
generated
vendored
@@ -1,17 +0,0 @@
|
||||
function allocUnsafe (size) {
|
||||
if (typeof size !== 'number') {
|
||||
throw new TypeError('"size" argument must be a number')
|
||||
}
|
||||
|
||||
if (size < 0) {
|
||||
throw new RangeError('"size" argument must not be negative')
|
||||
}
|
||||
|
||||
if (Buffer.allocUnsafe) {
|
||||
return Buffer.allocUnsafe(size)
|
||||
} else {
|
||||
return new Buffer(size)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = allocUnsafe
|
||||
24
node_modules/buffer-alloc-unsafe/package.json
generated
vendored
24
node_modules/buffer-alloc-unsafe/package.json
generated
vendored
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"name": "buffer-alloc-unsafe",
|
||||
"version": "1.1.0",
|
||||
"license": "MIT",
|
||||
"repository": "LinusU/buffer-alloc-unsafe",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "standard && node test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"standard": "^7.1.2"
|
||||
},
|
||||
"keywords": [
|
||||
"allocUnsafe",
|
||||
"allocate",
|
||||
"buffer allocUnsafe",
|
||||
"buffer unsafe allocate",
|
||||
"buffer",
|
||||
"ponyfill",
|
||||
"unsafe allocate"
|
||||
]
|
||||
}
|
||||
46
node_modules/buffer-alloc-unsafe/readme.md
generated
vendored
46
node_modules/buffer-alloc-unsafe/readme.md
generated
vendored
@@ -1,46 +0,0 @@
|
||||
# Buffer Alloc Unsafe
|
||||
|
||||
A [ponyfill](https://ponyfill.com) for `Buffer.allocUnsafe`.
|
||||
|
||||
Works as Node.js: `v7.0.0` <br>
|
||||
Works on Node.js: `v0.10.0`
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save buffer-alloc-unsafe
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const allocUnsafe = require('buffer-alloc-unsafe')
|
||||
|
||||
console.log(allocUnsafe(10))
|
||||
//=> <Buffer 78 0c 80 03 01 00 00 00 05 00>
|
||||
|
||||
console.log(allocUnsafe(10))
|
||||
//=> <Buffer 58 ed bf 5f ff 7f 00 00 01 00>
|
||||
|
||||
console.log(allocUnsafe(10))
|
||||
//=> <Buffer 50 0c 80 03 01 00 00 00 0a 00>
|
||||
|
||||
allocUnsafe(-10)
|
||||
//=> RangeError: "size" argument must not be negative
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### allocUnsafe(size)
|
||||
|
||||
- `size` <Integer> The desired length of the new `Buffer`
|
||||
|
||||
Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must be
|
||||
less than or equal to the value of `buffer.kMaxLength` and greater than or equal
|
||||
to zero. Otherwise, a `RangeError` is thrown.
|
||||
|
||||
## See also
|
||||
|
||||
- [buffer-alloc](https://github.com/LinusU/buffer-alloc) A ponyfill for `Buffer.alloc`
|
||||
- [buffer-fill](https://github.com/LinusU/buffer-fill) A ponyfill for `Buffer.fill`
|
||||
- [buffer-from](https://github.com/LinusU/buffer-from) A ponyfill for `Buffer.from`
|
||||
32
node_modules/buffer-alloc/index.js
generated
vendored
32
node_modules/buffer-alloc/index.js
generated
vendored
@@ -1,32 +0,0 @@
|
||||
var bufferFill = require('buffer-fill')
|
||||
var allocUnsafe = require('buffer-alloc-unsafe')
|
||||
|
||||
module.exports = function alloc (size, fill, encoding) {
|
||||
if (typeof size !== 'number') {
|
||||
throw new TypeError('"size" argument must be a number')
|
||||
}
|
||||
|
||||
if (size < 0) {
|
||||
throw new RangeError('"size" argument must not be negative')
|
||||
}
|
||||
|
||||
if (Buffer.alloc) {
|
||||
return Buffer.alloc(size, fill, encoding)
|
||||
}
|
||||
|
||||
var buffer = allocUnsafe(size)
|
||||
|
||||
if (size === 0) {
|
||||
return buffer
|
||||
}
|
||||
|
||||
if (fill === undefined) {
|
||||
return bufferFill(buffer, 0)
|
||||
}
|
||||
|
||||
if (typeof encoding !== 'string') {
|
||||
encoding = undefined
|
||||
}
|
||||
|
||||
return bufferFill(buffer, fill, encoding)
|
||||
}
|
||||
26
node_modules/buffer-alloc/package.json
generated
vendored
26
node_modules/buffer-alloc/package.json
generated
vendored
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"name": "buffer-alloc",
|
||||
"version": "1.2.0",
|
||||
"license": "MIT",
|
||||
"repository": "LinusU/buffer-alloc",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "standard && node test"
|
||||
},
|
||||
"dependencies": {
|
||||
"buffer-alloc-unsafe": "^1.1.0",
|
||||
"buffer-fill": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"standard": "^7.1.2"
|
||||
},
|
||||
"keywords": [
|
||||
"alloc",
|
||||
"allocate",
|
||||
"buffer alloc",
|
||||
"buffer allocate",
|
||||
"buffer"
|
||||
]
|
||||
}
|
||||
43
node_modules/buffer-alloc/readme.md
generated
vendored
43
node_modules/buffer-alloc/readme.md
generated
vendored
@@ -1,43 +0,0 @@
|
||||
# Buffer Alloc
|
||||
|
||||
A [ponyfill](https://ponyfill.com) for `Buffer.alloc`.
|
||||
|
||||
Works as Node.js: `v7.0.0` <br>
|
||||
Works on Node.js: `v0.10.0`
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save buffer-alloc
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const alloc = require('buffer-alloc')
|
||||
|
||||
console.log(alloc(4))
|
||||
//=> <Buffer 00 00 00 00>
|
||||
|
||||
console.log(alloc(6, 0x41))
|
||||
//=> <Buffer 41 41 41 41 41 41>
|
||||
|
||||
console.log(alloc(10, 'linus', 'utf8'))
|
||||
//=> <Buffer 6c 69 6e 75 73 6c 69 6e 75 73>
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### alloc(size[, fill[, encoding]])
|
||||
|
||||
- `size` <Integer> The desired length of the new `Buffer`
|
||||
- `fill` <String> | <Buffer> | <Integer> A value to pre-fill the new `Buffer` with. **Default:** `0`
|
||||
- `encoding` <String> If `fill` is a string, this is its encoding. **Default:** `'utf8'`
|
||||
|
||||
Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the `Buffer` will be zero-filled.
|
||||
|
||||
## See also
|
||||
|
||||
- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe`
|
||||
- [buffer-fill](https://github.com/LinusU/buffer-fill) A ponyfill for `Buffer.fill`
|
||||
- [buffer-from](https://github.com/LinusU/buffer-from) A ponyfill for `Buffer.from`
|
||||
19
node_modules/buffer-crc32/LICENSE
generated
vendored
19
node_modules/buffer-crc32/LICENSE
generated
vendored
@@ -1,19 +0,0 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2013 Brian J. Brennan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||
Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
47
node_modules/buffer-crc32/README.md
generated
vendored
47
node_modules/buffer-crc32/README.md
generated
vendored
@@ -1,47 +0,0 @@
|
||||
# buffer-crc32
|
||||
|
||||
[](http://travis-ci.org/brianloveswords/buffer-crc32)
|
||||
|
||||
crc32 that works with binary data and fancy character sets, outputs
|
||||
buffer, signed or unsigned data and has tests.
|
||||
|
||||
Derived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix
|
||||
|
||||
# install
|
||||
```
|
||||
npm install buffer-crc32
|
||||
```
|
||||
|
||||
# example
|
||||
```js
|
||||
var crc32 = require('buffer-crc32');
|
||||
// works with buffers
|
||||
var buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00])
|
||||
crc32(buf) // -> <Buffer 94 5a ab 4a>
|
||||
|
||||
// has convenience methods for getting signed or unsigned ints
|
||||
crc32.signed(buf) // -> -1805997238
|
||||
crc32.unsigned(buf) // -> 2488970058
|
||||
|
||||
// will cast to buffer if given a string, so you can
|
||||
// directly use foreign characters safely
|
||||
crc32('自動販売機') // -> <Buffer cb 03 1a c5>
|
||||
|
||||
// and works in append mode too
|
||||
var partialCrc = crc32('hey');
|
||||
var partialCrc = crc32(' ', partialCrc);
|
||||
var partialCrc = crc32('sup', partialCrc);
|
||||
var partialCrc = crc32(' ', partialCrc);
|
||||
var finalCrc = crc32('bros', partialCrc); // -> <Buffer 47 fa 55 70>
|
||||
```
|
||||
|
||||
# tests
|
||||
This was tested against the output of zlib's crc32 method. You can run
|
||||
the tests with`npm test` (requires tap)
|
||||
|
||||
# see also
|
||||
https://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also
|
||||
supports buffer inputs and return unsigned ints (thanks @tjholowaychuk).
|
||||
|
||||
# license
|
||||
MIT/X11
|
||||
111
node_modules/buffer-crc32/index.js
generated
vendored
111
node_modules/buffer-crc32/index.js
generated
vendored
@@ -1,111 +0,0 @@
|
||||
var Buffer = require('buffer').Buffer;
|
||||
|
||||
var CRC_TABLE = [
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
|
||||
0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
|
||||
0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
|
||||
0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
|
||||
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
|
||||
0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
||||
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
|
||||
0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
|
||||
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
|
||||
0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
|
||||
0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
|
||||
0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
||||
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
|
||||
0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
|
||||
0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
|
||||
0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
|
||||
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
|
||||
0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
||||
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
|
||||
0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
|
||||
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
|
||||
0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
|
||||
0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
|
||||
0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
||||
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
|
||||
0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
|
||||
0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
|
||||
0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
|
||||
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
|
||||
0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
||||
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
|
||||
0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
|
||||
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
|
||||
0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
|
||||
0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
|
||||
0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
||||
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
|
||||
0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
|
||||
0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
|
||||
0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
|
||||
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
|
||||
0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
||||
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
|
||||
0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
|
||||
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
|
||||
0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
|
||||
0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
|
||||
0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
||||
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
|
||||
0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
|
||||
0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
|
||||
0x2d02ef8d
|
||||
];
|
||||
|
||||
if (typeof Int32Array !== 'undefined') {
|
||||
CRC_TABLE = new Int32Array(CRC_TABLE);
|
||||
}
|
||||
|
||||
function ensureBuffer(input) {
|
||||
if (Buffer.isBuffer(input)) {
|
||||
return input;
|
||||
}
|
||||
|
||||
var hasNewBufferAPI =
|
||||
typeof Buffer.alloc === "function" &&
|
||||
typeof Buffer.from === "function";
|
||||
|
||||
if (typeof input === "number") {
|
||||
return hasNewBufferAPI ? Buffer.alloc(input) : new Buffer(input);
|
||||
}
|
||||
else if (typeof input === "string") {
|
||||
return hasNewBufferAPI ? Buffer.from(input) : new Buffer(input);
|
||||
}
|
||||
else {
|
||||
throw new Error("input must be buffer, number, or string, received " +
|
||||
typeof input);
|
||||
}
|
||||
}
|
||||
|
||||
function bufferizeInt(num) {
|
||||
var tmp = ensureBuffer(4);
|
||||
tmp.writeInt32BE(num, 0);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
function _crc32(buf, previous) {
|
||||
buf = ensureBuffer(buf);
|
||||
if (Buffer.isBuffer(previous)) {
|
||||
previous = previous.readUInt32BE(0);
|
||||
}
|
||||
var crc = ~~previous ^ -1;
|
||||
for (var n = 0; n < buf.length; n++) {
|
||||
crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8);
|
||||
}
|
||||
return (crc ^ -1);
|
||||
}
|
||||
|
||||
function crc32() {
|
||||
return bufferizeInt(_crc32.apply(null, arguments));
|
||||
}
|
||||
crc32.signed = function () {
|
||||
return _crc32.apply(null, arguments);
|
||||
};
|
||||
crc32.unsigned = function () {
|
||||
return _crc32.apply(null, arguments) >>> 0;
|
||||
};
|
||||
|
||||
module.exports = crc32;
|
||||
39
node_modules/buffer-crc32/package.json
generated
vendored
39
node_modules/buffer-crc32/package.json
generated
vendored
@@ -1,39 +0,0 @@
|
||||
{
|
||||
"author": "Brian J. Brennan <brianloveswords@gmail.com>",
|
||||
"name": "buffer-crc32",
|
||||
"description": "A pure javascript CRC32 algorithm that plays nice with binary data",
|
||||
"version": "0.2.13",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/brianloveswords/buffer-crc32/raw/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Vladimir Kuznetsov",
|
||||
"github": "mistakster"
|
||||
}
|
||||
],
|
||||
"homepage": "https://github.com/brianloveswords/buffer-crc32",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/brianloveswords/buffer-crc32.git"
|
||||
},
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "./node_modules/.bin/tap tests/*.test.js"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"tap": "~0.2.5"
|
||||
},
|
||||
"optionalDependencies": {},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js"
|
||||
]
|
||||
}
|
||||
113
node_modules/buffer-fill/index.js
generated
vendored
113
node_modules/buffer-fill/index.js
generated
vendored
@@ -1,113 +0,0 @@
|
||||
/* Node.js 6.4.0 and up has full support */
|
||||
var hasFullSupport = (function () {
|
||||
try {
|
||||
if (!Buffer.isEncoding('latin1')) {
|
||||
return false
|
||||
}
|
||||
|
||||
var buf = Buffer.alloc ? Buffer.alloc(4) : new Buffer(4)
|
||||
|
||||
buf.fill('ab', 'ucs2')
|
||||
|
||||
return (buf.toString('hex') === '61006200')
|
||||
} catch (_) {
|
||||
return false
|
||||
}
|
||||
}())
|
||||
|
||||
function isSingleByte (val) {
|
||||
return (val.length === 1 && val.charCodeAt(0) < 256)
|
||||
}
|
||||
|
||||
function fillWithNumber (buffer, val, start, end) {
|
||||
if (start < 0 || end > buffer.length) {
|
||||
throw new RangeError('Out of range index')
|
||||
}
|
||||
|
||||
start = start >>> 0
|
||||
end = end === undefined ? buffer.length : end >>> 0
|
||||
|
||||
if (end > start) {
|
||||
buffer.fill(val, start, end)
|
||||
}
|
||||
|
||||
return buffer
|
||||
}
|
||||
|
||||
function fillWithBuffer (buffer, val, start, end) {
|
||||
if (start < 0 || end > buffer.length) {
|
||||
throw new RangeError('Out of range index')
|
||||
}
|
||||
|
||||
if (end <= start) {
|
||||
return buffer
|
||||
}
|
||||
|
||||
start = start >>> 0
|
||||
end = end === undefined ? buffer.length : end >>> 0
|
||||
|
||||
var pos = start
|
||||
var len = val.length
|
||||
while (pos <= (end - len)) {
|
||||
val.copy(buffer, pos)
|
||||
pos += len
|
||||
}
|
||||
|
||||
if (pos !== end) {
|
||||
val.copy(buffer, pos, 0, end - pos)
|
||||
}
|
||||
|
||||
return buffer
|
||||
}
|
||||
|
||||
function fill (buffer, val, start, end, encoding) {
|
||||
if (hasFullSupport) {
|
||||
return buffer.fill(val, start, end, encoding)
|
||||
}
|
||||
|
||||
if (typeof val === 'number') {
|
||||
return fillWithNumber(buffer, val, start, end)
|
||||
}
|
||||
|
||||
if (typeof val === 'string') {
|
||||
if (typeof start === 'string') {
|
||||
encoding = start
|
||||
start = 0
|
||||
end = buffer.length
|
||||
} else if (typeof end === 'string') {
|
||||
encoding = end
|
||||
end = buffer.length
|
||||
}
|
||||
|
||||
if (encoding !== undefined && typeof encoding !== 'string') {
|
||||
throw new TypeError('encoding must be a string')
|
||||
}
|
||||
|
||||
if (encoding === 'latin1') {
|
||||
encoding = 'binary'
|
||||
}
|
||||
|
||||
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
||||
throw new TypeError('Unknown encoding: ' + encoding)
|
||||
}
|
||||
|
||||
if (val === '') {
|
||||
return fillWithNumber(buffer, 0, start, end)
|
||||
}
|
||||
|
||||
if (isSingleByte(val)) {
|
||||
return fillWithNumber(buffer, val.charCodeAt(0), start, end)
|
||||
}
|
||||
|
||||
val = new Buffer(val, encoding)
|
||||
}
|
||||
|
||||
if (Buffer.isBuffer(val)) {
|
||||
return fillWithBuffer(buffer, val, start, end)
|
||||
}
|
||||
|
||||
// Other values (e.g. undefined, boolean, object) results in zero-fill
|
||||
return fillWithNumber(buffer, 0, start, end)
|
||||
}
|
||||
|
||||
module.exports = fill
|
||||
16
node_modules/buffer-fill/package.json
generated
vendored
16
node_modules/buffer-fill/package.json
generated
vendored
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"name": "buffer-fill",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"repository": "LinusU/buffer-fill",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "standard && node test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"buffer-alloc-unsafe": "^1.1.0",
|
||||
"standard": "^7.1.2"
|
||||
}
|
||||
}
|
||||
54
node_modules/buffer-fill/readme.md
generated
vendored
54
node_modules/buffer-fill/readme.md
generated
vendored
@@ -1,54 +0,0 @@
|
||||
# Buffer Fill
|
||||
|
||||
A [ponyfill](https://ponyfill.com) for `Buffer.fill`.
|
||||
|
||||
Works as Node.js: `v6.4.0` <br>
|
||||
Works on Node.js: `v0.10.0`
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save buffer-fill
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const fill = require('buffer-fill')
|
||||
const buf = Buffer.allocUnsafe(5)
|
||||
|
||||
console.log(buf.fill(8))
|
||||
//=> <Buffer 08 08 08 08 08>
|
||||
|
||||
console.log(buf.fill(9, 2, 4))
|
||||
//=> <Buffer 08 08 09 09 08>
|
||||
|
||||
console.log(buf.fill('linus', 'latin1'))
|
||||
//=> <Buffer 6c 69 6e 75 73>
|
||||
|
||||
console.log(buf.fill('\u0222'))
|
||||
//=> <Buffer c8 a2 c8 a2 c8>
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### fill(buf, value[, offset[, end]][, encoding])
|
||||
|
||||
- `value` <String> | <Buffer> | <Integer> The value to fill `buf` with
|
||||
- `offset` <Integer> Where to start filling `buf`. **Default:** `0`
|
||||
- `end` <Integer> Where to stop filling `buf` (not inclusive). **Default:** `buf.length`
|
||||
- `encoding` <String> If `value` is a string, this is its encoding. **Default:** `'utf8'`
|
||||
- Return: <Buffer> A reference to `buf`
|
||||
|
||||
Fills `buf` with the specified `value`. If the `offset` and `end` are not given,
|
||||
the entire `buf` will be filled. This is meant to be a small simplification to
|
||||
allow the creation and filling of a `Buffer` to be done on a single line.
|
||||
|
||||
If the final write of a `fill()` operation falls on a multi-byte character, then
|
||||
only the first bytes of that character that fit into `buf` are written.
|
||||
|
||||
## See also
|
||||
|
||||
- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe`
|
||||
- [buffer-alloc](https://github.com/LinusU/buffer-alloc) A ponyfill for `Buffer.alloc`
|
||||
- [buffer-from](https://github.com/LinusU/buffer-from) A ponyfill for `Buffer.from`
|
||||
1
node_modules/buffer/.npmignore
generated
vendored
1
node_modules/buffer/.npmignore
generated
vendored
@@ -1 +0,0 @@
|
||||
perf/
|
||||
8
node_modules/buffer/.travis.yml
generated
vendored
8
node_modules/buffer/.travis.yml
generated
vendored
@@ -1,8 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- '4'
|
||||
sudo: false
|
||||
env:
|
||||
global:
|
||||
- secure: AUsK+8fYSpwIMHcVt8Mu9SpG9RPHp4XDAwCQfpU3d5U65q8OVVC6C+XjvnNmEd2PoEJRHem8ZXEyRVfGM1sttKZLZP70TEKZOpOiRQnZiTQCAJ92TfGsDj/F4LoWSjUZUpfeg9b3iSp8G5dVw3+q9QZPIu6eykASK6bfcg//Cyg=
|
||||
- secure: eQBKJWu7XbhAN4ZvOOhMenC0IPpoYj+wZVVzzsLwUppfJqlrHV0CUW8rJdvZNiaGhYhoyHTnAcynpTE5kZfg3XjevOvF8PGY5wUYCki9BI+rp+pvVPZE/DNUAQpFR2gd2nxMJ4kYv7GVb6i/DfuqJa0h8IuY4zcMuKWwbQd3Az8=
|
||||
22
node_modules/buffer/.zuul.yml
generated
vendored
22
node_modules/buffer/.zuul.yml
generated
vendored
@@ -1,22 +0,0 @@
|
||||
ui: tape
|
||||
scripts:
|
||||
- "./test/_polyfill.js"
|
||||
browsers:
|
||||
- name: chrome
|
||||
version: -2..latest
|
||||
- name: firefox
|
||||
version: -2..latest
|
||||
- name: safari
|
||||
version: [6, 7, 8, 9..latest]
|
||||
- name: ie
|
||||
version: 8..latest
|
||||
- name: microsoftedge
|
||||
version: 20..latest
|
||||
- name: opera
|
||||
version: 11..latest
|
||||
- name: iphone
|
||||
version: [5.1, 6.1, 7.1, 8.4, 9.1..latest]
|
||||
- name: ipad
|
||||
version: [5.1, 6.1, 7.1, 8.4, 9.1..latest]
|
||||
- name: android
|
||||
version: 4.0..latest
|
||||
21
node_modules/buffer/LICENSE
generated
vendored
21
node_modules/buffer/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Feross Aboukhadijeh, and other contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
364
node_modules/buffer/README.md
generated
vendored
364
node_modules/buffer/README.md
generated
vendored
@@ -1,364 +0,0 @@
|
||||
# buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][npm-url]
|
||||
|
||||
#### The buffer module from [node.js](http://nodejs.org/), for the browser.
|
||||
|
||||
[![saucelabs][saucelabs-image]][saucelabs-url]
|
||||
|
||||
[travis-image]: https://img.shields.io/travis/feross/buffer.svg?style=flat
|
||||
[travis-url]: https://travis-ci.org/feross/buffer
|
||||
[npm-image]: https://img.shields.io/npm/v/buffer.svg?style=flat
|
||||
[npm-url]: https://npmjs.org/package/buffer
|
||||
[downloads-image]: https://img.shields.io/npm/dm/buffer.svg?style=flat
|
||||
[saucelabs-image]: https://saucelabs.com/browser-matrix/buffer.svg
|
||||
[saucelabs-url]: https://saucelabs.com/u/buffer
|
||||
|
||||
With [browserify](http://browserify.org), simply `require('buffer')` or use the `Buffer` global and you will get this module.
|
||||
|
||||
The goal is to provide an API that is 100% identical to
|
||||
[node's Buffer API](http://iojs.org/api/buffer.html). Read the
|
||||
[official docs](http://iojs.org/api/buffer.html) for the full list of properties,
|
||||
instance methods, and class methods that are supported.
|
||||
|
||||
## features
|
||||
|
||||
- Manipulate binary data like a boss, in all browsers -- even IE6!
|
||||
- Super fast. Backed by Typed Arrays (`Uint8Array`/`ArrayBuffer`, not `Object`)
|
||||
- Extremely small bundle size (**5.04KB minified + gzipped**, 35.5KB with comments)
|
||||
- Excellent browser support (IE 6+, Chrome 4+, Firefox 3+, Safari 5.1+, Opera 11+, iOS, etc.)
|
||||
- Preserves Node API exactly, with one important difference (see below)
|
||||
- `.slice()` returns instances of the same type (Buffer)
|
||||
- Square-bracket `buf[4]` notation works, even in old browsers like IE6!
|
||||
- Does not modify any browser prototypes or put anything on `window`
|
||||
- Comprehensive test suite (including all buffer tests from node.js core)
|
||||
|
||||
|
||||
## install
|
||||
|
||||
To use this module directly (without browserify), install it:
|
||||
|
||||
```bash
|
||||
npm install buffer
|
||||
```
|
||||
|
||||
This module was previously called **native-buffer-browserify**, but please use **buffer**
|
||||
from now on.
|
||||
|
||||
A standalone bundle is available [here](https://wzrd.in/standalone/buffer), for non-browserify users.
|
||||
|
||||
|
||||
## usage
|
||||
|
||||
The module's API is identical to node's `Buffer` API. Read the
|
||||
[official docs](http://iojs.org/api/buffer.html) for the full list of properties,
|
||||
instance methods, and class methods that are supported.
|
||||
|
||||
As mentioned above, `require('buffer')` or use the `Buffer` global with
|
||||
[browserify](http://browserify.org) and this module will automatically be included
|
||||
in your bundle. Almost any npm module will work in the browser, even if it assumes that
|
||||
the node `Buffer` API will be available.
|
||||
|
||||
To depend on this module explicitly (without browserify), require it like this:
|
||||
|
||||
```js
|
||||
var Buffer = require('buffer/').Buffer // note: the trailing slash is important!
|
||||
```
|
||||
|
||||
To require this module explicitly, use `require('buffer/')` which tells the node.js module
|
||||
lookup algorithm (also used by browserify) to use the **npm module** named `buffer`
|
||||
instead of the **node.js core** module named `buffer`!
|
||||
|
||||
|
||||
## how does it work?
|
||||
|
||||
`Buffer` is a subclass of `Uint8Array` augmented with all the `Buffer` API methods.
|
||||
The `Uint8Array` prototype is not modified.
|
||||
|
||||
|
||||
## one minor difference
|
||||
|
||||
#### In old browsers, `buf.slice()` does not modify parent buffer's memory
|
||||
|
||||
If you only support modern browsers (specifically, those with typed array support),
|
||||
then this issue does not affect you. If you support super old browsers, then read on.
|
||||
|
||||
In node, the `slice()` method returns a new `Buffer` that shares underlying memory
|
||||
with the original Buffer. When you modify one buffer, you modify the other.
|
||||
[Read more.](http://iojs.org/api/buffer.html#buffer_buf_slice_start_end)
|
||||
|
||||
In browsers with typed array support, this `Buffer` implementation supports this
|
||||
behavior. In browsers without typed arrays, an alternate buffer implementation is
|
||||
used that is based on `Object` which has no mechanism to point separate
|
||||
`Buffer`s to the same underlying slab of memory.
|
||||
|
||||
You can see which browser versions lack typed array support
|
||||
[here](https://github.com/feross/buffer/blob/master/index.js#L20-L46).
|
||||
|
||||
|
||||
## tracking the latest node api
|
||||
|
||||
This module tracks the Buffer API in the latest (unstable) version of node.js. The Buffer
|
||||
API is considered **stable** in the
|
||||
[node stability index](http://nodejs.org/docs/latest/api/documentation.html#documentation_stability_index),
|
||||
so it is unlikely that there will ever be breaking changes.
|
||||
Nonetheless, when/if the Buffer API changes in node, this module's API will change
|
||||
accordingly.
|
||||
|
||||
## performance
|
||||
|
||||
See perf tests in `/perf`.
|
||||
|
||||
`BrowserBuffer` is the browser `buffer` module (this repo). `Uint8Array` is included as a
|
||||
sanity check (since `BrowserBuffer` uses `Uint8Array` under the hood, `Uint8Array` will
|
||||
always be at least a bit faster). Finally, `NodeBuffer` is the node.js buffer module,
|
||||
which is included to compare against.
|
||||
|
||||
### Chrome 38
|
||||
|
||||
| Method | Operations | Accuracy | Sampled | Fastest |
|
||||
|:-------|:-----------|:---------|:--------|:-------:|
|
||||
| BrowserBuffer#bracket-notation | 11,457,464 ops/sec | ±0.86% | 66 | ✓ |
|
||||
| Uint8Array#bracket-notation | 10,824,332 ops/sec | ±0.74% | 65 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#concat | 450,532 ops/sec | ±0.76% | 68 | |
|
||||
| Uint8Array#concat | 1,368,911 ops/sec | ±1.50% | 62 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#copy(16000) | 903,001 ops/sec | ±0.96% | 67 | |
|
||||
| Uint8Array#copy(16000) | 1,422,441 ops/sec | ±1.04% | 66 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#copy(16) | 11,431,358 ops/sec | ±0.46% | 69 | |
|
||||
| Uint8Array#copy(16) | 13,944,163 ops/sec | ±1.12% | 68 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#new(16000) | 106,329 ops/sec | ±6.70% | 44 | |
|
||||
| Uint8Array#new(16000) | 131,001 ops/sec | ±2.85% | 31 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#new(16) | 1,554,491 ops/sec | ±1.60% | 65 | |
|
||||
| Uint8Array#new(16) | 6,623,930 ops/sec | ±1.66% | 65 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#readDoubleBE | 112,830 ops/sec | ±0.51% | 69 | ✓ |
|
||||
| DataView#getFloat64 | 93,500 ops/sec | ±0.57% | 68 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#readFloatBE | 146,678 ops/sec | ±0.95% | 68 | ✓ |
|
||||
| DataView#getFloat32 | 99,311 ops/sec | ±0.41% | 67 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#readUInt32LE | 843,214 ops/sec | ±0.70% | 69 | ✓ |
|
||||
| DataView#getUint32 | 103,024 ops/sec | ±0.64% | 67 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#slice | 1,013,941 ops/sec | ±0.75% | 67 | |
|
||||
| Uint8Array#subarray | 1,903,928 ops/sec | ±0.53% | 67 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#writeFloatBE | 61,387 ops/sec | ±0.90% | 67 | |
|
||||
| DataView#setFloat32 | 141,249 ops/sec | ±0.40% | 66 | ✓ |
|
||||
|
||||
|
||||
### Firefox 33
|
||||
|
||||
| Method | Operations | Accuracy | Sampled | Fastest |
|
||||
|:-------|:-----------|:---------|:--------|:-------:|
|
||||
| BrowserBuffer#bracket-notation | 20,800,421 ops/sec | ±1.84% | 60 | |
|
||||
| Uint8Array#bracket-notation | 20,826,235 ops/sec | ±2.02% | 61 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#concat | 153,076 ops/sec | ±2.32% | 61 | |
|
||||
| Uint8Array#concat | 1,255,674 ops/sec | ±8.65% | 52 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#copy(16000) | 1,105,312 ops/sec | ±1.16% | 63 | |
|
||||
| Uint8Array#copy(16000) | 1,615,911 ops/sec | ±0.55% | 66 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#copy(16) | 16,357,599 ops/sec | ±0.73% | 68 | |
|
||||
| Uint8Array#copy(16) | 31,436,281 ops/sec | ±1.05% | 68 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#new(16000) | 52,995 ops/sec | ±6.01% | 35 | |
|
||||
| Uint8Array#new(16000) | 87,686 ops/sec | ±5.68% | 45 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#new(16) | 252,031 ops/sec | ±1.61% | 66 | |
|
||||
| Uint8Array#new(16) | 8,477,026 ops/sec | ±0.49% | 68 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#readDoubleBE | 99,871 ops/sec | ±0.41% | 69 | |
|
||||
| DataView#getFloat64 | 285,663 ops/sec | ±0.70% | 68 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#readFloatBE | 115,540 ops/sec | ±0.42% | 69 | |
|
||||
| DataView#getFloat32 | 288,722 ops/sec | ±0.82% | 68 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#readUInt32LE | 633,926 ops/sec | ±1.08% | 67 | ✓ |
|
||||
| DataView#getUint32 | 294,808 ops/sec | ±0.79% | 64 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#slice | 349,425 ops/sec | ±0.46% | 69 | |
|
||||
| Uint8Array#subarray | 5,965,819 ops/sec | ±0.60% | 65 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#writeFloatBE | 59,980 ops/sec | ±0.41% | 67 | |
|
||||
| DataView#setFloat32 | 317,634 ops/sec | ±0.63% | 68 | ✓ |
|
||||
|
||||
### Safari 8
|
||||
|
||||
| Method | Operations | Accuracy | Sampled | Fastest |
|
||||
|:-------|:-----------|:---------|:--------|:-------:|
|
||||
| BrowserBuffer#bracket-notation | 10,279,729 ops/sec | ±2.25% | 56 | ✓ |
|
||||
| Uint8Array#bracket-notation | 10,030,767 ops/sec | ±2.23% | 59 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#concat | 144,138 ops/sec | ±1.38% | 65 | |
|
||||
| Uint8Array#concat | 4,950,764 ops/sec | ±1.70% | 63 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#copy(16000) | 1,058,548 ops/sec | ±1.51% | 64 | |
|
||||
| Uint8Array#copy(16000) | 1,409,666 ops/sec | ±1.17% | 65 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#copy(16) | 6,282,529 ops/sec | ±1.88% | 58 | |
|
||||
| Uint8Array#copy(16) | 11,907,128 ops/sec | ±2.87% | 58 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#new(16000) | 101,663 ops/sec | ±3.89% | 57 | |
|
||||
| Uint8Array#new(16000) | 22,050,818 ops/sec | ±6.51% | 46 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#new(16) | 176,072 ops/sec | ±2.13% | 64 | |
|
||||
| Uint8Array#new(16) | 24,385,731 ops/sec | ±5.01% | 51 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#readDoubleBE | 41,341 ops/sec | ±1.06% | 67 | |
|
||||
| DataView#getFloat64 | 322,280 ops/sec | ±0.84% | 68 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#readFloatBE | 46,141 ops/sec | ±1.06% | 65 | |
|
||||
| DataView#getFloat32 | 337,025 ops/sec | ±0.43% | 69 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#readUInt32LE | 151,551 ops/sec | ±1.02% | 66 | |
|
||||
| DataView#getUint32 | 308,278 ops/sec | ±0.94% | 67 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#slice | 197,365 ops/sec | ±0.95% | 66 | |
|
||||
| Uint8Array#subarray | 9,558,024 ops/sec | ±3.08% | 58 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#writeFloatBE | 17,518 ops/sec | ±1.03% | 63 | |
|
||||
| DataView#setFloat32 | 319,751 ops/sec | ±0.48% | 68 | ✓ |
|
||||
|
||||
|
||||
### Node 0.11.14
|
||||
|
||||
| Method | Operations | Accuracy | Sampled | Fastest |
|
||||
|:-------|:-----------|:---------|:--------|:-------:|
|
||||
| BrowserBuffer#bracket-notation | 10,489,828 ops/sec | ±3.25% | 90 | |
|
||||
| Uint8Array#bracket-notation | 10,534,884 ops/sec | ±0.81% | 92 | ✓ |
|
||||
| NodeBuffer#bracket-notation | 10,389,910 ops/sec | ±0.97% | 87 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#concat | 487,830 ops/sec | ±2.58% | 88 | |
|
||||
| Uint8Array#concat | 1,814,327 ops/sec | ±1.28% | 88 | ✓ |
|
||||
| NodeBuffer#concat | 1,636,523 ops/sec | ±1.88% | 73 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#copy(16000) | 1,073,665 ops/sec | ±0.77% | 90 | |
|
||||
| Uint8Array#copy(16000) | 1,348,517 ops/sec | ±0.84% | 89 | ✓ |
|
||||
| NodeBuffer#copy(16000) | 1,289,533 ops/sec | ±0.82% | 93 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#copy(16) | 12,782,706 ops/sec | ±0.74% | 85 | |
|
||||
| Uint8Array#copy(16) | 14,180,427 ops/sec | ±0.93% | 92 | ✓ |
|
||||
| NodeBuffer#copy(16) | 11,083,134 ops/sec | ±1.06% | 89 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#new(16000) | 141,678 ops/sec | ±3.30% | 67 | |
|
||||
| Uint8Array#new(16000) | 161,491 ops/sec | ±2.96% | 60 | |
|
||||
| NodeBuffer#new(16000) | 292,699 ops/sec | ±3.20% | 55 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#new(16) | 1,655,466 ops/sec | ±2.41% | 82 | |
|
||||
| Uint8Array#new(16) | 14,399,926 ops/sec | ±0.91% | 94 | ✓ |
|
||||
| NodeBuffer#new(16) | 3,894,696 ops/sec | ±0.88% | 92 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#readDoubleBE | 109,582 ops/sec | ±0.75% | 93 | ✓ |
|
||||
| DataView#getFloat64 | 91,235 ops/sec | ±0.81% | 90 | |
|
||||
| NodeBuffer#readDoubleBE | 88,593 ops/sec | ±0.96% | 81 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#readFloatBE | 139,854 ops/sec | ±1.03% | 85 | ✓ |
|
||||
| DataView#getFloat32 | 98,744 ops/sec | ±0.80% | 89 | |
|
||||
| NodeBuffer#readFloatBE | 92,769 ops/sec | ±0.94% | 93 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#readUInt32LE | 710,861 ops/sec | ±0.82% | 92 | |
|
||||
| DataView#getUint32 | 117,893 ops/sec | ±0.84% | 91 | |
|
||||
| NodeBuffer#readUInt32LE | 851,412 ops/sec | ±0.72% | 93 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#slice | 1,673,877 ops/sec | ±0.73% | 94 | |
|
||||
| Uint8Array#subarray | 6,919,243 ops/sec | ±0.67% | 90 | ✓ |
|
||||
| NodeBuffer#slice | 4,617,604 ops/sec | ±0.79% | 93 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#writeFloatBE | 66,011 ops/sec | ±0.75% | 93 | |
|
||||
| DataView#setFloat32 | 127,760 ops/sec | ±0.72% | 93 | ✓ |
|
||||
| NodeBuffer#writeFloatBE | 103,352 ops/sec | ±0.83% | 93 | |
|
||||
|
||||
### iojs 1.8.1
|
||||
|
||||
| Method | Operations | Accuracy | Sampled | Fastest |
|
||||
|:-------|:-----------|:---------|:--------|:-------:|
|
||||
| BrowserBuffer#bracket-notation | 10,990,488 ops/sec | ±1.11% | 91 | |
|
||||
| Uint8Array#bracket-notation | 11,268,757 ops/sec | ±0.65% | 97 | |
|
||||
| NodeBuffer#bracket-notation | 11,353,260 ops/sec | ±0.83% | 94 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#concat | 378,954 ops/sec | ±0.74% | 94 | |
|
||||
| Uint8Array#concat | 1,358,288 ops/sec | ±0.97% | 87 | |
|
||||
| NodeBuffer#concat | 1,934,050 ops/sec | ±1.11% | 78 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#copy(16000) | 894,538 ops/sec | ±0.56% | 84 | |
|
||||
| Uint8Array#copy(16000) | 1,442,656 ops/sec | ±0.71% | 96 | |
|
||||
| NodeBuffer#copy(16000) | 1,457,898 ops/sec | ±0.53% | 92 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#copy(16) | 12,870,457 ops/sec | ±0.67% | 95 | |
|
||||
| Uint8Array#copy(16) | 16,643,989 ops/sec | ±0.61% | 93 | ✓ |
|
||||
| NodeBuffer#copy(16) | 14,885,848 ops/sec | ±0.74% | 94 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#new(16000) | 109,264 ops/sec | ±4.21% | 63 | |
|
||||
| Uint8Array#new(16000) | 138,916 ops/sec | ±1.87% | 61 | |
|
||||
| NodeBuffer#new(16000) | 281,449 ops/sec | ±3.58% | 51 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#new(16) | 1,362,935 ops/sec | ±0.56% | 99 | |
|
||||
| Uint8Array#new(16) | 6,193,090 ops/sec | ±0.64% | 95 | ✓ |
|
||||
| NodeBuffer#new(16) | 4,745,425 ops/sec | ±1.56% | 90 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#readDoubleBE | 118,127 ops/sec | ±0.59% | 93 | ✓ |
|
||||
| DataView#getFloat64 | 107,332 ops/sec | ±0.65% | 91 | |
|
||||
| NodeBuffer#readDoubleBE | 116,274 ops/sec | ±0.94% | 95 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#readFloatBE | 150,326 ops/sec | ±0.58% | 95 | ✓ |
|
||||
| DataView#getFloat32 | 110,541 ops/sec | ±0.57% | 98 | |
|
||||
| NodeBuffer#readFloatBE | 121,599 ops/sec | ±0.60% | 87 | |
|
||||
| | | | |
|
||||
| BrowserBuffer#readUInt32LE | 814,147 ops/sec | ±0.62% | 93 | |
|
||||
| DataView#getUint32 | 137,592 ops/sec | ±0.64% | 90 | |
|
||||
| NodeBuffer#readUInt32LE | 931,650 ops/sec | ±0.71% | 96 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#slice | 878,590 ops/sec | ±0.68% | 93 | |
|
||||
| Uint8Array#subarray | 2,843,308 ops/sec | ±1.02% | 90 | |
|
||||
| NodeBuffer#slice | 4,998,316 ops/sec | ±0.68% | 90 | ✓ |
|
||||
| | | | |
|
||||
| BrowserBuffer#writeFloatBE | 65,927 ops/sec | ±0.74% | 93 | |
|
||||
| DataView#setFloat32 | 139,823 ops/sec | ±0.97% | 89 | ✓ |
|
||||
| NodeBuffer#writeFloatBE | 135,763 ops/sec | ±0.65% | 96 | |
|
||||
| | | | |
|
||||
|
||||
## Testing the project
|
||||
|
||||
First, install the project:
|
||||
|
||||
npm install
|
||||
|
||||
Then, to run tests in Node.js, run:
|
||||
|
||||
npm run test-node
|
||||
|
||||
To test locally in a browser, you can run:
|
||||
|
||||
npm run test-browser-local
|
||||
|
||||
This will print out a URL that you can then open in a browser to run the tests, using [Zuul](https://github.com/defunctzombie/zuul).
|
||||
|
||||
To run automated browser tests using Saucelabs, ensure that your `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment variables are set, then run:
|
||||
|
||||
npm test
|
||||
|
||||
This is what's run in Travis, to check against various browsers. The list of browsers is kept in the `.zuul.yml` file.
|
||||
|
||||
## JavaScript Standard Style
|
||||
|
||||
This module uses [JavaScript Standard Style](https://github.com/feross/standard).
|
||||
|
||||
[](https://github.com/feross/standard)
|
||||
|
||||
To test that the code conforms to the style, `npm install` and run:
|
||||
|
||||
./node_modules/.bin/standard
|
||||
|
||||
## credit
|
||||
|
||||
This was originally forked from [buffer-browserify](https://github.com/toots/buffer-browserify).
|
||||
|
||||
|
||||
## license
|
||||
|
||||
MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org), and other contributors. Originally forked from an MIT-licensed module by Romain Beauxis.
|
||||
126
node_modules/buffer/bin/download-node-tests.js
generated
vendored
126
node_modules/buffer/bin/download-node-tests.js
generated
vendored
@@ -1,126 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var concat = require('concat-stream')
|
||||
var fs = require('fs')
|
||||
var hyperquest = require('hyperquest')
|
||||
var cp = require('child_process')
|
||||
var split = require('split')
|
||||
var through = require('through2')
|
||||
|
||||
var url = 'https://api.github.com/repos/nodejs/io.js/contents'
|
||||
var dirs = [
|
||||
'/test/parallel',
|
||||
'/test/pummel'
|
||||
]
|
||||
|
||||
cp.execSync('rm -rf node/*.js', { cwd: __dirname + '/../test' })
|
||||
cp.execSync('rm -rf node-es6/*.js', { cwd: __dirname + '/../test' })
|
||||
|
||||
var httpOpts = {
|
||||
headers: {
|
||||
'User-Agent': null
|
||||
// auth if github rate-limits you...
|
||||
// 'Authorization': 'Basic ' + Buffer('username:password').toString('base64'),
|
||||
}
|
||||
}
|
||||
|
||||
dirs.forEach(function (dir) {
|
||||
var req = hyperquest(url + dir, httpOpts)
|
||||
req.pipe(concat(function (data) {
|
||||
if (req.response.statusCode !== 200) {
|
||||
throw new Error(url + dir + ': ' + data.toString())
|
||||
}
|
||||
downloadBufferTests(dir, JSON.parse(data))
|
||||
}))
|
||||
})
|
||||
|
||||
function downloadBufferTests (dir, files) {
|
||||
files.forEach(function (file) {
|
||||
if (!/test-buffer.*/.test(file.name)) return
|
||||
|
||||
var path
|
||||
if (file.name === 'test-buffer-iterator.js' ||
|
||||
file.name === 'test-buffer-arraybuffer.js') {
|
||||
path = __dirname + '/../test/node-es6/' + file.name
|
||||
} else if (file.name === 'test-buffer-fakes.js') {
|
||||
// These teses only apply to node, where they're calling into C++ and need to
|
||||
// ensure the prototype can't be faked, or else there will be a segfault.
|
||||
return
|
||||
} else {
|
||||
path = __dirname + '/../test/node/' + file.name
|
||||
}
|
||||
|
||||
console.log(file.download_url)
|
||||
hyperquest(file.download_url, httpOpts)
|
||||
.pipe(split())
|
||||
.pipe(testfixer(file.name))
|
||||
.pipe(fs.createWriteStream(path))
|
||||
.on('finish', function () {
|
||||
console.log('wrote ' + file.name)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function testfixer (filename) {
|
||||
var firstline = true
|
||||
|
||||
return through(function (line, enc, cb) {
|
||||
line = line.toString()
|
||||
|
||||
if (firstline) {
|
||||
// require buffer explicitly
|
||||
var preamble = 'if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;\n' +
|
||||
'var Buffer = require(\'../../\').Buffer;'
|
||||
if (/use strict/.test(line)) line += '\n' + preamble
|
||||
else line + preamble + '\n' + line
|
||||
firstline = false
|
||||
}
|
||||
|
||||
// use `var` instead of `const`/`let`
|
||||
line = line.replace(/(const|let) /g, 'var ')
|
||||
|
||||
// make `require('common')` work
|
||||
line = line.replace(/(var common = require.*)/g, 'var common = {};')
|
||||
|
||||
// use `Buffer.isBuffer` instead of `instanceof Buffer`
|
||||
line = line.replace(/buf instanceof Buffer/g, 'Buffer.isBuffer(buf)')
|
||||
|
||||
// require browser buffer
|
||||
line = line.replace(/(.*)require\('buffer'\)(.*)/g, '$1require(\'../../\')$2')
|
||||
|
||||
// smalloc is only used for kMaxLength
|
||||
line = line.replace(
|
||||
/require\('smalloc'\)/g,
|
||||
'{ kMaxLength: process.env.OBJECT_IMPL ? 0x3fffffff : 0x7fffffff }'
|
||||
)
|
||||
|
||||
// comment out console logs
|
||||
line = line.replace(/(.*console\..*)/g, '// $1')
|
||||
|
||||
// we can't reliably test typed array max-sizes in the browser
|
||||
if (filename === 'test-buffer-big.js') {
|
||||
line = line.replace(/(.*new Int8Array.*RangeError.*)/, '// $1')
|
||||
line = line.replace(/(.*new ArrayBuffer.*RangeError.*)/, '// $1')
|
||||
line = line.replace(/(.*new Float64Array.*RangeError.*)/, '// $1')
|
||||
}
|
||||
|
||||
// https://github.com/iojs/io.js/blob/v0.12/test/parallel/test-buffer.js#L38
|
||||
// we can't run this because we need to support
|
||||
// browsers that don't have typed arrays
|
||||
if (filename === 'test-buffer.js') {
|
||||
line = line.replace(/b\[0\] = -1;/, 'b[0] = 255;')
|
||||
}
|
||||
|
||||
// https://github.com/iojs/io.js/blob/v0.12/test/parallel/test-buffer.js#L1138
|
||||
// unfortunately we can't run this as it touches
|
||||
// node streams which do an instanceof check
|
||||
// and crypto-browserify doesn't work in old
|
||||
// versions of ie
|
||||
if (filename === 'test-buffer.js') {
|
||||
line = line.replace(/^(\s*)(var crypto = require.*)/, '$1// $2')
|
||||
line = line.replace(/(crypto.createHash.*\))/, '1 /*$1*/')
|
||||
}
|
||||
|
||||
cb(null, line + '\n')
|
||||
})
|
||||
}
|
||||
18
node_modules/buffer/bin/test.js
generated
vendored
18
node_modules/buffer/bin/test.js
generated
vendored
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var cp = require('child_process')
|
||||
|
||||
var runBrowserTests = !process.env.TRAVIS_PULL_REQUEST ||
|
||||
process.env.TRAVIS_PULL_REQUEST === 'false'
|
||||
|
||||
var node = cp.spawn('npm', ['run', 'test-node'], { stdio: 'inherit' })
|
||||
node.on('close', function (code) {
|
||||
if (code === 0 && runBrowserTests) {
|
||||
var browser = cp.spawn('npm', ['run', 'test-browser'], { stdio: 'inherit' })
|
||||
browser.on('close', function (code) {
|
||||
process.exit(code)
|
||||
})
|
||||
} else {
|
||||
process.exit(code)
|
||||
}
|
||||
})
|
||||
1548
node_modules/buffer/index.js
generated
vendored
1548
node_modules/buffer/index.js
generated
vendored
File diff suppressed because it is too large
Load Diff
74
node_modules/buffer/package.json
generated
vendored
74
node_modules/buffer/package.json
generated
vendored
@@ -1,74 +0,0 @@
|
||||
{
|
||||
"name": "buffer",
|
||||
"description": "Node.js Buffer API, for the browser",
|
||||
"version": "3.6.0",
|
||||
"author": {
|
||||
"name": "Feross Aboukhadijeh",
|
||||
"email": "feross@feross.org",
|
||||
"url": "http://feross.org"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/feross/buffer/issues"
|
||||
},
|
||||
"contributors": [
|
||||
"Romain Beauxis <toots@rastageeks.org>",
|
||||
"James Halliday <mail@substack.net>"
|
||||
],
|
||||
"dependencies": {
|
||||
"base64-js": "0.0.8",
|
||||
"ieee754": "^1.1.4",
|
||||
"isarray": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"benchmark": "^1.0.0",
|
||||
"browserify": "^12.0.1",
|
||||
"concat-stream": "^1.4.7",
|
||||
"hyperquest": "^1.0.1",
|
||||
"is-nan": "^1.0.1",
|
||||
"split": "^1.0.0",
|
||||
"standard": "^5.0.0",
|
||||
"tape": "^4.0.0",
|
||||
"through2": "^2.0.0",
|
||||
"zuul": "^3.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/feross/buffer",
|
||||
"keywords": [
|
||||
"buffer",
|
||||
"browserify",
|
||||
"compatible",
|
||||
"browser",
|
||||
"arraybuffer",
|
||||
"uint8array",
|
||||
"dataview"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/feross/buffer.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && node ./bin/test.js",
|
||||
"test-browser": "zuul -- test/*.js test/node/*.js",
|
||||
"test-browser-local": "zuul --local -- test/*.js test/node/*.js",
|
||||
"test-node": "tape test/*.js test/node/*.js test/node-es6/*.js && OBJECT_IMPL=true tape test/*.js test/node/*.js",
|
||||
"perf": "browserify --debug perf/bracket-notation.js > perf/bundle.js && open perf/index.html",
|
||||
"perf-node": "node perf/bracket-notation.js && node perf/concat.js && node perf/copy-big.js && node perf/copy.js && node perf/new-big.js && node perf/new.js && node perf/readDoubleBE.js && node perf/readFloatBE.js && node perf/readUInt32LE.js && node perf/slice.js && node perf/writeFloatBE.js",
|
||||
"size": "browserify -r ./ | uglifyjs -c -m | gzip | wc -c"
|
||||
},
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"test/node/*.js",
|
||||
"test/node-es6/*.js",
|
||||
"test/_polyfill.js",
|
||||
"perf/*.js"
|
||||
]
|
||||
},
|
||||
"jspm": {
|
||||
"map": {
|
||||
"./index.js": {
|
||||
"node": "@node/buffer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
150
node_modules/buffer/test/_polyfill.js
generated
vendored
150
node_modules/buffer/test/_polyfill.js
generated
vendored
@@ -1,150 +0,0 @@
|
||||
if (!Array.prototype.forEach) {
|
||||
|
||||
Array.prototype.forEach = function(callback, thisArg) {
|
||||
|
||||
var T, k;
|
||||
|
||||
if (this == null) {
|
||||
throw new TypeError(' this is null or not defined');
|
||||
}
|
||||
|
||||
// 1. Let O be the result of calling ToObject passing the |this| value as the argument.
|
||||
var O = Object(this);
|
||||
|
||||
// 2. Let lenValue be the result of calling the Get internal method of O with the argument "length".
|
||||
// 3. Let len be ToUint32(lenValue).
|
||||
var len = O.length >>> 0;
|
||||
|
||||
// 4. If IsCallable(callback) is false, throw a TypeError exception.
|
||||
// See: http://es5.github.com/#x9.11
|
||||
if (typeof callback !== "function") {
|
||||
throw new TypeError(callback + ' is not a function');
|
||||
}
|
||||
|
||||
// 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
||||
if (arguments.length > 1) {
|
||||
T = thisArg;
|
||||
}
|
||||
|
||||
// 6. Let k be 0
|
||||
k = 0;
|
||||
|
||||
// 7. Repeat, while k < len
|
||||
while (k < len) {
|
||||
|
||||
var kValue;
|
||||
|
||||
// a. Let Pk be ToString(k).
|
||||
// This is implicit for LHS operands of the in operator
|
||||
// b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk.
|
||||
// This step can be combined with c
|
||||
// c. If kPresent is true, then
|
||||
if (k in O) {
|
||||
|
||||
// i. Let kValue be the result of calling the Get internal method of O with argument Pk.
|
||||
kValue = O[k];
|
||||
|
||||
// ii. Call the Call internal method of callback with T as the this value and
|
||||
// argument list containing kValue, k, and O.
|
||||
callback.call(T, kValue, k, O);
|
||||
}
|
||||
// d. Increase k by 1.
|
||||
k++;
|
||||
}
|
||||
// 8. return undefined
|
||||
};
|
||||
}
|
||||
|
||||
if (!Array.isArray) {
|
||||
Array.isArray = function(arg) {
|
||||
return Object.prototype.toString.call(arg) === '[object Array]';
|
||||
};
|
||||
}
|
||||
|
||||
if (!Array.prototype.map) {
|
||||
|
||||
Array.prototype.map = function(callback, thisArg) {
|
||||
|
||||
var T, A, k;
|
||||
|
||||
if (this == null) {
|
||||
throw new TypeError(' this is null or not defined');
|
||||
}
|
||||
|
||||
// 1. Let O be the result of calling ToObject passing the |this|
|
||||
// value as the argument.
|
||||
var O = Object(this);
|
||||
|
||||
// 2. Let lenValue be the result of calling the Get internal
|
||||
// method of O with the argument "length".
|
||||
// 3. Let len be ToUint32(lenValue).
|
||||
var len = O.length >>> 0;
|
||||
|
||||
// 4. If IsCallable(callback) is false, throw a TypeError exception.
|
||||
// See: http://es5.github.com/#x9.11
|
||||
if (typeof callback !== 'function') {
|
||||
throw new TypeError(callback + ' is not a function');
|
||||
}
|
||||
|
||||
// 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
||||
if (arguments.length > 1) {
|
||||
T = thisArg;
|
||||
}
|
||||
|
||||
// 6. Let A be a new array created as if by the expression new Array(len)
|
||||
// where Array is the standard built-in constructor with that name and
|
||||
// len is the value of len.
|
||||
A = new Array(len);
|
||||
|
||||
// 7. Let k be 0
|
||||
k = 0;
|
||||
|
||||
// 8. Repeat, while k < len
|
||||
while (k < len) {
|
||||
|
||||
var kValue, mappedValue;
|
||||
|
||||
// a. Let Pk be ToString(k).
|
||||
// This is implicit for LHS operands of the in operator
|
||||
// b. Let kPresent be the result of calling the HasProperty internal
|
||||
// method of O with argument Pk.
|
||||
// This step can be combined with c
|
||||
// c. If kPresent is true, then
|
||||
if (k in O) {
|
||||
|
||||
// i. Let kValue be the result of calling the Get internal
|
||||
// method of O with argument Pk.
|
||||
kValue = O[k];
|
||||
|
||||
// ii. Let mappedValue be the result of calling the Call internal
|
||||
// method of callback with T as the this value and argument
|
||||
// list containing kValue, k, and O.
|
||||
mappedValue = callback.call(T, kValue, k, O);
|
||||
|
||||
// iii. Call the DefineOwnProperty internal method of A with arguments
|
||||
// Pk, Property Descriptor
|
||||
// { Value: mappedValue,
|
||||
// Writable: true,
|
||||
// Enumerable: true,
|
||||
// Configurable: true },
|
||||
// and false.
|
||||
|
||||
// In browsers that support Object.defineProperty, use the following:
|
||||
// Object.defineProperty(A, k, {
|
||||
// value: mappedValue,
|
||||
// writable: true,
|
||||
// enumerable: true,
|
||||
// configurable: true
|
||||
// });
|
||||
|
||||
// For best browser support, use the following:
|
||||
A[k] = mappedValue;
|
||||
}
|
||||
// d. Increase k by 1.
|
||||
k++;
|
||||
}
|
||||
|
||||
// 9. return A
|
||||
return A;
|
||||
};
|
||||
}
|
||||
47
node_modules/buffer/test/base64.js
generated
vendored
47
node_modules/buffer/test/base64.js
generated
vendored
@@ -1,47 +0,0 @@
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||
var B = require('../').Buffer
|
||||
var test = require('tape')
|
||||
|
||||
test('base64: ignore whitespace', function (t) {
|
||||
var text = '\n YW9ldQ== '
|
||||
var buf = new B(text, 'base64')
|
||||
t.equal(buf.toString(), 'aoeu')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('base64: strings without padding', function (t) {
|
||||
t.equal((new B('YW9ldQ', 'base64').toString()), 'aoeu')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('base64: newline in utf8 -- should not be an issue', function (t) {
|
||||
t.equal(
|
||||
new B('LS0tCnRpdGxlOiBUaHJlZSBkYXNoZXMgbWFya3MgdGhlIHNwb3QKdGFnczoK', 'base64').toString('utf8'),
|
||||
'---\ntitle: Three dashes marks the spot\ntags:\n'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('base64: newline in base64 -- should get stripped', function (t) {
|
||||
t.equal(
|
||||
new B('LS0tCnRpdGxlOiBUaHJlZSBkYXNoZXMgbWFya3MgdGhlIHNwb3QKdGFnczoK\nICAtIHlhbWwKICAtIGZyb250LW1hdHRlcgogIC0gZGFzaGVzCmV4cGFuZWQt', 'base64').toString('utf8'),
|
||||
'---\ntitle: Three dashes marks the spot\ntags:\n - yaml\n - front-matter\n - dashes\nexpaned-'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('base64: tab characters in base64 - should get stripped', function (t) {
|
||||
t.equal(
|
||||
new B('LS0tCnRpdGxlOiBUaHJlZSBkYXNoZXMgbWFya3MgdGhlIHNwb3QKdGFnczoK\t\t\t\tICAtIHlhbWwKICAtIGZyb250LW1hdHRlcgogIC0gZGFzaGVzCmV4cGFuZWQt', 'base64').toString('utf8'),
|
||||
'---\ntitle: Three dashes marks the spot\ntags:\n - yaml\n - front-matter\n - dashes\nexpaned-'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('base64: invalid non-alphanumeric characters -- should be stripped', function (t) {
|
||||
t.equal(
|
||||
new B('!"#$%&\'()*,.:;<=>?@[\\]^`{|}~', 'base64').toString('utf8'),
|
||||
''
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
91
node_modules/buffer/test/basic.js
generated
vendored
91
node_modules/buffer/test/basic.js
generated
vendored
@@ -1,91 +0,0 @@
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||
var B = require('../').Buffer
|
||||
var test = require('tape')
|
||||
|
||||
test('buf.constructor is Buffer', function (t) {
|
||||
var buf = new B([1, 2])
|
||||
t.strictEqual(buf.constructor, B)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('instanceof Buffer', function (t) {
|
||||
var buf = new B([1, 2])
|
||||
t.ok(buf instanceof B)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('convert to Uint8Array in modern browsers', function (t) {
|
||||
if (B.TYPED_ARRAY_SUPPORT) {
|
||||
var buf = new B([1, 2])
|
||||
var uint8array = new Uint8Array(buf.buffer)
|
||||
t.ok(uint8array instanceof Uint8Array)
|
||||
t.equal(uint8array[0], 1)
|
||||
t.equal(uint8array[1], 2)
|
||||
} else {
|
||||
t.pass('object impl: skipping test')
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('indexes from a string', function (t) {
|
||||
var buf = new B('abc')
|
||||
t.equal(buf[0], 97)
|
||||
t.equal(buf[1], 98)
|
||||
t.equal(buf[2], 99)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('indexes from an array', function (t) {
|
||||
var buf = new B([ 97, 98, 99 ])
|
||||
t.equal(buf[0], 97)
|
||||
t.equal(buf[1], 98)
|
||||
t.equal(buf[2], 99)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('setting index value should modify buffer contents', function (t) {
|
||||
var buf = new B([ 97, 98, 99 ])
|
||||
t.equal(buf[2], 99)
|
||||
t.equal(buf.toString(), 'abc')
|
||||
|
||||
buf[2] += 10
|
||||
t.equal(buf[2], 109)
|
||||
t.equal(buf.toString(), 'abm')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('storing negative number should cast to unsigned', function (t) {
|
||||
var buf = new B(1)
|
||||
|
||||
if (B.TYPED_ARRAY_SUPPORT) {
|
||||
// This does not work with the object implementation -- nothing we can do!
|
||||
buf[0] = -3
|
||||
t.equal(buf[0], 253)
|
||||
}
|
||||
|
||||
buf = new B(1)
|
||||
buf.writeInt8(-3, 0)
|
||||
t.equal(buf[0], 253)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('test that memory is copied from array-like', function (t) {
|
||||
if (B.TYPED_ARRAY_SUPPORT) {
|
||||
var u = new Uint8Array(4)
|
||||
var b = new B(u)
|
||||
b[0] = 1
|
||||
b[1] = 2
|
||||
b[2] = 3
|
||||
b[3] = 4
|
||||
|
||||
t.equal(u[0], 0)
|
||||
t.equal(u[1], 0)
|
||||
t.equal(u[2], 0)
|
||||
t.equal(u[3], 0)
|
||||
} else {
|
||||
t.pass('object impl: skipping test')
|
||||
}
|
||||
|
||||
t.end()
|
||||
})
|
||||
59
node_modules/buffer/test/compare.js
generated
vendored
59
node_modules/buffer/test/compare.js
generated
vendored
@@ -1,59 +0,0 @@
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||
var B = require('../').Buffer
|
||||
var test = require('tape')
|
||||
|
||||
test('buffer.compare', function (t) {
|
||||
var b = new B(1).fill('a')
|
||||
var c = new B(1).fill('c')
|
||||
var d = new B(2).fill('aa')
|
||||
|
||||
t.equal(b.compare(c), -1)
|
||||
t.equal(c.compare(d), 1)
|
||||
t.equal(d.compare(b), 1)
|
||||
t.equal(b.compare(d), -1)
|
||||
|
||||
// static method
|
||||
t.equal(B.compare(b, c), -1)
|
||||
t.equal(B.compare(c, d), 1)
|
||||
t.equal(B.compare(d, b), 1)
|
||||
t.equal(B.compare(b, d), -1)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('buffer.compare argument validation', function (t) {
|
||||
t.throws(function () {
|
||||
var b = new B(1)
|
||||
B.compare(b, 'abc')
|
||||
})
|
||||
|
||||
t.throws(function () {
|
||||
var b = new B(1)
|
||||
B.compare('abc', b)
|
||||
})
|
||||
|
||||
t.throws(function () {
|
||||
var b = new B(1)
|
||||
b.compare('abc')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('buffer.equals', function (t) {
|
||||
var b = new B(5).fill('abcdf')
|
||||
var c = new B(5).fill('abcdf')
|
||||
var d = new B(5).fill('abcde')
|
||||
var e = new B(6).fill('abcdef')
|
||||
|
||||
t.ok(b.equals(c))
|
||||
t.ok(!c.equals(d))
|
||||
t.ok(!d.equals(e))
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('buffer.equals argument validation', function (t) {
|
||||
t.throws(function () {
|
||||
var b = new B(1)
|
||||
b.equals('abc')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
154
node_modules/buffer/test/constructor.js
generated
vendored
154
node_modules/buffer/test/constructor.js
generated
vendored
@@ -1,154 +0,0 @@
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||
var B = require('../').Buffer
|
||||
var test = require('tape')
|
||||
|
||||
test('new buffer from array', function (t) {
|
||||
t.equal(
|
||||
new B([1, 2, 3]).toString(),
|
||||
'\u0001\u0002\u0003'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('new buffer from array w/ negatives', function (t) {
|
||||
t.equal(
|
||||
new B([-1, -2, -3]).toString('hex'),
|
||||
'fffefd'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('new buffer from array with mixed signed input', function (t) {
|
||||
t.equal(
|
||||
new B([-255, 255, -128, 128, 512, -512, 511, -511]).toString('hex'),
|
||||
'01ff80800000ff01'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('new buffer from string', function (t) {
|
||||
t.equal(
|
||||
new B('hey', 'utf8').toString(),
|
||||
'hey'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('new buffer from buffer', function (t) {
|
||||
var b1 = new B('asdf')
|
||||
var b2 = new B(b1)
|
||||
t.equal(b1.toString('hex'), b2.toString('hex'))
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('new buffer from Uint8Array', function (t) {
|
||||
if (typeof Uint8Array !== 'undefined') {
|
||||
var b1 = new Uint8Array([0, 1, 2, 3])
|
||||
var b2 = new B(b1)
|
||||
t.equal(b1.length, b2.length)
|
||||
t.equal(b1[0], 0)
|
||||
t.equal(b1[1], 1)
|
||||
t.equal(b1[2], 2)
|
||||
t.equal(b1[3], 3)
|
||||
t.equal(b1[4], undefined)
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('new buffer from Uint16Array', function (t) {
|
||||
if (typeof Uint16Array !== 'undefined') {
|
||||
var b1 = new Uint16Array([0, 1, 2, 3])
|
||||
var b2 = new B(b1)
|
||||
t.equal(b1.length, b2.length)
|
||||
t.equal(b1[0], 0)
|
||||
t.equal(b1[1], 1)
|
||||
t.equal(b1[2], 2)
|
||||
t.equal(b1[3], 3)
|
||||
t.equal(b1[4], undefined)
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('new buffer from Uint32Array', function (t) {
|
||||
if (typeof Uint32Array !== 'undefined') {
|
||||
var b1 = new Uint32Array([0, 1, 2, 3])
|
||||
var b2 = new B(b1)
|
||||
t.equal(b1.length, b2.length)
|
||||
t.equal(b1[0], 0)
|
||||
t.equal(b1[1], 1)
|
||||
t.equal(b1[2], 2)
|
||||
t.equal(b1[3], 3)
|
||||
t.equal(b1[4], undefined)
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('new buffer from Int16Array', function (t) {
|
||||
if (typeof Int16Array !== 'undefined') {
|
||||
var b1 = new Int16Array([0, 1, 2, 3])
|
||||
var b2 = new B(b1)
|
||||
t.equal(b1.length, b2.length)
|
||||
t.equal(b1[0], 0)
|
||||
t.equal(b1[1], 1)
|
||||
t.equal(b1[2], 2)
|
||||
t.equal(b1[3], 3)
|
||||
t.equal(b1[4], undefined)
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('new buffer from Int32Array', function (t) {
|
||||
if (typeof Int32Array !== 'undefined') {
|
||||
var b1 = new Int32Array([0, 1, 2, 3])
|
||||
var b2 = new B(b1)
|
||||
t.equal(b1.length, b2.length)
|
||||
t.equal(b1[0], 0)
|
||||
t.equal(b1[1], 1)
|
||||
t.equal(b1[2], 2)
|
||||
t.equal(b1[3], 3)
|
||||
t.equal(b1[4], undefined)
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('new buffer from Float32Array', function (t) {
|
||||
if (typeof Float32Array !== 'undefined') {
|
||||
var b1 = new Float32Array([0, 1, 2, 3])
|
||||
var b2 = new B(b1)
|
||||
t.equal(b1.length, b2.length)
|
||||
t.equal(b1[0], 0)
|
||||
t.equal(b1[1], 1)
|
||||
t.equal(b1[2], 2)
|
||||
t.equal(b1[3], 3)
|
||||
t.equal(b1[4], undefined)
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('new buffer from Float64Array', function (t) {
|
||||
if (typeof Float64Array !== 'undefined') {
|
||||
var b1 = new Float64Array([0, 1, 2, 3])
|
||||
var b2 = new B(b1)
|
||||
t.equal(b1.length, b2.length)
|
||||
t.equal(b1[0], 0)
|
||||
t.equal(b1[1], 1)
|
||||
t.equal(b1[2], 2)
|
||||
t.equal(b1[3], 3)
|
||||
t.equal(b1[4], undefined)
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('new buffer from buffer.toJSON() output', function (t) {
|
||||
if (typeof JSON === 'undefined') {
|
||||
// ie6, ie7 lack support
|
||||
t.end()
|
||||
return
|
||||
}
|
||||
var buf = new B('test')
|
||||
var json = JSON.stringify(buf)
|
||||
var obj = JSON.parse(json)
|
||||
var copy = new B(obj)
|
||||
t.ok(buf.equals(copy))
|
||||
t.end()
|
||||
})
|
||||
19
node_modules/buffer/test/deprecated.js
generated
vendored
19
node_modules/buffer/test/deprecated.js
generated
vendored
@@ -1,19 +0,0 @@
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||
var B = require('../').Buffer
|
||||
var test = require('tape')
|
||||
|
||||
test('.get (deprecated)', function (t) {
|
||||
var b = new B([7, 42])
|
||||
t.equal(b.get(0), 7)
|
||||
t.equal(b.get(1), 42)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('.set (deprecated)', function (t) {
|
||||
var b = new B(2)
|
||||
b.set(7, 0)
|
||||
b.set(42, 1)
|
||||
t.equal(b[0], 7)
|
||||
t.equal(b[1], 42)
|
||||
t.end()
|
||||
})
|
||||
132
node_modules/buffer/test/from-string.js
generated
vendored
132
node_modules/buffer/test/from-string.js
generated
vendored
@@ -1,132 +0,0 @@
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||
var B = require('../').Buffer
|
||||
var test = require('tape')
|
||||
|
||||
test('detect utf16 surrogate pairs', function (t) {
|
||||
var text = '\uD83D\uDE38' + '\uD83D\uDCAD' + '\uD83D\uDC4D'
|
||||
var buf = new B(text)
|
||||
t.equal(text, buf.toString())
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('detect utf16 surrogate pairs over U+20000 until U+10FFFF', function (t) {
|
||||
var text = '\uD842\uDFB7' + '\uD93D\uDCAD' + '\uDBFF\uDFFF'
|
||||
var buf = new B(text)
|
||||
t.equal(text, buf.toString())
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('replace orphaned utf16 surrogate lead code point', function (t) {
|
||||
var text = '\uD83D\uDE38' + '\uD83D' + '\uD83D\uDC4D'
|
||||
var buf = new B(text)
|
||||
t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0xef, 0xbf, 0xbd, 0xf0, 0x9f, 0x91, 0x8d ]))
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('replace orphaned utf16 surrogate trail code point', function (t) {
|
||||
var text = '\uD83D\uDE38' + '\uDCAD' + '\uD83D\uDC4D'
|
||||
var buf = new B(text)
|
||||
t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0xef, 0xbf, 0xbd, 0xf0, 0x9f, 0x91, 0x8d ]))
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('do not write partial utf16 code units', function (t) {
|
||||
var f = new B([0, 0, 0, 0, 0])
|
||||
t.equal(f.length, 5)
|
||||
var size = f.write('あいうえお', 'utf16le')
|
||||
t.equal(size, 4)
|
||||
t.deepEqual(f, new B([0x42, 0x30, 0x44, 0x30, 0x00]))
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('handle partial utf16 code points when encoding to utf8 the way node does', function (t) {
|
||||
var text = '\uD83D\uDE38' + '\uD83D\uDC4D'
|
||||
|
||||
var buf = new B(8)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0xf0, 0x9f, 0x91, 0x8d ]))
|
||||
|
||||
buf = new B(7)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0x00, 0x00, 0x00 ]))
|
||||
|
||||
buf = new B(6)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0x00, 0x00 ]))
|
||||
|
||||
buf = new B(5)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8, 0x00 ]))
|
||||
|
||||
buf = new B(4)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0xf0, 0x9f, 0x98, 0xb8 ]))
|
||||
|
||||
buf = new B(3)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0x00, 0x00, 0x00 ]))
|
||||
|
||||
buf = new B(2)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0x00, 0x00 ]))
|
||||
|
||||
buf = new B(1)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0x00 ]))
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('handle invalid utf16 code points when encoding to utf8 the way node does', function (t) {
|
||||
var text = 'a' + '\uDE38\uD83D' + 'b'
|
||||
|
||||
var buf = new B(8)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0x61, 0xef, 0xbf, 0xbd, 0xef, 0xbf, 0xbd, 0x62 ]))
|
||||
|
||||
buf = new B(7)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0x61, 0xef, 0xbf, 0xbd, 0xef, 0xbf, 0xbd ]))
|
||||
|
||||
buf = new B(6)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0x61, 0xef, 0xbf, 0xbd, 0x00, 0x00 ]))
|
||||
|
||||
buf = new B(5)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0x61, 0xef, 0xbf, 0xbd, 0x00 ]))
|
||||
|
||||
buf = new B(4)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0x61, 0xef, 0xbf, 0xbd ]))
|
||||
|
||||
buf = new B(3)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0x61, 0x00, 0x00 ]))
|
||||
|
||||
buf = new B(2)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0x61, 0x00 ]))
|
||||
|
||||
buf = new B(1)
|
||||
buf.fill(0)
|
||||
buf.write(text)
|
||||
t.deepEqual(buf, new B([ 0x61 ]))
|
||||
|
||||
t.end()
|
||||
})
|
||||
127
node_modules/buffer/test/methods.js
generated
vendored
127
node_modules/buffer/test/methods.js
generated
vendored
@@ -1,127 +0,0 @@
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||
var B = require('../').Buffer
|
||||
var test = require('tape')
|
||||
|
||||
test('buffer.toJSON', function (t) {
|
||||
var data = [1, 2, 3, 4]
|
||||
t.deepEqual(
|
||||
new B(data).toJSON(),
|
||||
{ type: 'Buffer', data: [ 1, 2, 3, 4 ] }
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('buffer.copy', function (t) {
|
||||
// copied from nodejs.org example
|
||||
var buf1 = new B(26)
|
||||
var buf2 = new B(26)
|
||||
|
||||
for (var i = 0; i < 26; i++) {
|
||||
buf1[i] = i + 97 // 97 is ASCII a
|
||||
buf2[i] = 33 // ASCII !
|
||||
}
|
||||
|
||||
buf1.copy(buf2, 8, 16, 20)
|
||||
|
||||
t.equal(
|
||||
buf2.toString('ascii', 0, 25),
|
||||
'!!!!!!!!qrst!!!!!!!!!!!!!'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('test offset returns are correct', function (t) {
|
||||
var b = new B(16)
|
||||
t.equal(4, b.writeUInt32LE(0, 0))
|
||||
t.equal(6, b.writeUInt16LE(0, 4))
|
||||
t.equal(7, b.writeUInt8(0, 6))
|
||||
t.equal(8, b.writeInt8(0, 7))
|
||||
t.equal(16, b.writeDoubleLE(0, 8))
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('concat() a varying number of buffers', function (t) {
|
||||
var zero = []
|
||||
var one = [ new B('asdf') ]
|
||||
var long = []
|
||||
for (var i = 0; i < 10; i++) {
|
||||
long.push(new B('asdf'))
|
||||
}
|
||||
|
||||
var flatZero = B.concat(zero)
|
||||
var flatOne = B.concat(one)
|
||||
var flatLong = B.concat(long)
|
||||
var flatLongLen = B.concat(long, 40)
|
||||
|
||||
t.equal(flatZero.length, 0)
|
||||
t.equal(flatOne.toString(), 'asdf')
|
||||
t.deepEqual(flatOne, one[0])
|
||||
t.equal(flatLong.toString(), (new Array(10 + 1).join('asdf')))
|
||||
t.equal(flatLongLen.toString(), (new Array(10 + 1).join('asdf')))
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('fill', function (t) {
|
||||
var b = new B(10)
|
||||
b.fill(2)
|
||||
t.equal(b.toString('hex'), '02020202020202020202')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('fill (string)', function (t) {
|
||||
var b = new B(10)
|
||||
b.fill('abc')
|
||||
t.equal(b.toString(), 'abcabcabca')
|
||||
b.fill('է')
|
||||
t.equal(b.toString(), 'էէէէէ')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('copy() empty buffer with sourceEnd=0', function (t) {
|
||||
var source = new B([42])
|
||||
var destination = new B([43])
|
||||
source.copy(destination, 0, 0, 0)
|
||||
t.equal(destination.readUInt8(0), 43)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('copy() after slice()', function (t) {
|
||||
var source = new B(200)
|
||||
var dest = new B(200)
|
||||
var expected = new B(200)
|
||||
for (var i = 0; i < 200; i++) {
|
||||
source[i] = i
|
||||
dest[i] = 0
|
||||
}
|
||||
|
||||
source.slice(2).copy(dest)
|
||||
source.copy(expected, 0, 2)
|
||||
t.deepEqual(dest, expected)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('copy() ascending', function (t) {
|
||||
var b = new B('abcdefghij')
|
||||
b.copy(b, 0, 3, 10)
|
||||
t.equal(b.toString(), 'defghijhij')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('copy() descending', function (t) {
|
||||
var b = new B('abcdefghij')
|
||||
b.copy(b, 3, 0, 7)
|
||||
t.equal(b.toString(), 'abcabcdefg')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('buffer.slice sets indexes', function (t) {
|
||||
t.equal((new B('hallo')).slice(0, 5).toString(), 'hallo')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('buffer.slice out of range', function (t) {
|
||||
t.plan(2)
|
||||
t.equal((new B('hallo')).slice(0, 10).toString(), 'hallo')
|
||||
t.equal((new B('hallo')).slice(10, 2).toString(), '')
|
||||
t.end()
|
||||
})
|
||||
1
node_modules/buffer/test/node-es6/README.txt
generated
vendored
1
node_modules/buffer/test/node-es6/README.txt
generated
vendored
@@ -1 +0,0 @@
|
||||
node buffer tests that require ES6 (e.g. "for..of" construct)
|
||||
49
node_modules/buffer/test/node-es6/test-buffer-arraybuffer.js
generated
vendored
49
node_modules/buffer/test/node-es6/test-buffer-arraybuffer.js
generated
vendored
@@ -1,49 +0,0 @@
|
||||
'use strict';
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;
|
||||
var Buffer = require('../../').Buffer;
|
||||
|
||||
var common = {};
|
||||
var assert = require('assert');
|
||||
|
||||
var Buffer = require('../../').Buffer;
|
||||
var LENGTH = 16;
|
||||
|
||||
var ab = new ArrayBuffer(LENGTH);
|
||||
var dv = new DataView(ab);
|
||||
var ui = new Uint8Array(ab);
|
||||
var buf = new Buffer(ab);
|
||||
|
||||
|
||||
assert.ok(Buffer.isBuffer(buf));
|
||||
// For backwards compatibility of old .parent property test that if buf is not
|
||||
// a slice then .parent should be undefined.
|
||||
assert.equal(buf.parent, undefined);
|
||||
assert.equal(buf.buffer, ab);
|
||||
assert.equal(buf.length, ab.byteLength);
|
||||
|
||||
|
||||
buf.fill(0xC);
|
||||
for (var i = 0; i < LENGTH; i++) {
|
||||
assert.equal(ui[i], 0xC);
|
||||
ui[i] = 0xF;
|
||||
assert.equal(buf[i], 0xF);
|
||||
}
|
||||
|
||||
buf.writeUInt32LE(0xF00, 0);
|
||||
buf.writeUInt32BE(0xB47, 4);
|
||||
buf.writeDoubleLE(3.1415, 8);
|
||||
|
||||
assert.equal(dv.getUint32(0, true), 0xF00);
|
||||
assert.equal(dv.getUint32(4), 0xB47);
|
||||
assert.equal(dv.getFloat64(8, true), 3.1415);
|
||||
|
||||
|
||||
// Now test protecting users from doing stupid things
|
||||
|
||||
assert.throws(function() {
|
||||
function AB() { }
|
||||
AB.__proto__ = ArrayBuffer;
|
||||
AB.prototype.__proto__ = ArrayBuffer.prototype;
|
||||
new Buffer(new AB());
|
||||
}, TypeError);
|
||||
|
||||
65
node_modules/buffer/test/node-es6/test-buffer-iterator.js
generated
vendored
65
node_modules/buffer/test/node-es6/test-buffer-iterator.js
generated
vendored
@@ -1,65 +0,0 @@
|
||||
'use strict';
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;
|
||||
var Buffer = require('../../').Buffer;
|
||||
var common = {};
|
||||
var assert = require('assert');
|
||||
|
||||
var buffer = new Buffer([1, 2, 3, 4, 5]);
|
||||
var arr;
|
||||
var b;
|
||||
|
||||
// buffers should be iterable
|
||||
|
||||
arr = [];
|
||||
|
||||
for (b of buffer)
|
||||
arr.push(b);
|
||||
|
||||
assert.deepEqual(arr, [1, 2, 3, 4, 5]);
|
||||
|
||||
|
||||
// buffer iterators should be iterable
|
||||
|
||||
arr = [];
|
||||
|
||||
for (b of buffer[Symbol.iterator]())
|
||||
arr.push(b);
|
||||
|
||||
assert.deepEqual(arr, [1, 2, 3, 4, 5]);
|
||||
|
||||
|
||||
// buffer#values() should return iterator for values
|
||||
|
||||
arr = [];
|
||||
|
||||
for (b of buffer.values())
|
||||
arr.push(b);
|
||||
|
||||
assert.deepEqual(arr, [1, 2, 3, 4, 5]);
|
||||
|
||||
|
||||
// buffer#keys() should return iterator for keys
|
||||
|
||||
arr = [];
|
||||
|
||||
for (b of buffer.keys())
|
||||
arr.push(b);
|
||||
|
||||
assert.deepEqual(arr, [0, 1, 2, 3, 4]);
|
||||
|
||||
|
||||
// buffer#entries() should return iterator for entries
|
||||
|
||||
arr = [];
|
||||
|
||||
for (var b of buffer.entries())
|
||||
arr.push(b);
|
||||
|
||||
assert.deepEqual(arr, [
|
||||
[0, 1],
|
||||
[1, 2],
|
||||
[2, 3],
|
||||
[3, 4],
|
||||
[4, 5]
|
||||
]);
|
||||
|
||||
1
node_modules/buffer/test/node/README.txt
generated
vendored
1
node_modules/buffer/test/node/README.txt
generated
vendored
@@ -1 +0,0 @@
|
||||
node core buffer tests
|
||||
28
node_modules/buffer/test/node/test-buffer-ascii.js
generated
vendored
28
node_modules/buffer/test/node/test-buffer-ascii.js
generated
vendored
@@ -1,28 +0,0 @@
|
||||
'use strict';
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;
|
||||
var Buffer = require('../../').Buffer;
|
||||
var common = {};
|
||||
var assert = require('assert');
|
||||
|
||||
// ASCII conversion in node.js simply masks off the high bits,
|
||||
// it doesn't do transliteration.
|
||||
assert.equal(Buffer('hérité').toString('ascii'), 'hC)ritC)');
|
||||
|
||||
// 71 characters, 78 bytes. The ’ character is a triple-byte sequence.
|
||||
var input = 'C’est, graphiquement, la réunion d’un accent aigu ' +
|
||||
'et d’un accent grave.';
|
||||
|
||||
var expected = 'Cb\u0000\u0019est, graphiquement, la rC)union ' +
|
||||
'db\u0000\u0019un accent aigu et db\u0000\u0019un ' +
|
||||
'accent grave.';
|
||||
|
||||
var buf = Buffer(input);
|
||||
|
||||
for (var i = 0; i < expected.length; ++i) {
|
||||
assert.equal(buf.slice(i).toString('ascii'), expected.slice(i));
|
||||
|
||||
// Skip remainder of multi-byte sequence.
|
||||
if (input.charCodeAt(i) > 65535) ++i;
|
||||
if (input.charCodeAt(i) > 127) ++i;
|
||||
}
|
||||
|
||||
49
node_modules/buffer/test/node/test-buffer-bytelength.js
generated
vendored
49
node_modules/buffer/test/node/test-buffer-bytelength.js
generated
vendored
@@ -1,49 +0,0 @@
|
||||
'use strict';
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;
|
||||
var Buffer = require('../../').Buffer;
|
||||
|
||||
var common = {};
|
||||
var assert = require('assert');
|
||||
var Buffer = require('../../').Buffer;
|
||||
|
||||
// coerce values to string
|
||||
assert.equal(Buffer.byteLength(32, 'raw'), 2);
|
||||
assert.equal(Buffer.byteLength(NaN, 'utf8'), 3);
|
||||
assert.equal(Buffer.byteLength({}, 'raws'), 15);
|
||||
assert.equal(Buffer.byteLength(), 9);
|
||||
|
||||
// special case: zero length string
|
||||
assert.equal(Buffer.byteLength('', 'ascii'), 0);
|
||||
assert.equal(Buffer.byteLength('', 'HeX'), 0);
|
||||
|
||||
// utf8
|
||||
assert.equal(Buffer.byteLength('∑éllö wørl∂!', 'utf-8'), 19);
|
||||
assert.equal(Buffer.byteLength('κλμνξο', 'utf8'), 12);
|
||||
assert.equal(Buffer.byteLength('挵挶挷挸挹', 'utf-8'), 15);
|
||||
assert.equal(Buffer.byteLength('𠝹𠱓𠱸', 'UTF8'), 12);
|
||||
// without an encoding, utf8 should be assumed
|
||||
assert.equal(Buffer.byteLength('hey there'), 9);
|
||||
assert.equal(Buffer.byteLength('𠱸挶νξ#xx :)'), 17);
|
||||
assert.equal(Buffer.byteLength('hello world', ''), 11);
|
||||
// it should also be assumed with unrecognized encoding
|
||||
assert.equal(Buffer.byteLength('hello world', 'abc'), 11);
|
||||
assert.equal(Buffer.byteLength('ßœ∑≈', 'unkn0wn enc0ding'), 10);
|
||||
|
||||
// base64
|
||||
assert.equal(Buffer.byteLength('aGVsbG8gd29ybGQ=', 'base64'), 11);
|
||||
assert.equal(Buffer.byteLength('bm9kZS5qcyByb2NrcyE=', 'base64'), 14);
|
||||
assert.equal(Buffer.byteLength('aGkk', 'base64'), 3);
|
||||
assert.equal(Buffer.byteLength('bHNrZGZsa3NqZmtsc2xrZmFqc2RsZmtqcw==',
|
||||
'base64'), 25);
|
||||
// special padding
|
||||
assert.equal(Buffer.byteLength('aaa=', 'base64'), 2);
|
||||
assert.equal(Buffer.byteLength('aaaa==', 'base64'), 3);
|
||||
|
||||
assert.equal(Buffer.byteLength('Il était tué'), 14);
|
||||
assert.equal(Buffer.byteLength('Il était tué', 'utf8'), 14);
|
||||
assert.equal(Buffer.byteLength('Il était tué', 'ascii'), 12);
|
||||
assert.equal(Buffer.byteLength('Il était tué', 'binary'), 12);
|
||||
['ucs2', 'ucs-2', 'utf16le', 'utf-16le'].forEach(function(encoding) {
|
||||
assert.equal(24, Buffer.byteLength('Il était tué', encoding));
|
||||
});
|
||||
|
||||
30
node_modules/buffer/test/node/test-buffer-concat.js
generated
vendored
30
node_modules/buffer/test/node/test-buffer-concat.js
generated
vendored
@@ -1,30 +0,0 @@
|
||||
'use strict';
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;
|
||||
var Buffer = require('../../').Buffer;
|
||||
var common = {};
|
||||
var assert = require('assert');
|
||||
|
||||
var zero = [];
|
||||
var one = [ new Buffer('asdf') ];
|
||||
var long = [];
|
||||
for (var i = 0; i < 10; i++) long.push(new Buffer('asdf'));
|
||||
|
||||
var flatZero = Buffer.concat(zero);
|
||||
var flatOne = Buffer.concat(one);
|
||||
var flatLong = Buffer.concat(long);
|
||||
var flatLongLen = Buffer.concat(long, 40);
|
||||
|
||||
assert(flatZero.length === 0);
|
||||
assert(flatOne.toString() === 'asdf');
|
||||
// A special case where concat used to return the first item,
|
||||
// if the length is one. This check is to make sure that we don't do that.
|
||||
assert(flatOne !== one[0]);
|
||||
assert(flatLong.toString() === (new Array(10 + 1).join('asdf')));
|
||||
assert(flatLongLen.toString() === (new Array(10 + 1).join('asdf')));
|
||||
|
||||
assert.throws(function() {
|
||||
Buffer.concat([42]);
|
||||
}, TypeError);
|
||||
|
||||
// console.log('ok');
|
||||
|
||||
79
node_modules/buffer/test/node/test-buffer-indexof.js
generated
vendored
79
node_modules/buffer/test/node/test-buffer-indexof.js
generated
vendored
@@ -1,79 +0,0 @@
|
||||
'use strict';
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;
|
||||
var Buffer = require('../../').Buffer;
|
||||
var common = {};
|
||||
var assert = require('assert');
|
||||
|
||||
var Buffer = require('../../').Buffer;
|
||||
|
||||
var b = new Buffer('abcdef');
|
||||
var buf_a = new Buffer('a');
|
||||
var buf_bc = new Buffer('bc');
|
||||
var buf_f = new Buffer('f');
|
||||
var buf_z = new Buffer('z');
|
||||
var buf_empty = new Buffer('');
|
||||
|
||||
assert.equal(b.indexOf('a'), 0);
|
||||
assert.equal(b.indexOf('a', 1), -1);
|
||||
assert.equal(b.indexOf('a', -1), -1);
|
||||
assert.equal(b.indexOf('a', -4), -1);
|
||||
assert.equal(b.indexOf('a', -b.length), 0);
|
||||
assert.equal(b.indexOf('a', NaN), 0);
|
||||
assert.equal(b.indexOf('a', -Infinity), 0);
|
||||
assert.equal(b.indexOf('a', Infinity), -1);
|
||||
assert.equal(b.indexOf('bc'), 1);
|
||||
assert.equal(b.indexOf('bc', 2), -1);
|
||||
assert.equal(b.indexOf('bc', -1), -1);
|
||||
assert.equal(b.indexOf('bc', -3), -1);
|
||||
assert.equal(b.indexOf('bc', -5), 1);
|
||||
assert.equal(b.indexOf('bc', NaN), 1);
|
||||
assert.equal(b.indexOf('bc', -Infinity), 1);
|
||||
assert.equal(b.indexOf('bc', Infinity), -1);
|
||||
assert.equal(b.indexOf('f'), b.length - 1);
|
||||
assert.equal(b.indexOf('z'), -1);
|
||||
assert.equal(b.indexOf(''), -1);
|
||||
assert.equal(b.indexOf('', 1), -1);
|
||||
assert.equal(b.indexOf('', b.length + 1), -1);
|
||||
assert.equal(b.indexOf('', Infinity), -1);
|
||||
assert.equal(b.indexOf(buf_a), 0);
|
||||
assert.equal(b.indexOf(buf_a, 1), -1);
|
||||
assert.equal(b.indexOf(buf_a, -1), -1);
|
||||
assert.equal(b.indexOf(buf_a, -4), -1);
|
||||
assert.equal(b.indexOf(buf_a, -b.length), 0);
|
||||
assert.equal(b.indexOf(buf_a, NaN), 0);
|
||||
assert.equal(b.indexOf(buf_a, -Infinity), 0);
|
||||
assert.equal(b.indexOf(buf_a, Infinity), -1);
|
||||
assert.equal(b.indexOf(buf_bc), 1);
|
||||
assert.equal(b.indexOf(buf_bc, 2), -1);
|
||||
assert.equal(b.indexOf(buf_bc, -1), -1);
|
||||
assert.equal(b.indexOf(buf_bc, -3), -1);
|
||||
assert.equal(b.indexOf(buf_bc, -5), 1);
|
||||
assert.equal(b.indexOf(buf_bc, NaN), 1);
|
||||
assert.equal(b.indexOf(buf_bc, -Infinity), 1);
|
||||
assert.equal(b.indexOf(buf_bc, Infinity), -1);
|
||||
assert.equal(b.indexOf(buf_f), b.length - 1);
|
||||
assert.equal(b.indexOf(buf_z), -1);
|
||||
assert.equal(b.indexOf(buf_empty), -1);
|
||||
assert.equal(b.indexOf(buf_empty, 1), -1);
|
||||
assert.equal(b.indexOf(buf_empty, b.length + 1), -1);
|
||||
assert.equal(b.indexOf(buf_empty, Infinity), -1);
|
||||
assert.equal(b.indexOf(0x61), 0);
|
||||
assert.equal(b.indexOf(0x61, 1), -1);
|
||||
assert.equal(b.indexOf(0x61, -1), -1);
|
||||
assert.equal(b.indexOf(0x61, -4), -1);
|
||||
assert.equal(b.indexOf(0x61, -b.length), 0);
|
||||
assert.equal(b.indexOf(0x61, NaN), 0);
|
||||
assert.equal(b.indexOf(0x61, -Infinity), 0);
|
||||
assert.equal(b.indexOf(0x61, Infinity), -1);
|
||||
assert.equal(b.indexOf(0x0), -1);
|
||||
|
||||
assert.throws(function() {
|
||||
b.indexOf(function() { });
|
||||
});
|
||||
assert.throws(function() {
|
||||
b.indexOf({});
|
||||
});
|
||||
assert.throws(function() {
|
||||
b.indexOf([]);
|
||||
});
|
||||
|
||||
41
node_modules/buffer/test/node/test-buffer-inspect.js
generated
vendored
41
node_modules/buffer/test/node/test-buffer-inspect.js
generated
vendored
@@ -1,41 +0,0 @@
|
||||
'use strict';
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false;
|
||||
var Buffer = require('../../').Buffer;
|
||||
var common = {};
|
||||
var assert = require('assert');
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var buffer = require('../../');
|
||||
|
||||
buffer.INSPECT_MAX_BYTES = 2;
|
||||
|
||||
var b = new Buffer(4);
|
||||
b.fill('1234');
|
||||
|
||||
var s = new buffer.SlowBuffer(4);
|
||||
s.fill('1234');
|
||||
|
||||
var expected = '<Buffer 31 32 ... >';
|
||||
|
||||
assert.strictEqual(util.inspect(b), expected);
|
||||
assert.strictEqual(util.inspect(s), expected);
|
||||
|
||||
b = new Buffer(2);
|
||||
b.fill('12');
|
||||
|
||||
s = new buffer.SlowBuffer(2);
|
||||
s.fill('12');
|
||||
|
||||
expected = '<Buffer 31 32>';
|
||||
|
||||
assert.strictEqual(util.inspect(b), expected);
|
||||
assert.strictEqual(util.inspect(s), expected);
|
||||
|
||||
buffer.INSPECT_MAX_BYTES = Infinity;
|
||||
|
||||
assert.doesNotThrow(function() {
|
||||
assert.strictEqual(util.inspect(b), expected);
|
||||
assert.strictEqual(util.inspect(s), expected);
|
||||
});
|
||||
|
||||
1194
node_modules/buffer/test/node/test-buffer.js
generated
vendored
1194
node_modules/buffer/test/node/test-buffer.js
generated
vendored
File diff suppressed because it is too large
Load Diff
37
node_modules/buffer/test/slice.js
generated
vendored
37
node_modules/buffer/test/slice.js
generated
vendored
@@ -1,37 +0,0 @@
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||
var B = require('../').Buffer
|
||||
var test = require('tape')
|
||||
|
||||
test('modifying buffer created by .slice() modifies original memory', function (t) {
|
||||
if (!B.TYPED_ARRAY_SUPPORT) return t.end()
|
||||
|
||||
var buf1 = new B(26)
|
||||
for (var i = 0; i < 26; i++) {
|
||||
buf1[i] = i + 97 // 97 is ASCII a
|
||||
}
|
||||
|
||||
var buf2 = buf1.slice(0, 3)
|
||||
t.equal(buf2.toString('ascii', 0, buf2.length), 'abc')
|
||||
|
||||
buf2[0] = '!'.charCodeAt(0)
|
||||
t.equal(buf1.toString('ascii', 0, buf2.length), '!bc')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('modifying parent buffer modifies .slice() buffer\'s memory', function (t) {
|
||||
if (!B.TYPED_ARRAY_SUPPORT) return t.end()
|
||||
|
||||
var buf1 = new B(26)
|
||||
for (var i = 0; i < 26; i++) {
|
||||
buf1[i] = i + 97 // 97 is ASCII a
|
||||
}
|
||||
|
||||
var buf2 = buf1.slice(0, 3)
|
||||
t.equal(buf2.toString('ascii', 0, buf2.length), 'abc')
|
||||
|
||||
buf1[0] = '!'.charCodeAt(0)
|
||||
t.equal(buf2.toString('ascii', 0, buf2.length), '!bc')
|
||||
|
||||
t.end()
|
||||
})
|
||||
31
node_modules/buffer/test/static.js
generated
vendored
31
node_modules/buffer/test/static.js
generated
vendored
@@ -1,31 +0,0 @@
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||
var B = require('../').Buffer
|
||||
var test = require('tape')
|
||||
|
||||
test('Buffer.isEncoding', function (t) {
|
||||
t.equal(B.isEncoding('HEX'), true)
|
||||
t.equal(B.isEncoding('hex'), true)
|
||||
t.equal(B.isEncoding('bad'), false)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Buffer.isBuffer', function (t) {
|
||||
t.equal(B.isBuffer(new B('hey', 'utf8')), true)
|
||||
t.equal(B.isBuffer(new B([1, 2, 3], 'utf8')), true)
|
||||
t.equal(B.isBuffer('hey'), false)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Buffer.toArrayBuffer', function (t) {
|
||||
var data = [1, 2, 3, 4, 5, 6, 7, 8]
|
||||
if (typeof Uint8Array !== 'undefined') {
|
||||
var result = new B(data).toArrayBuffer()
|
||||
var expected = new Uint8Array(data).buffer
|
||||
for (var i = 0; i < expected.byteLength; i++) {
|
||||
t.equal(result[i], expected[i])
|
||||
}
|
||||
} else {
|
||||
t.pass('No toArrayBuffer() method provided in old browsers')
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
233
node_modules/buffer/test/to-string.js
generated
vendored
233
node_modules/buffer/test/to-string.js
generated
vendored
@@ -1,233 +0,0 @@
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||
var B = require('../').Buffer
|
||||
var test = require('tape')
|
||||
|
||||
test('utf8 buffer to base64', function (t) {
|
||||
t.equal(
|
||||
new B('Ձאab', 'utf8').toString('base64'),
|
||||
'1YHXkGFi'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('utf8 buffer to hex', function (t) {
|
||||
t.equal(
|
||||
new B('Ձאab', 'utf8').toString('hex'),
|
||||
'd581d7906162'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('utf8 to utf8', function (t) {
|
||||
t.equal(
|
||||
new B('öäüõÖÄÜÕ', 'utf8').toString('utf8'),
|
||||
'öäüõÖÄÜÕ'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('utf16le to utf16', function (t) {
|
||||
t.equal(
|
||||
new B(new B('abcd', 'utf8').toString('utf16le'), 'utf16le').toString('utf8'),
|
||||
'abcd'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('utf16le to hex', function (t) {
|
||||
t.equal(
|
||||
new B('abcd', 'utf16le').toString('hex'),
|
||||
'6100620063006400'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('ascii buffer to base64', function (t) {
|
||||
t.equal(
|
||||
new B('123456!@#$%^', 'ascii').toString('base64'),
|
||||
'MTIzNDU2IUAjJCVe'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('ascii buffer to hex', function (t) {
|
||||
t.equal(
|
||||
new B('123456!@#$%^', 'ascii').toString('hex'),
|
||||
'31323334353621402324255e'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('base64 buffer to utf8', function (t) {
|
||||
t.equal(
|
||||
new B('1YHXkGFi', 'base64').toString('utf8'),
|
||||
'Ձאab'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('hex buffer to utf8', function (t) {
|
||||
t.equal(
|
||||
new B('d581d7906162', 'hex').toString('utf8'),
|
||||
'Ձאab'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('base64 buffer to ascii', function (t) {
|
||||
t.equal(
|
||||
new B('MTIzNDU2IUAjJCVe', 'base64').toString('ascii'),
|
||||
'123456!@#$%^'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('hex buffer to ascii', function (t) {
|
||||
t.equal(
|
||||
new B('31323334353621402324255e', 'hex').toString('ascii'),
|
||||
'123456!@#$%^'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('base64 buffer to binary', function (t) {
|
||||
t.equal(
|
||||
new B('MTIzNDU2IUAjJCVe', 'base64').toString('binary'),
|
||||
'123456!@#$%^'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('hex buffer to binary', function (t) {
|
||||
t.equal(
|
||||
new B('31323334353621402324255e', 'hex').toString('binary'),
|
||||
'123456!@#$%^'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('utf8 to binary', function (t) {
|
||||
/* jshint -W100 */
|
||||
t.equal(
|
||||
new B('öäüõÖÄÜÕ', 'utf8').toString('binary'),
|
||||
'öäüõÃÃÃÃ'
|
||||
)
|
||||
/* jshint +W100 */
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('utf8 replacement chars (1 byte sequence)', function (t) {
|
||||
t.equal(
|
||||
new B([ 0x80 ]).toString(),
|
||||
'\uFFFD'
|
||||
)
|
||||
t.equal(
|
||||
new B([ 0x7F ]).toString(),
|
||||
'\u007F'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('utf8 replacement chars (2 byte sequences)', function (t) {
|
||||
t.equal(
|
||||
new B([ 0xC7 ]).toString(),
|
||||
'\uFFFD'
|
||||
)
|
||||
t.equal(
|
||||
new B([ 0xC7, 0xB1 ]).toString(),
|
||||
'\u01F1'
|
||||
)
|
||||
t.equal(
|
||||
new B([ 0xC0, 0xB1 ]).toString(),
|
||||
'\uFFFD\uFFFD'
|
||||
)
|
||||
t.equal(
|
||||
new B([ 0xC1, 0xB1 ]).toString(),
|
||||
'\uFFFD\uFFFD'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('utf8 replacement chars (3 byte sequences)', function (t) {
|
||||
t.equal(
|
||||
new B([ 0xE0 ]).toString(),
|
||||
'\uFFFD'
|
||||
)
|
||||
t.equal(
|
||||
new B([ 0xE0, 0xAC ]).toString(),
|
||||
'\uFFFD\uFFFD'
|
||||
)
|
||||
t.equal(
|
||||
new B([ 0xE0, 0xAC, 0xB9 ]).toString(),
|
||||
'\u0B39'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('utf8 replacement chars (4 byte sequences)', function (t) {
|
||||
t.equal(
|
||||
new B([ 0xF4 ]).toString(),
|
||||
'\uFFFD'
|
||||
)
|
||||
t.equal(
|
||||
new B([ 0xF4, 0x8F ]).toString(),
|
||||
'\uFFFD\uFFFD'
|
||||
)
|
||||
t.equal(
|
||||
new B([ 0xF4, 0x8F, 0x80 ]).toString(),
|
||||
'\uFFFD\uFFFD\uFFFD'
|
||||
)
|
||||
t.equal(
|
||||
new B([ 0xF4, 0x8F, 0x80, 0x84 ]).toString(),
|
||||
'\uDBFC\uDC04'
|
||||
)
|
||||
t.equal(
|
||||
new B([ 0xFF ]).toString(),
|
||||
'\uFFFD'
|
||||
)
|
||||
t.equal(
|
||||
new B([ 0xFF, 0x8F, 0x80, 0x84 ]).toString(),
|
||||
'\uFFFD\uFFFD\uFFFD\uFFFD'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('utf8 replacement chars on 256 random bytes', function (t) {
|
||||
t.equal(
|
||||
new B([ 152, 130, 206, 23, 243, 238, 197, 44, 27, 86, 208, 36, 163, 184, 164, 21, 94, 242, 178, 46, 25, 26, 253, 178, 72, 147, 207, 112, 236, 68, 179, 190, 29, 83, 239, 147, 125, 55, 143, 19, 157, 68, 157, 58, 212, 224, 150, 39, 128, 24, 94, 225, 120, 121, 75, 192, 112, 19, 184, 142, 203, 36, 43, 85, 26, 147, 227, 139, 242, 186, 57, 78, 11, 102, 136, 117, 180, 210, 241, 92, 3, 215, 54, 167, 249, 1, 44, 225, 146, 86, 2, 42, 68, 21, 47, 238, 204, 153, 216, 252, 183, 66, 222, 255, 15, 202, 16, 51, 134, 1, 17, 19, 209, 76, 238, 38, 76, 19, 7, 103, 249, 5, 107, 137, 64, 62, 170, 57, 16, 85, 179, 193, 97, 86, 166, 196, 36, 148, 138, 193, 210, 69, 187, 38, 242, 97, 195, 219, 252, 244, 38, 1, 197, 18, 31, 246, 53, 47, 134, 52, 105, 72, 43, 239, 128, 203, 73, 93, 199, 75, 222, 220, 166, 34, 63, 236, 11, 212, 76, 243, 171, 110, 78, 39, 205, 204, 6, 177, 233, 212, 243, 0, 33, 41, 122, 118, 92, 252, 0, 157, 108, 120, 70, 137, 100, 223, 243, 171, 232, 66, 126, 111, 142, 33, 3, 39, 117, 27, 107, 54, 1, 217, 227, 132, 13, 166, 3, 73, 53, 127, 225, 236, 134, 219, 98, 214, 125, 148, 24, 64, 142, 111, 231, 194, 42, 150, 185, 10, 182, 163, 244, 19, 4, 59, 135, 16 ]).toString(),
|
||||
'\uFFFD\uFFFD\uFFFD\u0017\uFFFD\uFFFD\uFFFD\u002C\u001B\u0056\uFFFD\u0024\uFFFD\uFFFD\uFFFD\u0015\u005E\uFFFD\uFFFD\u002E\u0019\u001A\uFFFD\uFFFD\u0048\uFFFD\uFFFD\u0070\uFFFD\u0044\uFFFD\uFFFD\u001D\u0053\uFFFD\uFFFD\u007D\u0037\uFFFD\u0013\uFFFD\u0044\uFFFD\u003A\uFFFD\uFFFD\uFFFD\u0027\uFFFD\u0018\u005E\uFFFD\u0078\u0079\u004B\uFFFD\u0070\u0013\uFFFD\uFFFD\uFFFD\u0024\u002B\u0055\u001A\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0039\u004E\u000B\u0066\uFFFD\u0075\uFFFD\uFFFD\uFFFD\u005C\u0003\uFFFD\u0036\uFFFD\uFFFD\u0001\u002C\uFFFD\uFFFD\u0056\u0002\u002A\u0044\u0015\u002F\uFFFD\u0319\uFFFD\uFFFD\uFFFD\u0042\uFFFD\uFFFD\u000F\uFFFD\u0010\u0033\uFFFD\u0001\u0011\u0013\uFFFD\u004C\uFFFD\u0026\u004C\u0013\u0007\u0067\uFFFD\u0005\u006B\uFFFD\u0040\u003E\uFFFD\u0039\u0010\u0055\uFFFD\uFFFD\u0061\u0056\uFFFD\uFFFD\u0024\uFFFD\uFFFD\uFFFD\uFFFD\u0045\uFFFD\u0026\uFFFD\u0061\uFFFD\uFFFD\uFFFD\uFFFD\u0026\u0001\uFFFD\u0012\u001F\uFFFD\u0035\u002F\uFFFD\u0034\u0069\u0048\u002B\uFFFD\uFFFD\uFFFD\u0049\u005D\uFFFD\u004B\uFFFD\u0726\u0022\u003F\uFFFD\u000B\uFFFD\u004C\uFFFD\uFFFD\u006E\u004E\u0027\uFFFD\uFFFD\u0006\uFFFD\uFFFD\uFFFD\uFFFD\u0000\u0021\u0029\u007A\u0076\u005C\uFFFD\u0000\uFFFD\u006C\u0078\u0046\uFFFD\u0064\uFFFD\uFFFD\uFFFD\uFFFD\u0042\u007E\u006F\uFFFD\u0021\u0003\u0027\u0075\u001B\u006B\u0036\u0001\uFFFD\uFFFD\uFFFD\u000D\uFFFD\u0003\u0049\u0035\u007F\uFFFD\uFFFD\uFFFD\uFFFD\u0062\uFFFD\u007D\uFFFD\u0018\u0040\uFFFD\u006F\uFFFD\uFFFD\u002A\uFFFD\uFFFD\u000A\uFFFD\uFFFD\uFFFD\u0013\u0004\u003B\uFFFD\u0010'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('utf8 replacement chars for anything in the surrogate pair range', function (t) {
|
||||
t.equal(
|
||||
new B([ 0xED, 0x9F, 0xBF ]).toString(),
|
||||
'\uD7FF'
|
||||
)
|
||||
t.equal(
|
||||
new B([ 0xED, 0xA0, 0x80 ]).toString(),
|
||||
'\uFFFD\uFFFD\uFFFD'
|
||||
)
|
||||
t.equal(
|
||||
new B([ 0xED, 0xBE, 0x8B ]).toString(),
|
||||
'\uFFFD\uFFFD\uFFFD'
|
||||
)
|
||||
t.equal(
|
||||
new B([ 0xED, 0xBF, 0xBF ]).toString(),
|
||||
'\uFFFD\uFFFD\uFFFD'
|
||||
)
|
||||
t.equal(
|
||||
new B([ 0xEE, 0x80, 0x80 ]).toString(),
|
||||
'\uE000'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('utf8 don\'t replace the replacement char', function (t) {
|
||||
t.equal(
|
||||
new B('\uFFFD').toString(),
|
||||
'\uFFFD'
|
||||
)
|
||||
t.end()
|
||||
})
|
||||
131
node_modules/buffer/test/write.js
generated
vendored
131
node_modules/buffer/test/write.js
generated
vendored
@@ -1,131 +0,0 @@
|
||||
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
|
||||
var B = require('../').Buffer
|
||||
var test = require('tape')
|
||||
var isnan = require('is-nan')
|
||||
|
||||
test('buffer.write string should get parsed as number', function (t) {
|
||||
var b = new B(64)
|
||||
b.writeUInt16LE('1003', 0)
|
||||
t.equal(b.readUInt16LE(0), 1003)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('buffer.writeUInt8 a fractional number will get Math.floored', function (t) {
|
||||
// Some extra work is necessary to make this test pass with the Object implementation
|
||||
|
||||
var b = new B(1)
|
||||
b.writeInt8(5.5, 0)
|
||||
t.equal(b[0], 5)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('writeUint8 with a negative number throws', function (t) {
|
||||
var buf = new B(1)
|
||||
|
||||
t.throws(function () {
|
||||
buf.writeUInt8(-3, 0)
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('hex of write{Uint,Int}{8,16,32}{LE,BE}', function (t) {
|
||||
t.plan(2 * (2 * 2 * 2 + 2))
|
||||
var hex = [
|
||||
'03', '0300', '0003', '03000000', '00000003',
|
||||
'fd', 'fdff', 'fffd', 'fdffffff', 'fffffffd'
|
||||
]
|
||||
var reads = [ 3, 3, 3, 3, 3, -3, -3, -3, -3, -3 ]
|
||||
var xs = ['UInt', 'Int']
|
||||
var ys = [8, 16, 32]
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
var x = xs[i]
|
||||
for (var j = 0; j < ys.length; j++) {
|
||||
var y = ys[j]
|
||||
var endianesses = (y === 8) ? [''] : ['LE', 'BE']
|
||||
for (var k = 0; k < endianesses.length; k++) {
|
||||
var z = endianesses[k]
|
||||
|
||||
var v1 = new B(y / 8)
|
||||
var writefn = 'write' + x + y + z
|
||||
var val = (x === 'Int') ? -3 : 3
|
||||
v1[writefn](val, 0)
|
||||
t.equal(
|
||||
v1.toString('hex'),
|
||||
hex.shift()
|
||||
)
|
||||
var readfn = 'read' + x + y + z
|
||||
t.equal(
|
||||
v1[readfn](0),
|
||||
reads.shift()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('hex of write{Uint,Int}{8,16,32}{LE,BE} with overflow', function (t) {
|
||||
if (!B.TYPED_ARRAY_SUPPORT) {
|
||||
t.pass('object impl: skipping overflow test')
|
||||
t.end()
|
||||
return
|
||||
}
|
||||
|
||||
t.plan(3 * (2 * 2 * 2 + 2))
|
||||
var hex = [
|
||||
'', '03', '00', '030000', '000000',
|
||||
'', 'fd', 'ff', 'fdffff', 'ffffff'
|
||||
]
|
||||
var reads = [
|
||||
undefined, 3, 0, NaN, 0,
|
||||
undefined, 253, -256, 16777213, -256
|
||||
]
|
||||
var xs = ['UInt', 'Int']
|
||||
var ys = [8, 16, 32]
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
var x = xs[i]
|
||||
for (var j = 0; j < ys.length; j++) {
|
||||
var y = ys[j]
|
||||
var endianesses = (y === 8) ? [''] : ['LE', 'BE']
|
||||
for (var k = 0; k < endianesses.length; k++) {
|
||||
var z = endianesses[k]
|
||||
|
||||
var v1 = new B(y / 8 - 1)
|
||||
var next = new B(4)
|
||||
next.writeUInt32BE(0, 0)
|
||||
var writefn = 'write' + x + y + z
|
||||
var val = (x === 'Int') ? -3 : 3
|
||||
v1[writefn](val, 0, true)
|
||||
t.equal(
|
||||
v1.toString('hex'),
|
||||
hex.shift()
|
||||
)
|
||||
// check that nothing leaked to next buffer.
|
||||
t.equal(next.readUInt32BE(0), 0)
|
||||
// check that no bytes are read from next buffer.
|
||||
next.writeInt32BE(~0, 0)
|
||||
var readfn = 'read' + x + y + z
|
||||
var r = reads.shift()
|
||||
if (isnan(r)) t.pass('equal')
|
||||
else t.equal(v1[readfn](0, true), r)
|
||||
}
|
||||
}
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
test('large values do not imporoperly roll over (ref #80)', function (t) {
|
||||
var nums = [-25589992, -633756690, -898146932]
|
||||
var out = new B(12)
|
||||
out.fill(0)
|
||||
out.writeInt32BE(nums[0], 0)
|
||||
var newNum = out.readInt32BE(0)
|
||||
t.equal(nums[0], newNum)
|
||||
out.writeInt32BE(nums[1], 4)
|
||||
newNum = out.readInt32BE(4)
|
||||
t.equal(nums[1], newNum)
|
||||
out.writeInt32BE(nums[2], 8)
|
||||
newNum = out.readInt32BE(8)
|
||||
t.equal(nums[2], newNum)
|
||||
t.end()
|
||||
})
|
||||
18
node_modules/capture-stack-trace/index.js
generated
vendored
18
node_modules/capture-stack-trace/index.js
generated
vendored
@@ -1,18 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = Error.captureStackTrace || function (error) {
|
||||
var container = new Error();
|
||||
|
||||
Object.defineProperty(error, 'stack', {
|
||||
configurable: true,
|
||||
get: function getStack() {
|
||||
var stack = container.stack;
|
||||
|
||||
Object.defineProperty(this, 'stack', {
|
||||
value: stack
|
||||
});
|
||||
|
||||
return stack;
|
||||
}
|
||||
});
|
||||
};
|
||||
21
node_modules/capture-stack-trace/license
generated
vendored
21
node_modules/capture-stack-trace/license
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Vsevolod Strukchinsky <floatdrop@gmail.com> (github.com/floatdrop)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
29
node_modules/capture-stack-trace/package.json
generated
vendored
29
node_modules/capture-stack-trace/package.json
generated
vendored
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"name": "capture-stack-trace",
|
||||
"version": "1.0.1",
|
||||
"description": "Error.captureStackTrace ponyfill",
|
||||
"license": "MIT",
|
||||
"repository": "floatdrop/capture-stack-trace",
|
||||
"author": {
|
||||
"name": "Vsevolod Strukchinsky",
|
||||
"email": "floatdrop@gmail.com",
|
||||
"url": "github.com/floatdrop"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"Error",
|
||||
"captureStackTrace"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
}
|
||||
}
|
||||
36
node_modules/capture-stack-trace/readme.md
generated
vendored
36
node_modules/capture-stack-trace/readme.md
generated
vendored
@@ -1,36 +0,0 @@
|
||||
# capture-stack-trace [](https://travis-ci.org/floatdrop/capture-stack-trace)
|
||||
|
||||
> Ponyfill for Error.captureStackTrace
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save capture-stack-trace
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var captureStackTrace = require('capture-stack-trace');
|
||||
|
||||
captureStackTrace({});
|
||||
// => {stack: ...}
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### captureStackTrace(error)
|
||||
|
||||
#### error
|
||||
|
||||
*Required*
|
||||
Type: `Object`
|
||||
|
||||
Target Object, that will recieve stack property.
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)
|
||||
37
node_modules/caw/index.js
generated
vendored
37
node_modules/caw/index.js
generated
vendored
@@ -1,37 +0,0 @@
|
||||
'use strict';
|
||||
const url = require('url');
|
||||
const getProxy = require('get-proxy');
|
||||
const isurl = require('isurl');
|
||||
const tunnelAgent = require('tunnel-agent');
|
||||
const urlToOptions = require('url-to-options');
|
||||
|
||||
module.exports = (proxy, opts) => {
|
||||
proxy = proxy || getProxy();
|
||||
opts = Object.assign({}, opts);
|
||||
|
||||
if (typeof proxy === 'object') {
|
||||
opts = proxy;
|
||||
proxy = getProxy();
|
||||
}
|
||||
|
||||
if (!proxy) {
|
||||
return null;
|
||||
}
|
||||
|
||||
proxy = isurl.lenient(proxy) ? urlToOptions(proxy) : url.parse(proxy);
|
||||
|
||||
const uriProtocol = opts.protocol === 'https' ? 'https' : 'http';
|
||||
const proxyProtocol = proxy.protocol === 'https:' ? 'Https' : 'Http';
|
||||
const port = proxy.port || (proxyProtocol === 'Https' ? 443 : 80);
|
||||
const method = `${uriProtocol}Over${proxyProtocol}`;
|
||||
|
||||
delete opts.protocol;
|
||||
|
||||
return tunnelAgent[method](Object.assign({
|
||||
proxy: {
|
||||
port,
|
||||
host: proxy.hostname,
|
||||
proxyAuth: proxy.auth
|
||||
}
|
||||
}, opts));
|
||||
};
|
||||
9
node_modules/caw/license
generated
vendored
9
node_modules/caw/license
generated
vendored
@@ -1,9 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com> (github.com/kevva)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
49
node_modules/caw/package.json
generated
vendored
49
node_modules/caw/package.json
generated
vendored
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"name": "caw",
|
||||
"version": "2.0.1",
|
||||
"description": "Construct HTTP/HTTPS agents for tunneling proxies",
|
||||
"license": "MIT",
|
||||
"repository": "kevva/caw",
|
||||
"author": {
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"name": "Kevin Mårtensson",
|
||||
"url": "github.com/kevva"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"http",
|
||||
"https",
|
||||
"proxy",
|
||||
"tunnel"
|
||||
],
|
||||
"dependencies": {
|
||||
"get-proxy": "^2.0.0",
|
||||
"isurl": "^1.0.0-alpha5",
|
||||
"tunnel-agent": "^0.6.0",
|
||||
"url-to-options": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"create-cert": "^1.0.4",
|
||||
"get-port": "^3.1.0",
|
||||
"got": "^7.0.0",
|
||||
"pify": "^3.0.0",
|
||||
"proxyquire": "^1.7.9",
|
||||
"sinon": "^2.3.1",
|
||||
"universal-url": "1.0.0-alpha",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"ava/no-skip-test": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
51
node_modules/caw/readme.md
generated
vendored
51
node_modules/caw/readme.md
generated
vendored
@@ -1,51 +0,0 @@
|
||||
# caw [](https://travis-ci.org/kevva/caw)
|
||||
|
||||
> Construct HTTP/HTTPS agents for tunneling proxies
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install caw
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const caw = require('caw');
|
||||
const got = require('got');
|
||||
|
||||
got('todomvc.com', {
|
||||
agent: caw()
|
||||
}, () => {});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### caw([proxy], [options])
|
||||
|
||||
#### proxy
|
||||
|
||||
Type: `string`
|
||||
|
||||
Proxy URL. If not set, it'll try getting it using [`get-proxy`](https://github.com/kevva/get-proxy).
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
Besides the options below, you can pass in options allowed in [tunnel-agent](https://github.com/request/tunnel-agent).
|
||||
|
||||
##### protocol
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `http`
|
||||
|
||||
Endpoint protocol.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Kevin Mårtensson](https://github.com/kevva)
|
||||
228
node_modules/chalk/index.js
generated
vendored
228
node_modules/chalk/index.js
generated
vendored
@@ -1,228 +0,0 @@
|
||||
'use strict';
|
||||
const escapeStringRegexp = require('escape-string-regexp');
|
||||
const ansiStyles = require('ansi-styles');
|
||||
const stdoutColor = require('supports-color').stdout;
|
||||
|
||||
const template = require('./templates.js');
|
||||
|
||||
const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm');
|
||||
|
||||
// `supportsColor.level` → `ansiStyles.color[name]` mapping
|
||||
const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
|
||||
|
||||
// `color-convert` models to exclude from the Chalk API due to conflicts and such
|
||||
const skipModels = new Set(['gray']);
|
||||
|
||||
const styles = Object.create(null);
|
||||
|
||||
function applyOptions(obj, options) {
|
||||
options = options || {};
|
||||
|
||||
// Detect level if not set manually
|
||||
const scLevel = stdoutColor ? stdoutColor.level : 0;
|
||||
obj.level = options.level === undefined ? scLevel : options.level;
|
||||
obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
|
||||
}
|
||||
|
||||
function Chalk(options) {
|
||||
// We check for this.template here since calling `chalk.constructor()`
|
||||
// by itself will have a `this` of a previously constructed chalk object
|
||||
if (!this || !(this instanceof Chalk) || this.template) {
|
||||
const chalk = {};
|
||||
applyOptions(chalk, options);
|
||||
|
||||
chalk.template = function () {
|
||||
const args = [].slice.call(arguments);
|
||||
return chalkTag.apply(null, [chalk.template].concat(args));
|
||||
};
|
||||
|
||||
Object.setPrototypeOf(chalk, Chalk.prototype);
|
||||
Object.setPrototypeOf(chalk.template, chalk);
|
||||
|
||||
chalk.template.constructor = Chalk;
|
||||
|
||||
return chalk.template;
|
||||
}
|
||||
|
||||
applyOptions(this, options);
|
||||
}
|
||||
|
||||
// Use bright blue on Windows as the normal blue color is illegible
|
||||
if (isSimpleWindowsTerm) {
|
||||
ansiStyles.blue.open = '\u001B[94m';
|
||||
}
|
||||
|
||||
for (const key of Object.keys(ansiStyles)) {
|
||||
ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
|
||||
|
||||
styles[key] = {
|
||||
get() {
|
||||
const codes = ansiStyles[key];
|
||||
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
styles.visible = {
|
||||
get() {
|
||||
return build.call(this, this._styles || [], true, 'visible');
|
||||
}
|
||||
};
|
||||
|
||||
ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
|
||||
for (const model of Object.keys(ansiStyles.color.ansi)) {
|
||||
if (skipModels.has(model)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
styles[model] = {
|
||||
get() {
|
||||
const level = this.level;
|
||||
return function () {
|
||||
const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
|
||||
const codes = {
|
||||
open,
|
||||
close: ansiStyles.color.close,
|
||||
closeRe: ansiStyles.color.closeRe
|
||||
};
|
||||
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
|
||||
for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
|
||||
if (skipModels.has(model)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
||||
styles[bgModel] = {
|
||||
get() {
|
||||
const level = this.level;
|
||||
return function () {
|
||||
const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
|
||||
const codes = {
|
||||
open,
|
||||
close: ansiStyles.bgColor.close,
|
||||
closeRe: ansiStyles.bgColor.closeRe
|
||||
};
|
||||
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const proto = Object.defineProperties(() => {}, styles);
|
||||
|
||||
function build(_styles, _empty, key) {
|
||||
const builder = function () {
|
||||
return applyStyle.apply(builder, arguments);
|
||||
};
|
||||
|
||||
builder._styles = _styles;
|
||||
builder._empty = _empty;
|
||||
|
||||
const self = this;
|
||||
|
||||
Object.defineProperty(builder, 'level', {
|
||||
enumerable: true,
|
||||
get() {
|
||||
return self.level;
|
||||
},
|
||||
set(level) {
|
||||
self.level = level;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(builder, 'enabled', {
|
||||
enumerable: true,
|
||||
get() {
|
||||
return self.enabled;
|
||||
},
|
||||
set(enabled) {
|
||||
self.enabled = enabled;
|
||||
}
|
||||
});
|
||||
|
||||
// See below for fix regarding invisible grey/dim combination on Windows
|
||||
builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey';
|
||||
|
||||
// `__proto__` is used because we must return a function, but there is
|
||||
// no way to create a function with a different prototype
|
||||
builder.__proto__ = proto; // eslint-disable-line no-proto
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
function applyStyle() {
|
||||
// Support varags, but simply cast to string in case there's only one arg
|
||||
const args = arguments;
|
||||
const argsLen = args.length;
|
||||
let str = String(arguments[0]);
|
||||
|
||||
if (argsLen === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (argsLen > 1) {
|
||||
// Don't slice `arguments`, it prevents V8 optimizations
|
||||
for (let a = 1; a < argsLen; a++) {
|
||||
str += ' ' + args[a];
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.enabled || this.level <= 0 || !str) {
|
||||
return this._empty ? '' : str;
|
||||
}
|
||||
|
||||
// Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
|
||||
// see https://github.com/chalk/chalk/issues/58
|
||||
// If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
|
||||
const originalDim = ansiStyles.dim.open;
|
||||
if (isSimpleWindowsTerm && this.hasGrey) {
|
||||
ansiStyles.dim.open = '';
|
||||
}
|
||||
|
||||
for (const code of this._styles.slice().reverse()) {
|
||||
// Replace any instances already present with a re-opening code
|
||||
// otherwise only the part of the string until said closing code
|
||||
// will be colored, and the rest will simply be 'plain'.
|
||||
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
||||
|
||||
// Close the styling before a linebreak and reopen
|
||||
// after next line to fix a bleed issue on macOS
|
||||
// https://github.com/chalk/chalk/pull/92
|
||||
str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
|
||||
}
|
||||
|
||||
// Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
|
||||
ansiStyles.dim.open = originalDim;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function chalkTag(chalk, strings) {
|
||||
if (!Array.isArray(strings)) {
|
||||
// If chalk() was called by itself or with a string,
|
||||
// return the string itself as a string.
|
||||
return [].slice.call(arguments, 1).join(' ');
|
||||
}
|
||||
|
||||
const args = [].slice.call(arguments, 2);
|
||||
const parts = [strings.raw[0]];
|
||||
|
||||
for (let i = 1; i < strings.length; i++) {
|
||||
parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
|
||||
parts.push(String(strings.raw[i]));
|
||||
}
|
||||
|
||||
return template(chalk, parts.join(''));
|
||||
}
|
||||
|
||||
Object.defineProperties(Chalk.prototype, styles);
|
||||
|
||||
module.exports = Chalk(); // eslint-disable-line new-cap
|
||||
module.exports.supportsColor = stdoutColor;
|
||||
module.exports.default = module.exports; // For TypeScript
|
||||
93
node_modules/chalk/index.js.flow
generated
vendored
93
node_modules/chalk/index.js.flow
generated
vendored
@@ -1,93 +0,0 @@
|
||||
// @flow
|
||||
|
||||
type TemplateStringsArray = $ReadOnlyArray<string>;
|
||||
|
||||
export type Level = $Values<{
|
||||
None: 0,
|
||||
Basic: 1,
|
||||
Ansi256: 2,
|
||||
TrueColor: 3
|
||||
}>;
|
||||
|
||||
export type ChalkOptions = {|
|
||||
enabled?: boolean,
|
||||
level?: Level
|
||||
|};
|
||||
|
||||
export type ColorSupport = {|
|
||||
level: Level,
|
||||
hasBasic: boolean,
|
||||
has256: boolean,
|
||||
has16m: boolean
|
||||
|};
|
||||
|
||||
export interface Chalk {
|
||||
(...text: string[]): string,
|
||||
(text: TemplateStringsArray, ...placeholders: string[]): string,
|
||||
constructor(options?: ChalkOptions): Chalk,
|
||||
enabled: boolean,
|
||||
level: Level,
|
||||
rgb(r: number, g: number, b: number): Chalk,
|
||||
hsl(h: number, s: number, l: number): Chalk,
|
||||
hsv(h: number, s: number, v: number): Chalk,
|
||||
hwb(h: number, w: number, b: number): Chalk,
|
||||
bgHex(color: string): Chalk,
|
||||
bgKeyword(color: string): Chalk,
|
||||
bgRgb(r: number, g: number, b: number): Chalk,
|
||||
bgHsl(h: number, s: number, l: number): Chalk,
|
||||
bgHsv(h: number, s: number, v: number): Chalk,
|
||||
bgHwb(h: number, w: number, b: number): Chalk,
|
||||
hex(color: string): Chalk,
|
||||
keyword(color: string): Chalk,
|
||||
|
||||
+reset: Chalk,
|
||||
+bold: Chalk,
|
||||
+dim: Chalk,
|
||||
+italic: Chalk,
|
||||
+underline: Chalk,
|
||||
+inverse: Chalk,
|
||||
+hidden: Chalk,
|
||||
+strikethrough: Chalk,
|
||||
|
||||
+visible: Chalk,
|
||||
|
||||
+black: Chalk,
|
||||
+red: Chalk,
|
||||
+green: Chalk,
|
||||
+yellow: Chalk,
|
||||
+blue: Chalk,
|
||||
+magenta: Chalk,
|
||||
+cyan: Chalk,
|
||||
+white: Chalk,
|
||||
+gray: Chalk,
|
||||
+grey: Chalk,
|
||||
+blackBright: Chalk,
|
||||
+redBright: Chalk,
|
||||
+greenBright: Chalk,
|
||||
+yellowBright: Chalk,
|
||||
+blueBright: Chalk,
|
||||
+magentaBright: Chalk,
|
||||
+cyanBright: Chalk,
|
||||
+whiteBright: Chalk,
|
||||
|
||||
+bgBlack: Chalk,
|
||||
+bgRed: Chalk,
|
||||
+bgGreen: Chalk,
|
||||
+bgYellow: Chalk,
|
||||
+bgBlue: Chalk,
|
||||
+bgMagenta: Chalk,
|
||||
+bgCyan: Chalk,
|
||||
+bgWhite: Chalk,
|
||||
+bgBlackBright: Chalk,
|
||||
+bgRedBright: Chalk,
|
||||
+bgGreenBright: Chalk,
|
||||
+bgYellowBright: Chalk,
|
||||
+bgBlueBright: Chalk,
|
||||
+bgMagentaBright: Chalk,
|
||||
+bgCyanBright: Chalk,
|
||||
+bgWhiteBrigh: Chalk,
|
||||
|
||||
supportsColor: ColorSupport
|
||||
};
|
||||
|
||||
declare module.exports: Chalk;
|
||||
9
node_modules/chalk/license
generated
vendored
9
node_modules/chalk/license
generated
vendored
@@ -1,9 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
71
node_modules/chalk/package.json
generated
vendored
71
node_modules/chalk/package.json
generated
vendored
@@ -1,71 +0,0 @@
|
||||
{
|
||||
"name": "chalk",
|
||||
"version": "2.4.1",
|
||||
"description": "Terminal string styling done right",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/chalk",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && tsc --project types && flow --max-warnings=0 && nyc ava",
|
||||
"bench": "matcha benchmark.js",
|
||||
"coveralls": "nyc report --reporter=text-lcov | coveralls"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"templates.js",
|
||||
"types/index.d.ts",
|
||||
"index.js.flow"
|
||||
],
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"str",
|
||||
"ansi",
|
||||
"style",
|
||||
"styles",
|
||||
"tty",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"supports-color": "^5.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"coveralls": "^3.0.0",
|
||||
"execa": "^0.9.0",
|
||||
"flow-bin": "^0.68.0",
|
||||
"import-fresh": "^2.0.0",
|
||||
"matcha": "^0.7.0",
|
||||
"nyc": "^11.0.2",
|
||||
"resolve-from": "^4.0.0",
|
||||
"typescript": "^2.5.3",
|
||||
"xo": "*"
|
||||
},
|
||||
"types": "types/index.d.ts",
|
||||
"xo": {
|
||||
"envs": [
|
||||
"node",
|
||||
"mocha"
|
||||
],
|
||||
"ignores": [
|
||||
"test/_flow.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
314
node_modules/chalk/readme.md
generated
vendored
314
node_modules/chalk/readme.md
generated
vendored
@@ -1,314 +0,0 @@
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img width="320" src="media/logo.svg" alt="Chalk">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
> Terminal string styling done right
|
||||
|
||||
[](https://travis-ci.org/chalk/chalk) [](https://coveralls.io/github/chalk/chalk?branch=master) [](https://www.youtube.com/watch?v=9auOCbH5Ns4) [](https://github.com/xojs/xo) [](https://github.com/sindresorhus/awesome-nodejs)
|
||||
|
||||
### [See what's new in Chalk 2](https://github.com/chalk/chalk/releases/tag/v2.0.0)
|
||||
|
||||
<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" alt="" width="900">
|
||||
|
||||
|
||||
## Highlights
|
||||
|
||||
- Expressive API
|
||||
- Highly performant
|
||||
- Ability to nest styles
|
||||
- [256/Truecolor color support](#256-and-truecolor-color-support)
|
||||
- Auto-detects color support
|
||||
- Doesn't extend `String.prototype`
|
||||
- Clean and focused
|
||||
- Actively maintained
|
||||
- [Used by ~23,000 packages](https://www.npmjs.com/browse/depended/chalk) as of December 31, 2017
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```console
|
||||
$ npm install chalk
|
||||
```
|
||||
|
||||
<a href="https://www.patreon.com/sindresorhus">
|
||||
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
|
||||
</a>
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
console.log(chalk.blue('Hello world!'));
|
||||
```
|
||||
|
||||
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
const log = console.log;
|
||||
|
||||
// Combine styled and normal strings
|
||||
log(chalk.blue('Hello') + ' World' + chalk.red('!'));
|
||||
|
||||
// Compose multiple styles using the chainable API
|
||||
log(chalk.blue.bgRed.bold('Hello world!'));
|
||||
|
||||
// Pass in multiple arguments
|
||||
log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
|
||||
|
||||
// Nest styles
|
||||
log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
|
||||
|
||||
// Nest styles of the same type even (color, underline, background)
|
||||
log(chalk.green(
|
||||
'I am a green line ' +
|
||||
chalk.blue.underline.bold('with a blue substring') +
|
||||
' that becomes green again!'
|
||||
));
|
||||
|
||||
// ES2015 template literal
|
||||
log(`
|
||||
CPU: ${chalk.red('90%')}
|
||||
RAM: ${chalk.green('40%')}
|
||||
DISK: ${chalk.yellow('70%')}
|
||||
`);
|
||||
|
||||
// ES2015 tagged template literal
|
||||
log(chalk`
|
||||
CPU: {red ${cpu.totalPercent}%}
|
||||
RAM: {green ${ram.used / ram.total * 100}%}
|
||||
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||
`);
|
||||
|
||||
// Use RGB colors in terminal emulators that support it.
|
||||
log(chalk.keyword('orange')('Yay for orange colored text!'));
|
||||
log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
|
||||
log(chalk.hex('#DEADED').bold('Bold gray!'));
|
||||
```
|
||||
|
||||
Easily define your own themes:
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const error = chalk.bold.red;
|
||||
const warning = chalk.keyword('orange');
|
||||
|
||||
console.log(error('Error!'));
|
||||
console.log(warning('Warning!'));
|
||||
```
|
||||
|
||||
Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
|
||||
|
||||
```js
|
||||
const name = 'Sindre';
|
||||
console.log(chalk.green('Hello %s'), name);
|
||||
//=> 'Hello Sindre'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### chalk.`<style>[.<style>...](string, [string...])`
|
||||
|
||||
Example: `chalk.red.bold.underline('Hello', 'world');`
|
||||
|
||||
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||
|
||||
Multiple arguments will be separated by space.
|
||||
|
||||
### chalk.enabled
|
||||
|
||||
Color support is automatically detected, as is the level (see `chalk.level`). However, if you'd like to simply enable/disable Chalk, you can do so via the `.enabled` property.
|
||||
|
||||
Chalk is enabled by default unless explicitly disabled via the constructor or `chalk.level` is `0`.
|
||||
|
||||
If you need to change this in a reusable module, create a new instance:
|
||||
|
||||
```js
|
||||
const ctx = new chalk.constructor({enabled: false});
|
||||
```
|
||||
|
||||
### chalk.level
|
||||
|
||||
Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
|
||||
|
||||
If you need to change this in a reusable module, create a new instance:
|
||||
|
||||
```js
|
||||
const ctx = new chalk.constructor({level: 0});
|
||||
```
|
||||
|
||||
Levels are as follows:
|
||||
|
||||
0. All colors disabled
|
||||
1. Basic color support (16 colors)
|
||||
2. 256 color support
|
||||
3. Truecolor support (16 million colors)
|
||||
|
||||
### chalk.supportsColor
|
||||
|
||||
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
|
||||
|
||||
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
||||
|
||||
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(Not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(Not widely supported)*
|
||||
- `visible` (Text is emitted only if enabled)
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue` *(On Windows the bright version is used since normal blue is illegible)*
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `gray` ("bright black")
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright`
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
|
||||
## Tagged template literal
|
||||
|
||||
Chalk can be used as a [tagged template literal](http://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const miles = 18;
|
||||
const calculateFeet = miles => miles * 5280;
|
||||
|
||||
console.log(chalk`
|
||||
There are {bold 5280 feet} in a mile.
|
||||
In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
|
||||
`);
|
||||
```
|
||||
|
||||
Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
|
||||
|
||||
Template styles are chained exactly like normal Chalk styles. The following two statements are equivalent:
|
||||
|
||||
```js
|
||||
console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
|
||||
console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
|
||||
```
|
||||
|
||||
Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
|
||||
|
||||
All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
|
||||
|
||||
|
||||
## 256 and Truecolor color support
|
||||
|
||||
Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
|
||||
|
||||
Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
|
||||
|
||||
Examples:
|
||||
|
||||
- `chalk.hex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.keyword('orange')('Some orange text')`
|
||||
- `chalk.rgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
|
||||
|
||||
- `chalk.bgHex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.bgKeyword('orange')('Some orange text')`
|
||||
- `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
The following color models can be used:
|
||||
|
||||
- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
|
||||
- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
|
||||
- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
|
||||
- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
|
||||
- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
|
||||
- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
|
||||
- `ansi16`
|
||||
- `ansi256`
|
||||
|
||||
|
||||
## Windows
|
||||
|
||||
If you're on Windows, do yourself a favor and use [`cmder`](http://cmder.net/) instead of `cmd.exe`.
|
||||
|
||||
|
||||
## Origin story
|
||||
|
||||
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
|
||||
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
|
||||
- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
|
||||
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
|
||||
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
|
||||
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
||||
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
||||
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
|
||||
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
|
||||
- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
|
||||
- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
|
||||
- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
|
||||
- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
|
||||
- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
128
node_modules/chalk/templates.js
generated
vendored
128
node_modules/chalk/templates.js
generated
vendored
@@ -1,128 +0,0 @@
|
||||
'use strict';
|
||||
const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
||||
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
||||
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
||||
const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
|
||||
|
||||
const ESCAPES = new Map([
|
||||
['n', '\n'],
|
||||
['r', '\r'],
|
||||
['t', '\t'],
|
||||
['b', '\b'],
|
||||
['f', '\f'],
|
||||
['v', '\v'],
|
||||
['0', '\0'],
|
||||
['\\', '\\'],
|
||||
['e', '\u001B'],
|
||||
['a', '\u0007']
|
||||
]);
|
||||
|
||||
function unescape(c) {
|
||||
if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
|
||||
return String.fromCharCode(parseInt(c.slice(1), 16));
|
||||
}
|
||||
|
||||
return ESCAPES.get(c) || c;
|
||||
}
|
||||
|
||||
function parseArguments(name, args) {
|
||||
const results = [];
|
||||
const chunks = args.trim().split(/\s*,\s*/g);
|
||||
let matches;
|
||||
|
||||
for (const chunk of chunks) {
|
||||
if (!isNaN(chunk)) {
|
||||
results.push(Number(chunk));
|
||||
} else if ((matches = chunk.match(STRING_REGEX))) {
|
||||
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
|
||||
} else {
|
||||
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function parseStyle(style) {
|
||||
STYLE_REGEX.lastIndex = 0;
|
||||
|
||||
const results = [];
|
||||
let matches;
|
||||
|
||||
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
||||
const name = matches[1];
|
||||
|
||||
if (matches[2]) {
|
||||
const args = parseArguments(name, matches[2]);
|
||||
results.push([name].concat(args));
|
||||
} else {
|
||||
results.push([name]);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function buildStyle(chalk, styles) {
|
||||
const enabled = {};
|
||||
|
||||
for (const layer of styles) {
|
||||
for (const style of layer.styles) {
|
||||
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
||||
}
|
||||
}
|
||||
|
||||
let current = chalk;
|
||||
for (const styleName of Object.keys(enabled)) {
|
||||
if (Array.isArray(enabled[styleName])) {
|
||||
if (!(styleName in current)) {
|
||||
throw new Error(`Unknown Chalk style: ${styleName}`);
|
||||
}
|
||||
|
||||
if (enabled[styleName].length > 0) {
|
||||
current = current[styleName].apply(current, enabled[styleName]);
|
||||
} else {
|
||||
current = current[styleName];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
module.exports = (chalk, tmp) => {
|
||||
const styles = [];
|
||||
const chunks = [];
|
||||
let chunk = [];
|
||||
|
||||
// eslint-disable-next-line max-params
|
||||
tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
|
||||
if (escapeChar) {
|
||||
chunk.push(unescape(escapeChar));
|
||||
} else if (style) {
|
||||
const str = chunk.join('');
|
||||
chunk = [];
|
||||
chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
|
||||
styles.push({inverse, styles: parseStyle(style)});
|
||||
} else if (close) {
|
||||
if (styles.length === 0) {
|
||||
throw new Error('Found extraneous } in Chalk template literal');
|
||||
}
|
||||
|
||||
chunks.push(buildStyle(chalk, styles)(chunk.join('')));
|
||||
chunk = [];
|
||||
styles.pop();
|
||||
} else {
|
||||
chunk.push(chr);
|
||||
}
|
||||
});
|
||||
|
||||
chunks.push(chunk.join(''));
|
||||
|
||||
if (styles.length > 0) {
|
||||
const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
|
||||
return chunks.join('');
|
||||
};
|
||||
97
node_modules/chalk/types/index.d.ts
generated
vendored
97
node_modules/chalk/types/index.d.ts
generated
vendored
@@ -1,97 +0,0 @@
|
||||
// Type definitions for Chalk
|
||||
// Definitions by: Thomas Sauer <https://github.com/t-sauer>
|
||||
|
||||
export const enum Level {
|
||||
None = 0,
|
||||
Basic = 1,
|
||||
Ansi256 = 2,
|
||||
TrueColor = 3
|
||||
}
|
||||
|
||||
export interface ChalkOptions {
|
||||
enabled?: boolean;
|
||||
level?: Level;
|
||||
}
|
||||
|
||||
export interface ChalkConstructor {
|
||||
new (options?: ChalkOptions): Chalk;
|
||||
(options?: ChalkOptions): Chalk;
|
||||
}
|
||||
|
||||
export interface ColorSupport {
|
||||
level: Level;
|
||||
hasBasic: boolean;
|
||||
has256: boolean;
|
||||
has16m: boolean;
|
||||
}
|
||||
|
||||
export interface Chalk {
|
||||
(...text: string[]): string;
|
||||
(text: TemplateStringsArray, ...placeholders: string[]): string;
|
||||
constructor: ChalkConstructor;
|
||||
enabled: boolean;
|
||||
level: Level;
|
||||
rgb(r: number, g: number, b: number): this;
|
||||
hsl(h: number, s: number, l: number): this;
|
||||
hsv(h: number, s: number, v: number): this;
|
||||
hwb(h: number, w: number, b: number): this;
|
||||
bgHex(color: string): this;
|
||||
bgKeyword(color: string): this;
|
||||
bgRgb(r: number, g: number, b: number): this;
|
||||
bgHsl(h: number, s: number, l: number): this;
|
||||
bgHsv(h: number, s: number, v: number): this;
|
||||
bgHwb(h: number, w: number, b: number): this;
|
||||
hex(color: string): this;
|
||||
keyword(color: string): this;
|
||||
|
||||
readonly reset: this;
|
||||
readonly bold: this;
|
||||
readonly dim: this;
|
||||
readonly italic: this;
|
||||
readonly underline: this;
|
||||
readonly inverse: this;
|
||||
readonly hidden: this;
|
||||
readonly strikethrough: this;
|
||||
|
||||
readonly visible: this;
|
||||
|
||||
readonly black: this;
|
||||
readonly red: this;
|
||||
readonly green: this;
|
||||
readonly yellow: this;
|
||||
readonly blue: this;
|
||||
readonly magenta: this;
|
||||
readonly cyan: this;
|
||||
readonly white: this;
|
||||
readonly gray: this;
|
||||
readonly grey: this;
|
||||
readonly blackBright: this;
|
||||
readonly redBright: this;
|
||||
readonly greenBright: this;
|
||||
readonly yellowBright: this;
|
||||
readonly blueBright: this;
|
||||
readonly magentaBright: this;
|
||||
readonly cyanBright: this;
|
||||
readonly whiteBright: this;
|
||||
|
||||
readonly bgBlack: this;
|
||||
readonly bgRed: this;
|
||||
readonly bgGreen: this;
|
||||
readonly bgYellow: this;
|
||||
readonly bgBlue: this;
|
||||
readonly bgMagenta: this;
|
||||
readonly bgCyan: this;
|
||||
readonly bgWhite: this;
|
||||
readonly bgBlackBright: this;
|
||||
readonly bgRedBright: this;
|
||||
readonly bgGreenBright: this;
|
||||
readonly bgYellowBright: this;
|
||||
readonly bgBlueBright: this;
|
||||
readonly bgMagentaBright: this;
|
||||
readonly bgCyanBright: this;
|
||||
readonly bgWhiteBright: this;
|
||||
}
|
||||
|
||||
declare const chalk: Chalk & { supportsColor: ColorSupport };
|
||||
|
||||
export default chalk
|
||||
39
node_modules/cli-cursor/index.js
generated
vendored
39
node_modules/cli-cursor/index.js
generated
vendored
@@ -1,39 +0,0 @@
|
||||
'use strict';
|
||||
const restoreCursor = require('restore-cursor');
|
||||
|
||||
let hidden = false;
|
||||
|
||||
exports.show = stream => {
|
||||
const s = stream || process.stderr;
|
||||
|
||||
if (!s.isTTY) {
|
||||
return;
|
||||
}
|
||||
|
||||
hidden = false;
|
||||
s.write('\u001b[?25h');
|
||||
};
|
||||
|
||||
exports.hide = stream => {
|
||||
const s = stream || process.stderr;
|
||||
|
||||
if (!s.isTTY) {
|
||||
return;
|
||||
}
|
||||
|
||||
restoreCursor();
|
||||
hidden = true;
|
||||
s.write('\u001b[?25l');
|
||||
};
|
||||
|
||||
exports.toggle = (force, stream) => {
|
||||
if (force !== undefined) {
|
||||
hidden = force;
|
||||
}
|
||||
|
||||
if (hidden) {
|
||||
exports.show(stream);
|
||||
} else {
|
||||
exports.hide(stream);
|
||||
}
|
||||
};
|
||||
21
node_modules/cli-cursor/license
generated
vendored
21
node_modules/cli-cursor/license
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
46
node_modules/cli-cursor/package.json
generated
vendored
46
node_modules/cli-cursor/package.json
generated
vendored
@@ -1,46 +0,0 @@
|
||||
{
|
||||
"name": "cli-cursor",
|
||||
"version": "2.1.0",
|
||||
"description": "Toggle the CLI cursor",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/cli-cursor",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"cli",
|
||||
"cursor",
|
||||
"ansi",
|
||||
"toggle",
|
||||
"display",
|
||||
"show",
|
||||
"hide",
|
||||
"term",
|
||||
"terminal",
|
||||
"console",
|
||||
"tty",
|
||||
"shell",
|
||||
"command-line"
|
||||
],
|
||||
"dependencies": {
|
||||
"restore-cursor": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
45
node_modules/cli-cursor/readme.md
generated
vendored
45
node_modules/cli-cursor/readme.md
generated
vendored
@@ -1,45 +0,0 @@
|
||||
# cli-cursor [](https://travis-ci.org/sindresorhus/cli-cursor)
|
||||
|
||||
> Toggle the CLI cursor
|
||||
|
||||
The cursor is [gracefully restored](https://github.com/sindresorhus/restore-cursor) if the process exits.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save cli-cursor
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const cliCursor = require('cli-cursor');
|
||||
|
||||
cliCursor.hide();
|
||||
|
||||
const unicornsAreAwesome = true;
|
||||
cliCursor.toggle(unicornsAreAwesome);
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### .show([stream])
|
||||
|
||||
### .hide([stream])
|
||||
|
||||
### .toggle(force, [stream])
|
||||
|
||||
`force` is useful to show or hide the cursor based on a boolean.
|
||||
|
||||
#### stream
|
||||
|
||||
Type: `Stream`<br>
|
||||
Default: `process.stderr`
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user