{"_id":"30-seconds-of-code","_rev":"15-3db2d45476ff3ef6eae281fc646685d1","name":"30-seconds-of-code","description":"A collection of useful JavaScript snippets.","dist-tags":{"latest":"1.2.3"},"versions":{"0.0.0":{"devDependencies":{"babel-preset-env":"^1.6.1","chalk":"^2.3.0","fs-extra":"^4.0.2","html-minifier":"^3.5.7","markdown-it":"^8.4.0","node-sass":"^4.7.2","prettier":"^1.9.2","rollup":"^0.53.2","rollup-plugin-babel":"^3.0.3","rollup-plugin-babel-minify":"^3.1.2","semistandard":"^11.0.0","tape":"^4.8.0"},"name":"30-seconds-of-code","description":"A collection of useful JavaScript snippets.","version":"0.0.0","main":"dist/_30s.js","module":"dist/_30s.esm.js","scripts":{"builder":"node ./scripts/build.js","linter":"node ./scripts/lint.js","tagger":"node ./scripts/tag.js","webber":"node ./scripts/web.js","tdd":"node ./scripts/tdd.js","module":"node ./scripts/module.js"},"repository":{"type":"git","url":"git+https://github.com/Chalarangelo/30-seconds-of-code.git"},"keywords":["javascript","snippets","list"],"author":{"name":"Chalarangelo","url":"chalarangelo@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/Chalarangelo/30-seconds-of-code/issues"},"homepage":"https://github.com/Chalarangelo/30-seconds-of-code#readme","gitHead":"3eaf920db28e81c1faacb9332e48322f94523c44","_id":"30-seconds-of-code@0.0.0","_npmVersion":"5.5.1","_nodeVersion":"8.8.1","_npmUser":{"name":"chalarangelo","email":"chalarangelo@gmail.com"},"dist":{"integrity":"sha512-uZ+NTpsxPjNDuN3NHnGTyxRLVzG7XJTtTUXohCSXeEsooyxijGb6B35LK9aVDryXAkakH3034AWc2Bve4cL2Hg==","shasum":"2a8f343fe40891188c3ad7413c841fd9a402ca66","tarball":"https://registry.npmjs.org/30-seconds-of-code/-/30-seconds-of-code-0.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDzqW0nvY+mrLOK7JLSQsLwV3EGwkcZlUVBGKcVmEoapwIgZfa4lykGpTXUSQUknA35v43TmbFuof6EzgY5OHLQ6kg="}]},"maintainers":[{"name":"chalarangelo","email":"chalarangelo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/30-seconds-of-code-0.0.0.tgz_1514927610231_0.1988055424299091"},"directories":{}},"0.0.1":{"devDependencies":{"babel-preset-env":"^1.6.1","chalk":"^2.3.0","fs-extra":"^4.0.2","html-minifier":"^3.5.7","markdown-it":"^8.4.0","node-sass":"^4.7.2","prettier":"^1.9.2","rollup":"^0.53.2","rollup-plugin-babel":"^3.0.3","rollup-plugin-babel-minify":"^3.1.2","semistandard":"^11.0.0","tape":"^4.8.0"},"name":"30-seconds-of-code","description":"A collection of useful JavaScript snippets.","version":"0.0.1","main":"dist/_30s.js","module":"dist/_30s.esm.js","scripts":{"builder":"node ./scripts/build.js","linter":"node ./scripts/lint.js","tagger":"node ./scripts/tag.js","webber":"node ./scripts/web.js","tdd":"node ./scripts/tdd.js","module":"node ./scripts/module.js"},"repository":{"type":"git","url":"git+https://github.com/Chalarangelo/30-seconds-of-code.git"},"keywords":["javascript","snippets","list"],"author":{"name":"Chalarangelo","url":"chalarangelo@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/Chalarangelo/30-seconds-of-code/issues"},"homepage":"https://github.com/Chalarangelo/30-seconds-of-code#readme","gitHead":"b74994e4f0bc747cbfd763fa6dd8e946aefdda24","_id":"30-seconds-of-code@0.0.1","_npmVersion":"5.5.1","_nodeVersion":"8.8.1","_npmUser":{"name":"chalarangelo","email":"chalarangelo@gmail.com"},"dist":{"integrity":"sha512-tvgKF1hwZ6siKzaOItBbuFZ35XP/XNMSpPqwtHkgTeP2esxnSw62ToY64rKtVE0NAqse7b3CVasq63zUCMMrJg==","shasum":"edfc4cc991fe9a5947dd01d9449fbc05748136a7","tarball":"https://registry.npmjs.org/30-seconds-of-code/-/30-seconds-of-code-0.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDPaw0N5TxJZumwyFeFEf8ibGVjCnAGZ670JWLL7p9meQIgEGFzYuuxvDGR4Gc0k0EZKTwV5Ohxy6E3xdSLKWABqQE="}]},"maintainers":[{"name":"chalarangelo","email":"chalarangelo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/30-seconds-of-code-0.0.1.tgz_1514927879693_0.5017745983786881"},"directories":{}},"0.0.2":{"devDependencies":{"babel-preset-env":"^1.6.1","chalk":"^2.3.0","fs-extra":"^4.0.2","html-minifier":"^3.5.7","jsdom":"^11.6.1","markdown-it":"^8.4.0","mini.css":"^2.3.7","node-sass":"^4.7.2","prettier":"^1.9.2","prismjs":"^1.9.0","rollup":"^0.53.2","rollup-plugin-babel":"^3.0.3","rollup-plugin-babel-minify":"^3.1.2","semistandard":"^11.0.0","tap-spec":"^4.1.1","tape":"^4.8.0"},"name":"30-seconds-of-code","description":"A collection of useful JavaScript snippets.","version":"0.0.2","main":"dist/_30s.js","module":"dist/_30s.esm.js","scripts":{"builder":"node ./scripts/build.js","linter":"node ./scripts/lint.js","tagger":"node ./scripts/tag.js","webber":"node ./scripts/web.js","tester":"node ./scripts/tdd.js","packager":"node ./scripts/module.js","localizer":"node ./scripts/localize.js","test":"tape test/**/*.test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/Chalarangelo/30-seconds-of-code.git"},"keywords":["javascript","snippets","list"],"author":{"name":"Chalarangelo","url":"chalarangelo@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/Chalarangelo/30-seconds-of-code/issues"},"homepage":"https://github.com/Chalarangelo/30-seconds-of-code#readme","dependencies":{},"gitHead":"9ef26a92497fade101445d9f2e3e08b49abd3b1a","_id":"30-seconds-of-code@0.0.2","_npmVersion":"5.5.1","_nodeVersion":"8.8.1","_npmUser":{"name":"chalarangelo","email":"chalarangelo@gmail.com"},"dist":{"integrity":"sha512-HFRDr62k20N/rRGs70g8ZyUiMx+wAcYjireyR1aUJ935gWdcK7Rbv7zm2v+7W8R5eXo1nnm0XKbwRSuZetclqw==","shasum":"25dba44774c171bc004fbb09e585f096717a0b55","tarball":"https://registry.npmjs.org/30-seconds-of-code/-/30-seconds-of-code-0.0.2.tgz","fileCount":299,"unpackedSize":789682,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGsdDpwm1DJIHPQlYMyCz3zBI2aqjJsCboA7TStmsI9DAiBcL6+6NK4fX9H5zyGRFLuCF/Zw3qqy2YzZprhbtwnVJg=="}]},"maintainers":[{"name":"30secondsofcode","email":"30secondsofcode@gmail.com"},{"name":"chalarangelo","email":"chalarangelo@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/30-seconds-of-code_0.0.2_1518783175035_0.3367988724458817"},"_hasShrinkwrap":false},"0.0.3":{"devDependencies":{"babel-preset-env":"^1.6.1","chalk":"^2.3.0","fs-extra":"^4.0.2","html-minifier":"^3.5.7","jsdom":"^11.6.1","markdown-it":"^8.4.0","mini.css":"^2.3.7","node-sass":"^4.7.2","prettier":"^1.9.2","prismjs":"^1.9.0","rollup":"^0.53.2","rollup-plugin-babel":"^3.0.3","rollup-plugin-babel-minify":"^3.1.2","semistandard":"^11.0.0","tap-spec":"^4.1.1","tape":"^4.8.0","octicons":"^7.2.0"},"name":"30-seconds-of-code","description":"A collection of useful JavaScript snippets.","version":"0.0.3","main":"dist/_30s.js","module":"dist/_30s.esm.js","scripts":{"builder":"node ./scripts/build.js","linter":"node ./scripts/lint.js","tagger":"node ./scripts/tag.js","webber":"node ./scripts/web.js","tester":"node ./scripts/tdd.js","packager":"node ./scripts/module.js","localizer":"node ./scripts/localize.js","test":"tape test/**/*.test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/Chalarangelo/30-seconds-of-code.git"},"keywords":["javascript","snippets","list"],"author":{"name":"Chalarangelo","url":"chalarangelo@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/Chalarangelo/30-seconds-of-code/issues"},"homepage":"https://github.com/Chalarangelo/30-seconds-of-code#readme","dependencies":{},"gitHead":"b0a4c7ebf7ffeba73093ac5fae18f0661d41b9bc","_id":"30-seconds-of-code@0.0.3","_npmVersion":"5.6.0","_nodeVersion":"9.7.1","_npmUser":{"name":"chalarangelo","email":"chalarangelo@gmail.com"},"dist":{"integrity":"sha512-IYWisb1nw6v0iQwG4OWkZZhUl4rawMd4Wep0rY4XrC7XQ8eYp7ChWCG851XSJMTTYqX3SuvTW1ejs8X6swd+JQ==","shasum":"08d539ad07b01696565f25d3ced78e49d94d1d76","tarball":"https://registry.npmjs.org/30-seconds-of-code/-/30-seconds-of-code-0.0.3.tgz","fileCount":308,"unpackedSize":813050,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCBpV22PfKEpJ+MRjyHsQzy5ZKqXu7rbhJ5y/ucyapl5wIgXjNOlhUTPij9gZ4sln+KPAlj6m2t0iHle5picwtmrc8="}]},"maintainers":[{"name":"30secondsofcode","email":"30secondsofcode@gmail.com"},{"name":"chalarangelo","email":"chalarangelo@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/30-seconds-of-code_0.0.3_1523122925407_0.15687573875959848"},"_hasShrinkwrap":false},"0.0.4":{"devDependencies":{"babel-preset-env":"^1.6.1","chalk":"^2.4.1","fs-extra":"^6.0.0","html-minifier":"^3.5.15","jest":"^23.1.0","jest-tap-reporter":"^1.9.0","markdown-it":"^8.4.1","mini.css":"^2.3.7","node-sass":"^4.9.0","octicons":"^7.2.0","prettier":"^1.12.1","prismjs":"^1.14.0","rollup":"^0.58.2","rollup-plugin-babel":"^3.0.4","rollup-plugin-babel-minify":"^4.0.0","semistandard":"^12.0.1"},"name":"30-seconds-of-code","description":"A collection of useful JavaScript snippets.","version":"0.0.4","main":"dist/_30s.js","module":"dist/_30s.esm.js","scripts":{"builder":"node ./scripts/build.js","linter":"node ./scripts/lint.js","tagger":"node ./scripts/tag.js","webber":"node ./scripts/web.js","tester":"node ./scripts/tdd.js","extractor":"node ./scripts/extract.js","packager":"node ./scripts/module.js","localizer":"node ./scripts/localize.js","analyzer":"node ./scripts/analyze.js","test":"jest --verbose"},"repository":{"type":"git","url":"git+https://github.com/Chalarangelo/30-seconds-of-code.git"},"keywords":["javascript","snippets","list"],"author":{"name":"Chalarangelo","url":"chalarangelo@gmail.com"},"license":"CC0-1.0","bugs":{"url":"https://github.com/Chalarangelo/30-seconds-of-code/issues"},"homepage":"https://github.com/Chalarangelo/30-seconds-of-code#readme","dependencies":{},"jest":{"reporters":[["jest-tap-reporter",{"logLevel":"INFO","showInternalStackTraces":false,"filePath":"test/testlog"}]]},"gitHead":"c9eb0b7c5b8630f544c48da8c79650fda94c3e23","_id":"30-seconds-of-code@0.0.4","_npmVersion":"5.6.0","_nodeVersion":"9.7.1","_npmUser":{"name":"chalarangelo","email":"chalarangelo@gmail.com"},"dist":{"integrity":"sha512-/diGjSo3LN5JtTdnQ+EUhC6p/5k8X6BFhqDJjc24FlKI/pqrdtplZWTqY9W+NI7WbPwCDVeumK0fShfLG2b2SA==","shasum":"efb879f95f02dedc089dbbca1fb3173c396b632d","tarball":"https://registry.npmjs.org/30-seconds-of-code/-/30-seconds-of-code-0.0.4.tgz","fileCount":330,"unpackedSize":1155782,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbSbSgCRA9TVsSAnZWagAA/KQP/3sOEwwyJFGNLxEQdGRU\nklrUoESyIwhyMzVyAv8X5/MYfPjinKF4DdeXsqHlekdWnOjmk3eccuODCGhC\nDUWIgE8BUZXBFoMNPGQSHE1PBDdJMmLnmtVBPPowrY0d1UnLSHm/rsYkx8JW\n/W5BpKI2epGY7fLe/oEXpUiq0hdTvPubwGEAhNNC9NAmMjLsj2+FdwExo6hT\nWwSdcfrlq5Q/lGhLbeaMn77CItnv8VicHaQW4pF0hgaR/dXYpjkx4oJGEHVJ\n7/GNdPpLp8Jv5Hfh/ErOBK9lO5ymAvbwgNlMtPtkQqKPTdFsO0EwwANkyp86\n2ne7NTuBpdNhINDmXgn+y2gFOYPr3+rpRk7hV3ITXNWGRmJ/HrhmUkgZvGzu\nj9HEbwx8tZV9cGxAzqJ5trRN9ELEABNDhOluWGl1mZerEJDJ4ez+4IgQJHGO\nBFe+tsb+6hF7mQezTrpYFIDxGza40aHZnMQUDXOL1E8EvA9ST0TsBo3+sFaY\neQXn83/0XfGt/z4dpzpR0IUBHbGZOBeib/gm1ueCG2cQRabQ0wJb4olK/dIa\niLsVCFKlITpDQULHb5C3kovyV/1wYpUNBoz/Yze6fbsRSLAWtPUWIaQRDWgY\nnHYWJHhwumS32ctoLinojaYFqExkclVFxK/KdGGp/fkxKYlcDB20K11vYO7q\nYHvU\r\n=tH6N\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFxCob6SIaMB/yhsz6IV6OvnlG7tIB6h0ox8DMhFTcWOAiEA+h7Zp5h4hsr04Hp7rQPKqprJEqVcfDmNIiYBu5bxJaA="}]},"maintainers":[{"name":"30secondsofcode","email":"30secondsofcode@gmail.com"},{"name":"chalarangelo","email":"chalarangelo@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/30-seconds-of-code_0.0.4_1531557023944_0.7073102824318729"},"_hasShrinkwrap":false},"1.0.0":{"devDependencies":{"babel-preset-env":"^1.6.1","chalk":"^2.4.1","fs-extra":"^6.0.0","html-minifier":"^3.5.15","jest":"^23.1.0","jest-tap-reporter":"^1.9.0","markdown-it":"^8.4.1","mini.css":"^2.3.7","node-sass":"^4.9.0","octicons":"^7.2.0","prettier":"^1.12.1","prismjs":"^1.14.0","rollup":"^0.58.2","rollup-plugin-babel":"^3.0.4","rollup-plugin-babel-minify":"^4.0.0","semistandard":"^12.0.1"},"name":"30-seconds-of-code","description":"A collection of useful JavaScript snippets.","version":"1.0.0","main":"dist/_30s.js","module":"dist/_30s.esm.js","scripts":{"builder":"node ./scripts/build.js","linter":"node ./scripts/lint.js","tagger":"node ./scripts/tag.js","webber":"node ./scripts/web.js","tester":"node ./scripts/tdd.js","extractor":"node ./scripts/extract.js","packager":"node ./scripts/module.js","localizer":"node ./scripts/localize.js","analyzer":"node ./scripts/analyze.js","test":"jest --verbose"},"repository":{"type":"git","url":"git+https://github.com/Chalarangelo/30-seconds-of-code.git"},"keywords":["javascript","snippets","list"],"author":{"name":"Chalarangelo","url":"chalarangelo@gmail.com"},"license":"CC0-1.0","bugs":{"url":"https://github.com/Chalarangelo/30-seconds-of-code/issues"},"homepage":"https://github.com/Chalarangelo/30-seconds-of-code#readme","dependencies":{},"jest":{"reporters":[["jest-tap-reporter",{"logLevel":"INFO","showInternalStackTraces":false,"filePath":"test/testlog"}]]},"gitHead":"3172cf8004f6c85c42d5eb47180564938672ef08","_id":"30-seconds-of-code@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.7.1","_npmUser":{"name":"chalarangelo","email":"chalarangelo@gmail.com"},"dist":{"integrity":"sha512-6KWzDT8YTBBZ1izPUweuEOqTab5vRDsslgzfyFvhQeTjciK4o7atUtJh+EoVHh6za9z6fIta8SYrhNIID9Vv4A==","shasum":"4fbae3418b29ab83c12f72a66806f56b594a8cdd","tarball":"https://registry.npmjs.org/30-seconds-of-code/-/30-seconds-of-code-1.0.0.tgz","fileCount":330,"unpackedSize":1155782,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbTMvnCRA9TVsSAnZWagAAEv8P/1uYpUNcJ6kI6sOyJkza\nphAbWHbs/IkI9E2QTGATJ1wW/RFhttDMicS+PazsSgeOfpNbTUh8P0QgioGU\nocLKuvHR90Ce1PtkVeHxzU9Eid5ITLgRSuKK6EBaqzKl/banXiURXCGR8ttb\nv4LSbYDchjs9l+ROawL/uG1DFdd0AFP9lGsk4lwgl9BnqW+C77jo9iie7hmG\nYenops2sH2+8kFnoeantyb7Fg3kZF5YK0cvgecTfld8Ne0f9ds/8ys/HGzBc\nO0/9raOMz86j4SzTgEgcG/Z0pnD8Fiy0UMEW2nxX2Ux4YytrcZQHY0lZV+2E\ntLWJaKKe58OE2Xf1FbF0Wltw85SKQPAFlFgb+F0nxxwJ1AOVDlLxYrxwxUC3\nW26vzMK/KY1llvRN1aMEGuGsMcy/MD6zwaFQT4eNSMDky79ypouRyHQ2DIJ7\nd/oJzZ+TygjCubmWDrkRxTSMralzMFcTvSRVwNmq5jucMrMICoch1IVNITcb\n357S/UEhYzsL3Zy6XZ/Be7bApDb4cFx/UsrfmbrkMfKqJnTtM+JAemD9lS4L\nl1Y6tL9R2Xijp8WvsNVTIdLjuXA51zq8hqkD/WCoPLUGv/PrjaU1yTlO4f/M\noHELUfS7PZ1Kktrl9fJhvG1qJTmJ/MZx/gXKVS83iCh8DXUa5xMnSaFAbIAO\nwgMA\r\n=bDoA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB7j3Vgv+AvjcjwE/CE25m1aGvzvuf+9y+bnJ4+rDL5NAiBXQR1G+fivd3prkeUWBhz15YezWV/D4mEyzny//qU3Gw=="}]},"maintainers":[{"name":"30secondsofcode","email":"30secondsofcode@gmail.com"},{"name":"chalarangelo","email":"chalarangelo@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/30-seconds-of-code_1.0.0_1531759591428_0.9646479556600178"},"_hasShrinkwrap":false},"1.1.0":{"devDependencies":{"babel-preset-env":"^1.7.0","chalk":"^2.4.1","fs-extra":"^6.0.0","html-minifier":"^3.5.20","jest":"^23.6.0","jest-tap-reporter":"^1.9.0","markdown-builder":"^0.8.4","markdown-it":"^8.4.2","mini.css":"^2.3.7","node-sass":"^4.9.3","octicons":"^7.4.0","prettier":"^1.14.2","prismjs":"^1.15.0","rollup":"^0.58.2","rollup-plugin-babel":"^3.0.7","rollup-plugin-babel-minify":"^4.0.0","semistandard":"^12.0.1"},"name":"30-seconds-of-code","description":"A collection of useful JavaScript snippets.","version":"1.1.0","main":"dist/_30s.js","module":"dist/_30s.esm.js","scripts":{"glossary:librarian":"node ./scripts/glossary/library.js","glossary:keymaker":"node ./scripts/glossary/keyword.js","builder":"node ./scripts/build.js","linter":"node ./scripts/lint.js","tagger":"node ./scripts/tag.js","webber":"node ./scripts/web.js","tester":"node ./scripts/tdd.js","extractor":"node ./scripts/extract.js","packager":"node ./scripts/module.js","localizer":"node ./scripts/localize.js","analyzer":"node ./scripts/analyze.js","test":"jest --verbose"},"repository":{"type":"git","url":"git+https://github.com/30-seconds/30-seconds-of-code.git"},"keywords":["javascript","snippets","list"],"author":{"name":"Chalarangelo","url":"chalarangelo@gmail.com"},"license":"CC0-1.0","bugs":{"url":"https://github.com/30-seconds/30-seconds-of-code/issues"},"homepage":"https://github.com/30-seconds/30-seconds-of-code#readme","dependencies":{},"jest":{"reporters":[["jest-tap-reporter",{"logLevel":"INFO","showInternalStackTraces":false,"filePath":"test/testlog"}]]},"gitHead":"5fb724b5199efa99c632b8e0136343f6763a544d","_id":"30-seconds-of-code@1.1.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"chalarangelo","email":"chalarangelo@gmail.com"},"dist":{"integrity":"sha512-Fa2p2U3sE7qGSxk5qt5cSjEskd6w76rKHQGYeGoH0RE5tCcq8WBJDdFcqtsYifNACNDnDPi8SG5xLGyCkIObkQ==","shasum":"cbfa20805434bd39dc629b98fa16491b7d0b2e7c","tarball":"https://registry.npmjs.org/30-seconds-of-code/-/30-seconds-of-code-1.1.0.tgz","fileCount":434,"unpackedSize":990093,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbpf4UCRA9TVsSAnZWagAAnaQP/juGHQIOH7sh2q+fCnUX\nBttlTrzJvpesrpXvECN8ywDEnki+cwFuT4i98ysppTKkiBe9siaZRbRx2NPR\nvKKQqfM0575UpQ8+sqk+Lq39DKbIVx9N+Ir1TErFK3ssFR5jA6+8gPxX1oom\nXyK7SDALdu12Fyd0cMsDGvD2FIu1u69a+OXcjlkXMTuwuXBNqoSBWe5pvWNL\n1gqZHsY5oR7T8m+cW6ncVPe7RE3vSBt/vZo23Yy5bBkTwNMZXMLBsQ9qRLlS\n6gP6XYoGu64yyw6GMGU1knZOo3ytsWQVy70psfrsP1nFJqXb2TTLCHTEUOfX\nkQZf6MI5FCDDOWlf32bDBcvCR0quI9eBBWIlrekDzRK7eU60NI5TcPp1SfN2\nZBVa0oCv6Twu9XhW5fBlcIEucNuzpwAlHU+d+AvzZCiV/xGDqVk2cfHC9CFX\no0aIkft7eXFO7N4Mm8pdxydXyFP9IiLOJTfOFIgzYLD45hQRVftJq+6hORyR\naUVNDl1tQFnO+0duV2Mb1JGPjzOdoQM2MBnKsqiBqKONBEyuw54ri5jC0PZ5\nPgXqM1GCCxaRHz95kiHsRngOYGxqxzMm41GfHWdBp+bWf/b9CsJd1BvO0aWZ\n+awsFqK6oSVYTEnFXpZs3yLrxjArhdkctSWG7LvyG1AqE3BGU60rkLUXUsJr\nF397\r\n=HSIW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBaSCN6WE8PUQAs0YEETHc712DdUCl3g11qfHojC6inZAiEApv5WETDdWRKTBNYkrACobP9QYAU35A2M/l+xcYgYrLE="}]},"maintainers":[{"name":"30secondsofcode","email":"30secondsofcode@gmail.com"},{"name":"chalarangelo","email":"chalarangelo@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/30-seconds-of-code_1.1.0_1537605139634_0.020160799795135853"},"_hasShrinkwrap":false},"1.2.0":{"devDependencies":{"@babel/core":"^7.1.2","@babel/preset-env":"^7.1.0","chalk":"^2.4.1","codacy-coverage":"^3.2.0","eslint":"^5.7.0","fs-extra":"^6.0.0","html-minifier":"^3.5.20","jest":"^23.6.0","markdown-builder":"^0.8.4","markdown-it":"^8.4.2","node-sass":"^4.9.3","octicons":"^7.4.0","prettier":"^1.14.2","prismjs":"^1.15.0","rollup":"^0.58.2","rollup-plugin-babel":"^4.0.3","rollup-plugin-babel-minify":"^4.0.0"},"name":"30-seconds-of-code","description":"A collection of useful JavaScript snippets.","version":"1.2.0","main":"dist/_30s.js","module":"dist/_30s.esm.js","scripts":{"glossary:librarian":"node ./scripts/glossary/library.js","glossary:keymaker":"node ./scripts/glossary/keyword.js","builder":"node ./scripts/build.js","linter":"node ./scripts/lint.js","tagger":"node ./scripts/tag.js","webber":"node ./scripts/web.js","tester":"node ./scripts/tdd.js","extractor":"node ./scripts/extract.js","vscoder":"node ./scripts/vscodegen.js","packager":"node ./scripts/module.js","localizer":"node ./scripts/localize.js","test":"jest --verbose","test-with-coverage":"jest --coverage && cat ./coverage/lcov.info | codacy-coverage"},"repository":{"type":"git","url":"https://30secondsofcode.org/"},"keywords":["javascript","snippets","list"],"author":{"name":"Chalarangelo","url":"chalarangelo@gmail.com"},"license":"CC0-1.0","bugs":{"url":"https://github.com/30-seconds/30-seconds-of-code/issues"},"homepage":"https://github.com/30-seconds/30-seconds-of-code#readme","dependencies":{},"gitHead":"8debe1dd4bb50732d538e92401ee43a8b21e6968","_id":"30-seconds-of-code@1.2.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"chalarangelo","email":"chalarangelo@gmail.com"},"dist":{"integrity":"sha512-Z/Q5mbSK2EpiD2p05/GxacYaME6u+zEQfKtstwDrALiAFCsDiMX3QHE4E56uBgkeQt0RBOHTv1r3DEnVFP82zg==","shasum":"22d6d894057fad598cd7e503b1ae03db53d80ca6","tarball":"https://registry.npmjs.org/30-seconds-of-code/-/30-seconds-of-code-1.2.0.tgz","fileCount":24,"unpackedSize":1497194,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5tu3CRA9TVsSAnZWagAAfRIP/3RiVmP0OSyN9uG6jdSr\nalUjge/6vmWv5nYL4NwGXdPs8o52VfefgwKW1YAu6P/SwMC85D8oyc1Se8MZ\nzjDvPQPsOEnbz+8RpE+ql++yZc9XyqWdsmqwFKzgd9fiGlGs2i+79CxPqVv5\nAMeFK0CacOclpob5wq/2U4d00/yYlbMql8YLAYMzSvReMoaqVh/3kjSR7hBO\n68mpwWtvUJUMVDGEjLlTZvYDtF2/c6r/bkjwyWtkbUyHe5rWD/OmLgOoig9Z\ngWTcefIv07UwctkDYAXIQVenn8aU7LMjT5cwNJoXaFelD/hIzyLGLy9Ru/XW\nFdcWj9HQKR+IsLBML3zto7DJ3O1xHV576WezDw5tEXP8hkaujURduCmZ5jJ8\nQPrpBprvAWre2cJEqBRjoa3urnvnCXOvH2VVgtYqmk9CZJEy9ZWA5WbjTDll\nA74/LRzGTDU14jWX1X0KDJA+3j1/2TNSfctDA7/wiLpId8Kp/iE3uGKptL23\n2xGNmQhN3R+GjsUE9y8tz59PxFHqg/e0w4clwkhS70QFL+mQY0lApl4lK6E4\ngfi9uhCO1jKrg5Ybe2dBe/WRouLQkrg7lXbB1vHq96eIrlHUc0vpiYUivlj4\nS/4B+Dph/1j4cos8AwpTWwHL8ILcQ491mPnP/LI6gOcXdhpGqHG2mEYvcCo4\nN1T/\r\n=gA1t\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCOmf5WbPF5sn/bljU0Qbp54kSYjaSvUAUcCA9BjCcA+gIhAMWLqw64ZHxnblfQoX0WvFBRFHkqWOi3Tcaw0Dfg9xbl"}]},"maintainers":[{"name":"30secondsofcode","email":"30secondsofcode@gmail.com"},{"name":"chalarangelo","email":"chalarangelo@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/30-seconds-of-code_1.2.0_1541856181888_0.1345741405521399"},"_hasShrinkwrap":false},"1.2.1":{"devDependencies":{"@babel/core":"^7.1.2","@babel/preset-env":"^7.1.0","chalk":"^2.4.1","codacy-coverage":"^3.2.0","eslint":"^5.7.0","fs-extra":"^6.0.0","html-minifier":"^3.5.20","jest":"^23.6.0","markdown-builder":"^0.8.4","markdown-it":"^8.4.2","node-sass":"^4.9.3","octicons":"^7.4.0","prettier":"^1.14.2","prismjs":"^1.15.0","rollup":"^0.58.2","rollup-plugin-babel":"^4.0.3","rollup-plugin-babel-minify":"^4.0.0"},"name":"30-seconds-of-code","description":"A collection of useful JavaScript snippets.","version":"1.2.1","main":"dist/_30s.js","module":"dist/_30s.esm.js","scripts":{"glossary:librarian":"node ./scripts/glossary/library.js","glossary:keymaker":"node ./scripts/glossary/keyword.js","builder":"node ./scripts/build.js","linter":"node ./scripts/lint.js","tagger":"node ./scripts/tag.js","webber":"node ./scripts/web.js","tester":"node ./scripts/tdd.js","extractor":"node ./scripts/extract.js","vscoder":"node ./scripts/vscodegen.js","packager":"node ./scripts/module.js","localizer":"node ./scripts/localize.js","test":"jest --verbose","test-with-coverage":"jest --coverage && cat ./coverage/lcov.info | codacy-coverage"},"repository":{"type":"git","url":"git+https://github.com/30-seconds/30-seconds-of-code.git"},"keywords":["javascript","snippets","list"],"author":{"name":"Chalarangelo","url":"chalarangelo@gmail.com"},"license":"CC0-1.0","bugs":{"url":"https://github.com/30-seconds/30-seconds-of-code/issues"},"homepage":"https://30secondsofcode.org/","dependencies":{},"gitHead":"98e2ad4589d9ebc1dda5688e9e920158af3879da","_id":"30-seconds-of-code@1.2.1","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"chalarangelo","email":"chalarangelo@gmail.com"},"dist":{"integrity":"sha512-XkqzsW15ZITxOHhJF89ToP5f1SDfIbxlSO5qvCa5OdCQiza9JJSCvJPYzThHAIK1y8idDVTuMRoJjzBR2xBYzA==","shasum":"993bbe365c7f673b5b568053c96e2bddcb920fb3","tarball":"https://registry.npmjs.org/30-seconds-of-code/-/30-seconds-of-code-1.2.1.tgz","fileCount":24,"unpackedSize":1497195,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5twyCRA9TVsSAnZWagAAJXUP/3pSVyP2L7qTqOlsJFl0\nS1x5/12QHVGL7iC0yM1L3pYltsUqaZNIUsMRBAiH4t1llXduYvs/P0ofNqGd\nbr0y49ScAaf4b3WJjGCD9DJo9L29/kIhKwsvdqXAWBQaefUbRMOiMn0pcbWM\nv3xzbhvDWVQKjLh+PpPZXObBnwHDFcdWfGaUIuFmCJTphyj+7xAugZOWvlur\nkihYGuBbhBs54oMKlfhuKHEc+880nkV6Q5SikeQWrfnzSDkwKYuCGVPylKYg\n9cylWizsbSwQ/22QknvjpV6MmlwoV5bpnydbDxGsDCm6xxRU/KIbaqyOrsg+\nqcH+9kKE+RKmO1h+OQudPLu5C/I8WIigdGb5V8xcwZlyAEGIdeY22nXqx3JX\nmdPIrf0Ce9tSt/cRLtTziOirT0BiBFA8kNGnNqPfZ0AAw0GZt7krQ5KwJCPm\naP8bkhBEfhX+EpgUp9i1nbhK8JF9xQiwZdVs7Y0frWEkRjSnzmrfkIIhhBEd\ncb5OTUYKw7Mhjqkqk7ZO9QuFR4C72qhnIy7DDlnUNTVKGCfJek6MMSmDKtFt\npLbiHM1Ao1dV1JwRWzb4r66bmyKLWoe/+QRBdq8uW+PCeBLwAYNv1kXWObMv\noSIJ5PsPtvWOkZ5JfjqdXgti8EWT0kot4iyg5136d319gkn/CWdRjYMGfuzP\nfyge\r\n=o2tX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHrPR5eTeYabFJHwzqaLPmW4847HIw5ZTutS9Z+bydJ6AiEA9OtGyI+TGBbdRlR+3XwKr58buRwk986W87mi3riIyv8="}]},"maintainers":[{"name":"30secondsofcode","email":"30secondsofcode@gmail.com"},{"name":"chalarangelo","email":"chalarangelo@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/30-seconds-of-code_1.2.1_1541856305265_0.9309225246032038"},"_hasShrinkwrap":false},"1.2.2":{"devDependencies":{"@babel/core":"^7.1.2","@babel/preset-env":"^7.1.0","chalk":"^2.4.1","codacy-coverage":"^3.2.0","eslint":"^5.7.0","fs-extra":"^6.0.0","html-minifier":"^3.5.20","jest":"^23.6.0","markdown-builder":"^0.8.4","markdown-it":"^8.4.2","node-sass":"^4.9.3","octicons":"^7.4.0","prettier":"^1.14.2","prismjs":"^1.15.0","rollup":"^0.58.2","rollup-plugin-babel":"^4.0.3","rollup-plugin-babel-minify":"^4.0.0"},"name":"30-seconds-of-code","description":"A collection of useful JavaScript snippets.","version":"1.2.2","main":"dist/_30s.js","module":"dist/_30s.esm.js","scripts":{"glossary:librarian":"node ./scripts/glossary/library.js","glossary:keymaker":"node ./scripts/glossary/keyword.js","builder":"node ./scripts/build.js","linter":"node ./scripts/lint.js","tagger":"node ./scripts/tag.js","webber":"node ./scripts/web.js","tester":"node ./scripts/tdd.js","extractor":"node ./scripts/extract.js","vscoder":"node ./scripts/vscodegen.js","packager":"node ./scripts/module.js","localizer":"node ./scripts/localize.js","test":"jest --verbose --coverage","test-with-coverage":"jest --coverage && cat ./coverage/lcov.info | codacy-coverage"},"repository":{"type":"git","url":"git+https://github.com/30-seconds/30-seconds-of-code.git"},"keywords":["javascript","snippets","list"],"author":{"name":"Chalarangelo","url":"chalarangelo@gmail.com"},"license":"CC0-1.0","bugs":{"url":"https://github.com/30-seconds/30-seconds-of-code/issues"},"homepage":"https://30secondsofcode.org/","dependencies":{},"gitHead":"278822912a8105c5e8162175930f23cfe00db2e1","_id":"30-seconds-of-code@1.2.2","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"chalarangelo","email":"chalarangelo@gmail.com"},"dist":{"integrity":"sha512-NtjTNli7X+aWHkvjhFwdKyM9q4vjmIzXClUJrNuXPZeYg378EM0eX2yMxolgp03xWZUpDpPkM6FdXzdjPaMIOw==","shasum":"007a573d46850c81e9ec191e8834109a4cb01a66","tarball":"https://registry.npmjs.org/30-seconds-of-code/-/30-seconds-of-code-1.2.2.tgz","fileCount":24,"unpackedSize":1497206,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5ugsCRA9TVsSAnZWagAAvb4P/1COVZakqZRkxqCJa4kr\nKerP9hdt/Ct8W8bYnA6RteFSqqf8yVV0JnPcGxBg7Ar6eN1JoWUmqos9AnNJ\nFfwT1XFSo40yN7dgGue9olvnf7miDLEFQ3O+x1pnioNmq2RF/mPpRDpwW8Yu\nEKOZfMeasqwCbpK99K46WWinjqWZN0yAMcck72j1UBydaQ/F3nJcEU6Fa5lJ\nB/yoMzFFCilPdoB5G7pnUXhAqGUw6xjB2VH6CIwDNw5kUmkxfDFI6b5X6WQE\nrnWoPhYeRCf//MGcm3beymPqSzOaEs/a6kowMrjJzQLuB7TvjrQjxvwK1ukh\n/Rc+BGv0uvkzO9YcymEdvG+39e/UgQ7RENl7PpG6ByQ69D7yjl+ZNTBNuX1I\nyuVuj72JHG4z/meaxP9EGTVtRWbfp8maen3dY1Xepu3erS6GRbI20sy0Yh9n\nr96qjdRK6nCEu/J+OKan+iuOPi7UU1cQ6mQz7WPB98ovg+ufDHndfbtgbk6b\nHv1yPvOHDPRXoKP65IzHmhxnZghGTyFRL58yLru2Y22lvMPBptRxYxVHZ4Lc\nPfr66V6jn9PwoQkOHq4b6vUWcR1uBt4WIJ0YugEowh9w7H8MtVdEd8bHCh8O\nakAs1fOsXgEh8MI18tLlrB/iR8ycAObzeoHNfP//zSn7D5j4AT66+bQtqDBC\ngSuQ\r\n=m3ja\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICZrZgy89Msr0UJcV+Kvaq4buyuVIFOWdqWwep4XPdtGAiACv9r5JTCzaabGXnw7FRnPfxCHXYz59XDgZhfBVMECYw=="}]},"maintainers":[{"name":"30secondsofcode","email":"30secondsofcode@gmail.com"},{"name":"chalarangelo","email":"chalarangelo@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/30-seconds-of-code_1.2.2_1541859371103_0.07185284932555147"},"_hasShrinkwrap":false},"1.2.3":{"devDependencies":{"@babel/core":"^7.1.2","@babel/preset-env":"^7.1.0","chalk":"^2.4.1","codacy-coverage":"^3.2.0","eslint":"^5.7.0","fs-extra":"^6.0.0","html-minifier":"^3.5.20","jest":"^23.6.0","markdown-builder":"^0.8.4","markdown-it":"^8.4.2","node-sass":"^4.9.3","octicons":"^7.4.0","prettier":"^1.14.2","prismjs":"^1.15.0","rollup":"^0.58.2","rollup-plugin-babel":"^4.0.3","rollup-plugin-babel-minify":"^4.0.0"},"name":"30-seconds-of-code","description":"A collection of useful JavaScript snippets.","version":"1.2.3","main":"dist/_30s.js","module":"dist/_30s.esm.js","sideEffects":false,"scripts":{"glossary:librarian":"node ./scripts/glossary/library.js","glossary:keymaker":"node ./scripts/glossary/keyword.js","builder":"node ./scripts/build.js","linter":"node ./scripts/lint.js","tagger":"node ./scripts/tag.js","webber":"node ./scripts/web.js","tester":"node ./scripts/tdd.js","extractor":"node ./scripts/extract.js","vscoder":"node ./scripts/vscodegen.js","packager":"node ./scripts/module.js","localizer":"node ./scripts/localize.js","test":"jest --verbose --coverage","test-with-coverage":"jest --coverage && cat ./coverage/lcov.info | codacy-coverage"},"repository":{"type":"git","url":"git+https://github.com/30-seconds/30-seconds-of-code.git"},"keywords":["javascript","snippets","list"],"author":{"name":"Chalarangelo","url":"chalarangelo@gmail.com"},"license":"CC0-1.0","bugs":{"url":"https://github.com/30-seconds/30-seconds-of-code/issues"},"homepage":"https://30secondsofcode.org/","dependencies":{},"gitHead":"0f1c7b00ef21a633ce8611854d680f7d17862567","_id":"30-seconds-of-code@1.2.3","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"chalarangelo","email":"chalarangelo@gmail.com"},"dist":{"integrity":"sha512-IRjJtNwmSfVLplKCOxHfjup1Z7Cq1IgDCvGiKf+6gFGq/eEVfYqwGaEQx+NH1vsQZkCJrg8YMfBKGNUnb+uI+w==","shasum":"b955acba83a050e3754fd0c84faaf25b32287fd4","tarball":"https://registry.npmjs.org/30-seconds-of-code/-/30-seconds-of-code-1.2.3.tgz","fileCount":13,"unpackedSize":805086,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcB+rKCRA9TVsSAnZWagAAzM0QAIjS+sYfSReF7Hdpe/0F\nT37pppy+9t92UGpqt8Diig8Zfwdwba8wrnb1oHMnsZ4JCywWTQ+ziqVQW1wi\nvRkz1PE0+1HwpFH7fXIkXYfLd/Ln/nHVC8W9/EB0v37qWilp7DpphOvyYjoc\nreHB9UfdDXr+kRpFfQjjCk6LkTKk9jL2hI0LBEE81qPe5iwti8dhaX0yco4N\nk2g+E5m7cZ7+1rkTfaY5Co+JCCzMV8P6vOK++OyB6ed+rF4K1CXkkoYXuQRd\nuRh6PpNzZMu8njrzI1E1DTvpHbhX3QLoz6wGhoCMKOCq3yVlROoy+7+PvQug\nmIGX4hXbEkA/roVwONno5bkUrR4CImfQUUJ9Jidz58W5Mj5eX+mt1eZRKsZb\nsVn9Jfcs9/Ka02dKgVEF4ZHMm6KspwD/k4SPxSerNeXVnIvYjSiqk+fIl7k1\nl01YTGOmw06MRisT18TTNcz/sl82a5kNJhuOLW7gTLzoSs5X0Mm0qGOe6BSb\nb+QqTgsBEfO2ulSNHqJkWFXdlWQ75Hhl0yYeHdkpdCK/rRrSeJhE4MR2Szh7\neXf3umCLxrCA8BK/6KXJLsAuhO2W4ZbdCkYoXzLJpJsiO31mAJCdzhxFAinS\nR+/mi3+dxzKUza8O4BXbw30wtoURRTa/vv894k1Zx55rj7KrVEeits7xP/EC\nN7oD\r\n=mccE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD9gOmag9D7OOg425D3H2SjRBEq4Ya6SP5bFaZpLJmeqgIgYqv8qUXivH0M0mHpwPnXulvT91VM3j/tmuUE0nXoYUY="}]},"maintainers":[{"name":"30secondsofcode","email":"30secondsofcode@gmail.com"},{"name":"chalarangelo","email":"chalarangelo@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/30-seconds-of-code_1.2.3_1544022729171_0.3847738894713484"},"_hasShrinkwrap":false}},"readme":"[![Logo](/logo.png)](https://30secondsofcode.org/)\n\n# 30 seconds of code\n\n[![License](https://img.shields.io/badge/license-CC0--1.0-blue.svg)](https://github.com/30-seconds/30-seconds-of-code/blob/master/LICENSE) [![npm Downloads](https://img.shields.io/npm/dt/30-seconds-of-code.svg)](https://www.npmjs.com/package/30-seconds-of-code) [![npm Version](https://img.shields.io/npm/v/30-seconds-of-code.svg)](https://www.npmjs.com/package/30-seconds-of-code) [![Known Vulnerabilities](https://snyk.io/test/github/30-seconds/30-seconds-of-code/badge.svg?targetFile=package.json)](https://snyk.io/test/github/30-seconds/30-seconds-of-code?targetFile=package.json) <br/> \n[![Travis Build](https://travis-ci.com/30-seconds/30-seconds-of-code.svg?branch=master)](https://travis-ci.com/30-seconds/30-seconds-of-code) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/6ab7791fb1ea40b4a576d658fb96807f)](https://www.codacy.com/app/Chalarangelo/30-seconds-of-code?utm_source=github.com&utm_medium=referral&utm_content=30-seconds/30-seconds-of-code&utm_campaign=Badge_Grade) [![Maintainability](https://api.codeclimate.com/v1/badges/4b8c1e099135f2d53413/maintainability)](https://codeclimate.com/github/30-seconds/30-seconds-of-code/maintainability) [![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg)](https://github.com/Flet/semistandard) <br/>\n[![Awesome](https://awesome.re/badge.svg)](https://awesome.re) [![ProductHunt](https://img.shields.io/badge/producthunt-vote-orange.svg)](https://www.producthunt.com/posts/30-seconds-of-code) [![Gitter chat](https://img.shields.io/badge/chat-on%20gitter-4FB999.svg)](https://gitter.im/30-seconds-of-code/Lobby) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)\n\n> Curated collection of useful JavaScript snippets that you can understand in 30 seconds or less.\n\n[![Sponsored by DigitalOcean](/sponsored_by_DigitalOcean.png)](https://www.digitalocean.com)\n\n* Use <kbd>Ctrl</kbd> + <kbd>F</kbd> or <kbd>command</kbd> + <kbd>F</kbd> to search for a snippet.\n* Contributions welcome, please read the [contribution guide](CONTRIBUTING.md).\n* Snippets are written in ES6, use the [Babel transpiler](https://babeljs.io/) to ensure backwards-compatibility.\n* You can import these snippets into VSCode, by following the instructions found [here](https://github.com/30-seconds/30-seconds-of-code/tree/master/vscode_snippets).\n* You can search, view and copy these snippets from a terminal, using the CLI application from [this repo](https://github.com/sQVe/30s).\n* If you want to follow 30-seconds-of-code on social media, you can find us on [Facebook](https://www.facebook.com/30secondsofcode), [Instagram](https://www.instagram.com/30secondsofcode) and [Twitter](https://twitter.com/30secondsofcode).\n\n#### Related projects\n\n* [30 Seconds of CSS](https://30-seconds.github.io/30-seconds-of-css/)\n* [30 Seconds of Interviews](https://30secondsofinterviews.org/)\n* [30 Seconds of React](https://github.com/30-seconds/30-seconds-of-react)\n* [30 Seconds of Python](https://github.com/kriadmin/30-seconds-of-python-code) _(unofficial)_\n* [30 Seconds of PHP](https://github.com/appzcoder/30-seconds-of-php-code) _(unofficial)_\n\n#### Package\n\n⚠️ **NOTICE:** A few of our snippets are not yet optimized for production (see disclaimers for individual snippet issues).\n\nYou can find a package with all the snippets on [npm](https://www.npmjs.com/package/30-seconds-of-code).\n\n```bash\n# With npm\nnpm install 30-seconds-of-code\n\n# With yarn\nyarn add 30-seconds-of-code\n```\n\n[CDN link](https://unpkg.com/30-seconds-of-code/)\n\n<details>\n<summary>Details</summary>\n\n**Browser**\n\n```html\n<script src=\"https://unpkg.com/30-seconds-of-code@1/dist/_30s.es5.min.js\"></script>\n<script>\n  _30s.average(1, 2, 3);\n</script>\n```\n\n**Node**\n\n```js\n// CommonJS\nconst _30s = require('30-seconds-of-code');\n_30s.average(1, 2, 3);\n\n// ES Modules\nimport _30s from '30-seconds-of-code';\n_30s.average(1, 2, 3);\n```\n\n</details>\n\n## Contents\n\n### 🔌 Adapter\n\n<details>\n<summary>View contents</summary>\n\n* [`ary`](#ary)\n* [`call`](#call)\n* [`collectInto`](#collectinto)\n* [`flip`](#flip)\n* [`over`](#over)\n* [`overArgs`](#overargs)\n* [`pipeAsyncFunctions`](#pipeasyncfunctions)\n* [`pipeFunctions`](#pipefunctions)\n* [`promisify`](#promisify)\n* [`rearg`](#rearg)\n* [`spreadOver`](#spreadover)\n* [`unary`](#unary)\n\n</details>\n\n### 📚 Array\n\n<details>\n<summary>View contents</summary>\n\n* [`all`](#all)\n* [`allEqual`](#allequal)\n* [`any`](#any)\n* [`arrayToCSV`](#arraytocsv)\n* [`bifurcate`](#bifurcate)\n* [`bifurcateBy`](#bifurcateby)\n* [`chunk`](#chunk)\n* [`compact`](#compact)\n* [`countBy`](#countby)\n* [`countOccurrences`](#countoccurrences)\n* [`deepFlatten`](#deepflatten)\n* [`difference`](#difference)\n* [`differenceBy`](#differenceby)\n* [`differenceWith`](#differencewith)\n* [`drop`](#drop)\n* [`dropRight`](#dropright)\n* [`dropRightWhile`](#droprightwhile)\n* [`dropWhile`](#dropwhile)\n* [`everyNth`](#everynth)\n* [`filterNonUnique`](#filternonunique)\n* [`filterNonUniqueBy`](#filternonuniqueby)\n* [`findLast`](#findlast)\n* [`findLastIndex`](#findlastindex)\n* [`flatten`](#flatten)\n* [`forEachRight`](#foreachright)\n* [`groupBy`](#groupby)\n* [`head`](#head)\n* [`indexOfAll`](#indexofall)\n* [`initial`](#initial)\n* [`initialize2DArray`](#initialize2darray)\n* [`initializeArrayWithRange`](#initializearraywithrange)\n* [`initializeArrayWithRangeRight`](#initializearraywithrangeright)\n* [`initializeArrayWithValues`](#initializearraywithvalues)\n* [`initializeNDArray`](#initializendarray)\n* [`intersection`](#intersection)\n* [`intersectionBy`](#intersectionby)\n* [`intersectionWith`](#intersectionwith)\n* [`isSorted`](#issorted)\n* [`join`](#join)\n* [`JSONtoCSV`](#jsontocsv-)\n* [`last`](#last)\n* [`longestItem`](#longestitem)\n* [`mapObject`](#mapobject-)\n* [`maxN`](#maxn)\n* [`minN`](#minn)\n* [`none`](#none)\n* [`nthElement`](#nthelement)\n* [`offset`](#offset)\n* [`partition`](#partition)\n* [`permutations`](#permutations-)\n* [`pull`](#pull)\n* [`pullAtIndex`](#pullatindex-)\n* [`pullAtValue`](#pullatvalue-)\n* [`pullBy`](#pullby-)\n* [`reducedFilter`](#reducedfilter)\n* [`reduceSuccessive`](#reducesuccessive)\n* [`reduceWhich`](#reducewhich)\n* [`reject`](#reject)\n* [`remove`](#remove)\n* [`sample`](#sample)\n* [`sampleSize`](#samplesize)\n* [`shank`](#shank)\n* [`shuffle`](#shuffle)\n* [`similarity`](#similarity)\n* [`sortedIndex`](#sortedindex)\n* [`sortedIndexBy`](#sortedindexby)\n* [`sortedLastIndex`](#sortedlastindex)\n* [`sortedLastIndexBy`](#sortedlastindexby)\n* [`stableSort`](#stablesort-)\n* [`symmetricDifference`](#symmetricdifference)\n* [`symmetricDifferenceBy`](#symmetricdifferenceby)\n* [`symmetricDifferenceWith`](#symmetricdifferencewith)\n* [`tail`](#tail)\n* [`take`](#take)\n* [`takeRight`](#takeright)\n* [`takeRightWhile`](#takerightwhile)\n* [`takeWhile`](#takewhile)\n* [`toHash`](#tohash)\n* [`union`](#union)\n* [`unionBy`](#unionby)\n* [`unionWith`](#unionwith)\n* [`uniqueElements`](#uniqueelements)\n* [`uniqueElementsBy`](#uniqueelementsby)\n* [`uniqueElementsByRight`](#uniqueelementsbyright)\n* [`uniqueSymmetricDifference`](#uniquesymmetricdifference)\n* [`unzip`](#unzip)\n* [`unzipWith`](#unzipwith-)\n* [`without`](#without)\n* [`xProd`](#xprod)\n* [`zip`](#zip)\n* [`zipObject`](#zipobject)\n* [`zipWith`](#zipwith-)\n\n</details>\n\n### 🌐 Browser\n\n<details>\n<summary>View contents</summary>\n\n* [`arrayToHtmlList`](#arraytohtmllist)\n* [`bottomVisible`](#bottomvisible)\n* [`copyToClipboard`](#copytoclipboard-)\n* [`counter`](#counter-)\n* [`createElement`](#createelement)\n* [`createEventHub`](#createeventhub-)\n* [`currentURL`](#currenturl)\n* [`detectDeviceType`](#detectdevicetype)\n* [`elementContains`](#elementcontains)\n* [`elementIsVisibleInViewport`](#elementisvisibleinviewport-)\n* [`getImages`](#getimages)\n* [`getScrollPosition`](#getscrollposition)\n* [`getStyle`](#getstyle)\n* [`hasClass`](#hasclass)\n* [`hashBrowser`](#hashbrowser-)\n* [`hide`](#hide)\n* [`httpsRedirect`](#httpsredirect)\n* [`insertAfter`](#insertafter)\n* [`insertBefore`](#insertbefore)\n* [`isBrowserTabFocused`](#isbrowsertabfocused)\n* [`nodeListToArray`](#nodelisttoarray)\n* [`observeMutations`](#observemutations-)\n* [`off`](#off)\n* [`on`](#on)\n* [`onUserInputChange`](#onuserinputchange-)\n* [`prefix`](#prefix)\n* [`recordAnimationFrames`](#recordanimationframes)\n* [`redirect`](#redirect)\n* [`runAsync`](#runasync-)\n* [`scrollToTop`](#scrolltotop)\n* [`setStyle`](#setstyle)\n* [`show`](#show)\n* [`smoothScroll`](#smoothscroll)\n* [`toggleClass`](#toggleclass)\n* [`triggerEvent`](#triggerevent)\n* [`UUIDGeneratorBrowser`](#uuidgeneratorbrowser)\n\n</details>\n\n### ⏱️ Date\n\n<details>\n<summary>View contents</summary>\n\n* [`dayOfYear`](#dayofyear)\n* [`formatDuration`](#formatduration)\n* [`getColonTimeFromDate`](#getcolontimefromdate)\n* [`getDaysDiffBetweenDates`](#getdaysdiffbetweendates)\n* [`getMeridiemSuffixOfInteger`](#getmeridiemsuffixofinteger)\n* [`isAfterDate`](#isafterdate)\n* [`isBeforeDate`](#isbeforedate)\n* [`isSameDate`](#issamedate)\n* [`maxDate`](#maxdate)\n* [`minDate`](#mindate)\n* [`tomorrow`](#tomorrow)\n\n</details>\n\n### 🎛️ Function\n\n<details>\n<summary>View contents</summary>\n\n* [`attempt`](#attempt)\n* [`bind`](#bind)\n* [`bindKey`](#bindkey)\n* [`chainAsync`](#chainasync)\n* [`compose`](#compose)\n* [`composeRight`](#composeright)\n* [`converge`](#converge)\n* [`curry`](#curry)\n* [`debounce`](#debounce)\n* [`defer`](#defer)\n* [`delay`](#delay)\n* [`functionName`](#functionname)\n* [`hz`](#hz)\n* [`memoize`](#memoize-)\n* [`negate`](#negate)\n* [`once`](#once)\n* [`partial`](#partial)\n* [`partialRight`](#partialright)\n* [`runPromisesInSeries`](#runpromisesinseries)\n* [`sleep`](#sleep)\n* [`throttle`](#throttle-)\n* [`times`](#times)\n* [`uncurry`](#uncurry)\n* [`unfold`](#unfold)\n* [`when`](#when)\n\n</details>\n\n### ➗ Math\n\n<details>\n<summary>View contents</summary>\n\n* [`approximatelyEqual`](#approximatelyequal)\n* [`average`](#average)\n* [`averageBy`](#averageby)\n* [`binomialCoefficient`](#binomialcoefficient)\n* [`clampNumber`](#clampnumber)\n* [`degreesToRads`](#degreestorads)\n* [`digitize`](#digitize)\n* [`distance`](#distance)\n* [`elo`](#elo-)\n* [`factorial`](#factorial)\n* [`fibonacci`](#fibonacci)\n* [`gcd`](#gcd)\n* [`geometricProgression`](#geometricprogression)\n* [`hammingDistance`](#hammingdistance)\n* [`inRange`](#inrange)\n* [`isDivisible`](#isdivisible)\n* [`isEven`](#iseven)\n* [`isNegativeZero`](#isnegativezero)\n* [`isPrime`](#isprime)\n* [`lcm`](#lcm)\n* [`luhnCheck`](#luhncheck-)\n* [`maxBy`](#maxby)\n* [`median`](#median)\n* [`minBy`](#minby)\n* [`percentile`](#percentile)\n* [`powerset`](#powerset)\n* [`primes`](#primes)\n* [`radsToDegrees`](#radstodegrees)\n* [`randomIntArrayInRange`](#randomintarrayinrange)\n* [`randomIntegerInRange`](#randomintegerinrange)\n* [`randomNumberInRange`](#randomnumberinrange)\n* [`round`](#round)\n* [`sdbm`](#sdbm)\n* [`standardDeviation`](#standarddeviation)\n* [`sum`](#sum)\n* [`sumBy`](#sumby)\n* [`sumPower`](#sumpower)\n* [`toSafeInteger`](#tosafeinteger)\n\n</details>\n\n### 📦 Node\n\n<details>\n<summary>View contents</summary>\n\n* [`atob`](#atob)\n* [`btoa`](#btoa)\n* [`colorize`](#colorize)\n* [`hasFlags`](#hasflags)\n* [`hashNode`](#hashnode)\n* [`isDuplexStream`](#isduplexstream)\n* [`isReadableStream`](#isreadablestream)\n* [`isStream`](#isstream)\n* [`isTravisCI`](#istravisci)\n* [`isWritableStream`](#iswritablestream)\n* [`JSONToFile`](#jsontofile)\n* [`readFileLines`](#readfilelines)\n* [`untildify`](#untildify)\n* [`UUIDGeneratorNode`](#uuidgeneratornode)\n\n</details>\n\n### 🗃️ Object\n\n<details>\n<summary>View contents</summary>\n\n* [`bindAll`](#bindall)\n* [`deepClone`](#deepclone)\n* [`deepFreeze`](#deepfreeze)\n* [`defaults`](#defaults)\n* [`dig`](#dig)\n* [`equals`](#equals-)\n* [`findKey`](#findkey)\n* [`findLastKey`](#findlastkey)\n* [`flattenObject`](#flattenobject)\n* [`forOwn`](#forown)\n* [`forOwnRight`](#forownright)\n* [`functions`](#functions)\n* [`get`](#get)\n* [`invertKeyValues`](#invertkeyvalues)\n* [`lowercaseKeys`](#lowercasekeys)\n* [`mapKeys`](#mapkeys)\n* [`mapValues`](#mapvalues)\n* [`matches`](#matches)\n* [`matchesWith`](#matcheswith)\n* [`merge`](#merge)\n* [`nest`](#nest)\n* [`objectFromPairs`](#objectfrompairs)\n* [`objectToPairs`](#objecttopairs)\n* [`omit`](#omit)\n* [`omitBy`](#omitby)\n* [`orderBy`](#orderby)\n* [`pick`](#pick)\n* [`pickBy`](#pickby)\n* [`renameKeys`](#renamekeys)\n* [`shallowClone`](#shallowclone)\n* [`size`](#size)\n* [`transform`](#transform)\n* [`truthCheckCollection`](#truthcheckcollection)\n* [`unflattenObject`](#unflattenobject-)\n\n</details>\n\n### 📜 String\n\n<details>\n<summary>View contents</summary>\n\n* [`byteSize`](#bytesize)\n* [`capitalize`](#capitalize)\n* [`capitalizeEveryWord`](#capitalizeeveryword)\n* [`CSVToArray`](#csvtoarray)\n* [`CSVToJSON`](#csvtojson-)\n* [`decapitalize`](#decapitalize)\n* [`escapeHTML`](#escapehtml)\n* [`escapeRegExp`](#escaperegexp)\n* [`fromCamelCase`](#fromcamelcase)\n* [`indentString`](#indentstring)\n* [`isAbsoluteURL`](#isabsoluteurl)\n* [`isAnagram`](#isanagram)\n* [`isLowerCase`](#islowercase)\n* [`isUpperCase`](#isuppercase)\n* [`mapString`](#mapstring)\n* [`mask`](#mask)\n* [`pad`](#pad)\n* [`palindrome`](#palindrome)\n* [`pluralize`](#pluralize)\n* [`removeNonASCII`](#removenonascii)\n* [`reverseString`](#reversestring)\n* [`sortCharactersInString`](#sortcharactersinstring)\n* [`splitLines`](#splitlines)\n* [`stringPermutations`](#stringpermutations-)\n* [`stripHTMLTags`](#striphtmltags)\n* [`toCamelCase`](#tocamelcase)\n* [`toKebabCase`](#tokebabcase)\n* [`toSnakeCase`](#tosnakecase)\n* [`toTitleCase`](#totitlecase)\n* [`truncateString`](#truncatestring)\n* [`unescapeHTML`](#unescapehtml)\n* [`URLJoin`](#urljoin-)\n* [`words`](#words)\n\n</details>\n\n### 📃 Type\n\n<details>\n<summary>View contents</summary>\n\n* [`getType`](#gettype)\n* [`is`](#is)\n* [`isArrayLike`](#isarraylike)\n* [`isBoolean`](#isboolean)\n* [`isEmpty`](#isempty)\n* [`isFunction`](#isfunction)\n* [`isNil`](#isnil)\n* [`isNull`](#isnull)\n* [`isNumber`](#isnumber)\n* [`isObject`](#isobject)\n* [`isObjectLike`](#isobjectlike)\n* [`isPlainObject`](#isplainobject)\n* [`isPrimitive`](#isprimitive)\n* [`isPromiseLike`](#ispromiselike)\n* [`isString`](#isstring)\n* [`isSymbol`](#issymbol)\n* [`isUndefined`](#isundefined)\n* [`isValidJSON`](#isvalidjson)\n\n</details>\n\n### 🔧 Utility\n\n<details>\n<summary>View contents</summary>\n\n* [`castArray`](#castarray)\n* [`cloneRegExp`](#cloneregexp)\n* [`coalesce`](#coalesce)\n* [`coalesceFactory`](#coalescefactory)\n* [`extendHex`](#extendhex)\n* [`getURLParameters`](#geturlparameters)\n* [`hexToRGB`](#hextorgb-)\n* [`httpGet`](#httpget)\n* [`httpPost`](#httppost)\n* [`isBrowser`](#isbrowser)\n* [`mostPerformant`](#mostperformant)\n* [`nthArg`](#ntharg)\n* [`parseCookie`](#parsecookie)\n* [`prettyBytes`](#prettybytes-)\n* [`randomHexColorCode`](#randomhexcolorcode)\n* [`RGBToHex`](#rgbtohex)\n* [`serializeCookie`](#serializecookie)\n* [`timeTaken`](#timetaken)\n* [`toCurrency`](#tocurrency)\n* [`toDecimalMark`](#todecimalmark)\n* [`toOrdinalSuffix`](#toordinalsuffix)\n* [`validateNumber`](#validatenumber)\n* [`yesNo`](#yesno)\n\n</details>\n\n\n---\n\n## 🔌 Adapter\n\n### ary\n\nCreates a function that accepts up to `n` arguments, ignoring any additional arguments.\n\nCall the provided function, `fn`, with up to `n` arguments, using `Array.prototype.slice(0,n)` and the spread operator (`...`).\n\n```js\nconst ary = (fn, n) => (...args) => fn(...args.slice(0, n));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nconst firstTwoMax = ary(Math.max, 2);\n[[2, 6, 'a'], [8, 4, 6], [10]].map(x => firstTwoMax(...x)); // [6, 8, 10]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### call\r\n\r\nGiven a key and a set of arguments, call them when given a context. Primarily useful in composition.\r\n\r\nUse a closure to call a stored key with stored arguments.\r\n\r\n```js\nconst call = (key, ...args) => context => context[key](...args);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nPromise.resolve([1, 2, 3])\n  .then(call('map', x => 2 * x))\n  .then(console.log); // [ 2, 4, 6 ]\nconst map = call.bind(null, 'map');\nPromise.resolve([1, 2, 3])\n  .then(map(x => 2 * x))\n  .then(console.log); // [ 2, 4, 6 ]\n```\r\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### collectInto\r\n\r\nChanges a function that accepts an array into a variadic function.\r\n\r\nGiven a function, return a closure that collects all inputs into an array-accepting function.\r\n\r\n```js\nconst collectInto = fn => (...args) => fn(args);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nconst Pall = collectInto(Promise.all.bind(Promise));\nlet p1 = Promise.resolve(1);\nlet p2 = Promise.resolve(2);\nlet p3 = new Promise(resolve => setTimeout(resolve, 2000, 3));\nPall(p1, p2, p3).then(console.log); // [1, 2, 3] (after about 2 seconds)\n```\r\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### flip\r\n\r\nFlip takes a function as an argument, then makes the first argument the last.\r\n\r\nReturn a closure that takes variadic inputs, and splices the last argument to make it the first argument before applying the rest.\r\n\r\n```js\nconst flip = fn => (first, ...rest) => fn(...rest, first);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nlet a = { name: 'John Smith' };\nlet b = {};\nconst mergeFrom = flip(Object.assign);\nlet mergePerson = mergeFrom.bind(null, a);\nmergePerson(b); // == b\nb = {};\nObject.assign(b, a); // == b\n```\r\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### over\n\nCreates a function that invokes each provided function with the arguments it receives and returns the results.\n\nUse `Array.prototype.map()` and `Function.prototype.apply()` to apply each function to the given arguments.\n\n```js\nconst over = (...fns) => (...args) => fns.map(fn => fn.apply(null, args));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nconst minMax = over(Math.min, Math.max);\nminMax(1, 2, 3, 4, 5); // [1,5]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### overArgs\n\nCreates a function that invokes the provided function with its arguments transformed.\n\nUse `Array.prototype.map()` to apply `transforms` to `args` in combination with the spread operator (`...`) to pass the transformed arguments to `fn`.\n\n```js\nconst overArgs = (fn, transforms) => (...args) => fn(...args.map((val, i) => transforms[i](val)));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nconst square = n => n * n;\nconst double = n => n * 2;\nconst fn = overArgs((x, y) => [x, y], [square, double]);\nfn(9, 3); // [81, 6]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### pipeAsyncFunctions\n\nPerforms left-to-right function composition for asynchronous functions.\n\nUse `Array.prototype.reduce()` with the spread operator (`...`) to perform left-to-right function composition using `Promise.then()`.\nThe functions can return a combination of: simple values, `Promise`'s, or they can be defined as `async` ones returning through `await`.\nAll functions must be unary.\n\n```js\nconst pipeAsyncFunctions = (...fns) => arg => fns.reduce((p, f) => p.then(f), Promise.resolve(arg));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nconst sum = pipeAsyncFunctions(\n  x => x + 1,\n  x => new Promise(resolve => setTimeout(() => resolve(x + 2), 1000)),\n  x => x + 3,\n  async x => (await x) + 4\n);\n(async() => {\n  console.log(await sum(5)); // 15 (after one second)\n})();\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### pipeFunctions\n\nPerforms left-to-right function composition.\n\nUse `Array.prototype.reduce()` with the spread operator (`...`) to perform left-to-right function composition.\nThe first (leftmost) function can accept one or more arguments; the remaining functions must be unary.\n\n```js\nconst pipeFunctions = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args)));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nconst add5 = x => x + 5;\nconst multiply = (x, y) => x * y;\nconst multiplyAndAdd5 = pipeFunctions(multiply, add5);\nmultiplyAndAdd5(5, 2); // 15\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### promisify\n\nConverts an asynchronous function to return a promise.\n\nUse currying to return a function returning a `Promise` that calls the original function.\nUse the `...rest` operator to pass in all the parameters.\n\n*In Node 8+, you can use [`util.promisify`](https://nodejs.org/api/util.html#util_util_promisify_original)*\n\n```js\nconst promisify = func => (...args) =>\n  new Promise((resolve, reject) =>\n    func(...args, (err, result) => (err ? reject(err) : resolve(result)))\n  );\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nconst delay = promisify((d, cb) => setTimeout(cb, d));\ndelay(2000).then(() => console.log('Hi!')); // // Promise resolves after 2s\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### rearg\n\nCreates a function that invokes the provided function with its arguments arranged according to the specified indexes.\n\nUse `Array.prototype.map()` to reorder arguments based on `indexes` in combination with the spread operator (`...`) to pass the transformed arguments to `fn`.\n\n```js\nconst rearg = (fn, indexes) => (...args) => fn(...indexes.map(i => args[i]));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nvar rearged = rearg(\n  function(a, b, c) {\n    return [a, b, c];\n  },\n  [2, 0, 1]\n);\nrearged('b', 'c', 'a'); // ['a', 'b', 'c']\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### spreadOver\r\n\r\nTakes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function.\r\n\r\nUse closures and the spread operator (`...`) to map the array of arguments to the inputs of the function.\r\n\r\n```js\nconst spreadOver = fn => argsArr => fn(...argsArr);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nconst arrayMax = spreadOver(Math.max);\narrayMax([1, 2, 3]); // 3\n```\r\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### unary\n\nCreates a function that accepts up to one argument, ignoring any additional arguments.\n\nCall the provided function, `fn`, with just the first argument given.\n\n```js\nconst unary = fn => val => fn(val);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\n['6', '8', '10'].map(unary(parseInt)); // [6, 8, 10]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n\n---\n\n## 📚 Array\n\n### all\n\nReturns `true` if the provided predicate function returns `true` for all elements in a collection, `false` otherwise.\n\nUse `Array.prototype.every()` to test if all elements in the collection return `true` based on `fn`.\nOmit the second argument, `fn`, to use `Boolean` as a default.\n\n```js\nconst all = (arr, fn = Boolean) => arr.every(fn);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nall([4, 2, 3], x => x > 1); // true\nall([1, 2, 3]); // true\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### allEqual\n\nCheck if all elements in an array are equal.\n\nUse `Array.prototype.every()` to check if all the elements of the array are the same as the first one.\n\n```js\nconst allEqual = arr => arr.every(val => val === arr[0]);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nallEqual([1, 2, 3, 4, 5, 6]); // false\nallEqual([1, 1, 1, 1]); // true\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### any\n\nReturns `true` if the provided predicate function returns `true` for at least one element in a collection, `false` otherwise.\n\nUse `Array.prototype.some()` to test if any elements in the collection return `true` based on `fn`.\nOmit the second argument, `fn`, to use `Boolean` as a default.\n\n```js\nconst any = (arr, fn = Boolean) => arr.some(fn);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nany([0, 1, 2, 0], x => x >= 2); // true\nany([0, 0, 1, 0]); // true\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### arrayToCSV\n\nConverts a 2D array to a comma-separated values (CSV) string.\n\nUse `Array.prototype.map()` and `Array.prototype.join(delimiter)` to combine individual 1D arrays (rows) into strings.\nUse `Array.prototype.join('\\n')` to combine all rows into a CSV string, separating each row with a newline.\nOmit the second argument, `delimiter`, to use a default delimiter of `,`.\n\n```js\nconst arrayToCSV = (arr, delimiter = ',') =>\n  arr.map(v => v.map(x => `\"${x}\"`).join(delimiter)).join('\\n');\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\narrayToCSV([['a', 'b'], ['c', 'd']]); // '\"a\",\"b\"\\n\"c\",\"d\"'\narrayToCSV([['a', 'b'], ['c', 'd']], ';'); // '\"a\";\"b\"\\n\"c\";\"d\"'\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### bifurcate\n\nSplits values into two groups. If an element in `filter` is truthy, the corresponding element in the collection belongs to the first group; otherwise, it belongs to the second group.\n\nUse `Array.prototype.reduce()` and `Array.prototype.push()` to add elements to groups, based on `filter`.\n\n```js\nconst bifurcate = (arr, filter) =>\n  arr.reduce((acc, val, i) => (acc[filter[i] ? 0 : 1].push(val), acc), [[], []]);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nbifurcate(['beep', 'boop', 'foo', 'bar'], [true, true, false, true]); // [ ['beep', 'boop', 'bar'], ['foo'] ]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### bifurcateBy\n\nSplits values into two groups according to a predicate function, which specifies which group an element in the input collection belongs to. If the predicate function returns a truthy value, the collection element belongs to the first group; otherwise, it belongs to the second group.\n\nUse `Array.prototype.reduce()` and `Array.prototype.push()` to add elements to groups, based on the value returned by `fn` for each element.\n\n```js\nconst bifurcateBy = (arr, fn) =>\n  arr.reduce((acc, val, i) => (acc[fn(val, i) ? 0 : 1].push(val), acc), [[], []]);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nbifurcateBy(['beep', 'boop', 'foo', 'bar'], x => x[0] === 'b'); // [ ['beep', 'boop', 'bar'], ['foo'] ]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### chunk\n\nChunks an array into smaller arrays of a specified size.\n\nUse `Array.from()` to create a new array, that fits the number of chunks that will be produced.\nUse `Array.prototype.slice()` to map each element of the new array to a chunk the length of `size`.\nIf the original array can't be split evenly, the final chunk will contain the remaining elements.\n\n```js\nconst chunk = (arr, size) =>\n  Array.from({ length: Math.ceil(arr.length / size) }, (v, i) =>\n    arr.slice(i * size, i * size + size)\n  );\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nchunk([1, 2, 3, 4, 5], 2); // [[1,2],[3,4],[5]]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### compact\n\nRemoves falsey values from an array.\n\nUse `Array.prototype.filter()` to filter out falsey values (`false`, `null`, `0`, `\"\"`, `undefined`, and `NaN`).\n\n```js\nconst compact = arr => arr.filter(Boolean);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ncompact([0, 1, false, 2, '', 3, 'a', 'e' * 23, NaN, 's', 34]); // [ 1, 2, 3, 'a', 's', 34 ]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### countBy\n\nGroups the elements of an array based on the given function and returns the count of elements in each group.\n\nUse `Array.prototype.map()` to map the values of an array to a function or property name.\nUse `Array.prototype.reduce()` to create an object, where the keys are produced from the mapped results.\n\n```js\nconst countBy = (arr, fn) =>\n  arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val) => {\n    acc[val] = (acc[val] || 0) + 1;\n    return acc;\n  }, {});\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ncountBy([6.1, 4.2, 6.3], Math.floor); // {4: 1, 6: 2}\ncountBy(['one', 'two', 'three'], 'length'); // {3: 2, 5: 1}\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### countOccurrences\n\nCounts the occurrences of a value in an array.\n\nUse `Array.prototype.reduce()` to increment a counter each time you encounter the specific value inside the array.\n\n```js\nconst countOccurrences = (arr, val) => arr.reduce((a, v) => (v === val ? a + 1 : a), 0);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ncountOccurrences([1, 1, 2, 1, 2, 3], 1); // 3\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### deepFlatten\n\nDeep flattens an array.\n\nUse recursion.\nUse `Array.prototype.concat()` with an empty array (`[]`) and the spread operator (`...`) to flatten an array.\nRecursively flatten each element that is an array.\n\n```js\nconst deepFlatten = arr => [].concat(...arr.map(v => (Array.isArray(v) ? deepFlatten(v) : v)));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ndeepFlatten([1, [2], [[3], 4], 5]); // [1,2,3,4,5]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### difference\n\nReturns the difference between two arrays.\n\nCreate a `Set` from `b`, then use `Array.prototype.filter()` on `a` to only keep values not contained in `b`.\n\n```js\nconst difference = (a, b) => {\n  const s = new Set(b);\n  return a.filter(x => !s.has(x));\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ndifference([1, 2, 3], [1, 2, 4]); // [3]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### differenceBy\n\nReturns the difference between two arrays, after applying the provided function to each array element of both.\n\nCreate a `Set` by applying `fn` to each element in `b`, then use `Array.prototype.filter()` in combination with `fn` on `a` to only keep values not contained in the previously created set.\n\n```js\nconst differenceBy = (a, b, fn) => {\n  const s = new Set(b.map(fn));\n  return a.filter(x => !s.has(fn(x)));\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ndifferenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); // [1.2]\ndifferenceBy([{ x: 2 }, { x: 1 }], [{ x: 1 }], v => v.x); // [ { x: 2 } ]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### differenceWith\n\nFilters out all values from an array for which the comparator function does not return `true`.\n\nUse `Array.prototype.filter()` and `Array.prototype.findIndex()` to find the appropriate values.\n\n```js\nconst differenceWith = (arr, val, comp) => arr.filter(a => val.findIndex(b => comp(a, b)) === -1);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ndifferenceWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0], (a, b) => Math.round(a) === Math.round(b)); // [1, 1.2]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### drop\n\nReturns a new array with `n` elements removed from the left.\n\nUse `Array.prototype.slice()` to slice the remove the specified number of elements from the left.\n\n```js\nconst drop = (arr, n = 1) => arr.slice(n);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ndrop([1, 2, 3]); // [2,3]\ndrop([1, 2, 3], 2); // [3]\ndrop([1, 2, 3], 42); // []\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### dropRight\n\nReturns a new array with `n` elements removed from the right.\n\nUse `Array.prototype.slice()` to slice the remove the specified number of elements from the right.\n\n```js\nconst dropRight = (arr, n = 1) => arr.slice(0, -n);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ndropRight([1, 2, 3]); // [1,2]\ndropRight([1, 2, 3], 2); // [1]\ndropRight([1, 2, 3], 42); // []\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### dropRightWhile\n\nRemoves elements from the end of an array until the passed function returns `true`. Returns the remaining elements in the array.\n\nLoop through the array, using `Array.prototype.slice()` to drop the last element of the array until the returned value from the function is `true`.\nReturns the remaining elements.\n\n```js\nconst dropRightWhile = (arr, func) => {\n  while (arr.length > 0 && !func(arr[arr.length - 1])) arr = arr.slice(0, -1);\n  return arr;\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ndropRightWhile([1, 2, 3, 4], n => n < 3); // [1, 2]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### dropWhile\n\nRemoves elements in an array until the passed function returns `true`. Returns the remaining elements in the array.\n\nLoop through the array, using `Array.prototype.slice()` to drop the first element of the array until the returned value from the function is `true`.\nReturns the remaining elements.\n\n```js\nconst dropWhile = (arr, func) => {\n  while (arr.length > 0 && !func(arr[0])) arr = arr.slice(1);\n  return arr;\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ndropWhile([1, 2, 3, 4], n => n >= 3); // [3,4]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### everyNth\n\nReturns every nth element in an array.\n\nUse `Array.prototype.filter()` to create a new array that contains every nth element of a given array.\n\n```js\nconst everyNth = (arr, nth) => arr.filter((e, i) => i % nth === nth - 1);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\neveryNth([1, 2, 3, 4, 5, 6], 2); // [ 2, 4, 6 ]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### filterNonUnique\n\nFilters out the non-unique values in an array.\n\nUse `Array.prototype.filter()` for an array containing only the unique values.\n\n```js\nconst filterNonUnique = arr => arr.filter(i => arr.indexOf(i) === arr.lastIndexOf(i));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nfilterNonUnique([1, 2, 2, 3, 4, 4, 5]); // [1, 3, 5]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### filterNonUniqueBy\n\nFilters out the non-unique values in an array, based on a provided comparator function.\n\nUse `Array.prototype.filter()` and `Array.prototype.every()` for an array containing only the unique values, based on the comparator function, `fn`.\nThe comparator function takes four arguments: the values of the two elements being compared and their indexes.\n\n```js\nconst filterNonUniqueBy = (arr, fn) =>\n  arr.filter((v, i) => arr.every((x, j) => (i === j) === fn(v, x, i, j)));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nfilterNonUniqueBy(\n  [\n    { id: 0, value: 'a' },\n    { id: 1, value: 'b' },\n    { id: 2, value: 'c' },\n    { id: 1, value: 'd' },\n    { id: 0, value: 'e' }\n  ],\n  (a, b) => a.id == b.id\n); // [ { id: 2, value: 'c' } ]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### findLast\n\nReturns the last element for which the provided function returns a truthy value.\n\nUse `Array.prototype.filter()` to remove elements for which `fn` returns falsey values, `Array.prototype.pop()` to get the last one.\n\n```js\nconst findLast = (arr, fn) => arr.filter(fn).pop();\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nfindLast([1, 2, 3, 4], n => n % 2 === 1); // 3\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### findLastIndex\n\nReturns the index of the last element for which the provided function returns a truthy value.\n\nUse `Array.prototype.map()` to map each element to an array with its index and value.\nUse `Array.prototype.filter()` to remove elements for which `fn` returns falsey values, `Array.prototype.pop()` to get the last one.\n\n```js\nconst findLastIndex = (arr, fn) =>\n  arr\n    .map((val, i) => [i, val])\n    .filter(([i, val]) => fn(val, i, arr))\n    .pop()[0];\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nfindLastIndex([1, 2, 3, 4], n => n % 2 === 1); // 2 (index of the value 3)\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### flatten\n\nFlattens an array up to the specified depth.\n\nUse recursion, decrementing `depth` by 1 for each level of depth.\nUse `Array.prototype.reduce()` and `Array.prototype.concat()` to merge elements or arrays.\nBase case, for `depth` equal to `1` stops recursion.\nOmit the second argument, `depth` to flatten only to a depth of `1` (single flatten).\n\n```js\nconst flatten = (arr, depth = 1) =>\n  arr.reduce((a, v) => a.concat(depth > 1 && Array.isArray(v) ? flatten(v, depth - 1) : v), []);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nflatten([1, [2], 3, 4]); // [1, 2, 3, 4]\nflatten([1, [2, [3, [4, 5], 6], 7], 8], 2); // [1, 2, 3, [4, 5], 6, 7, 8]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### forEachRight\n\nExecutes a provided function once for each array element, starting from the array's last element.\n\nUse `Array.prototype.slice(0)` to clone the given array, `Array.prototype.reverse()` to reverse it and `Array.prototype.forEach()` to iterate over the reversed array.\n\n```js\nconst forEachRight = (arr, callback) =>\n  arr\n    .slice(0)\n    .reverse()\n    .forEach(callback);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nforEachRight([1, 2, 3, 4], val => console.log(val)); // '4', '3', '2', '1'\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### groupBy\n\nGroups the elements of an array based on the given function.\n\nUse `Array.prototype.map()` to map the values of an array to a function or property name.\nUse `Array.prototype.reduce()` to create an object, where the keys are produced from the mapped results.\n\n```js\nconst groupBy = (arr, fn) =>\n  arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val, i) => {\n    acc[val] = (acc[val] || []).concat(arr[i]);\n    return acc;\n  }, {});\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ngroupBy([6.1, 4.2, 6.3], Math.floor); // {4: [4.2], 6: [6.1, 6.3]}\ngroupBy(['one', 'two', 'three'], 'length'); // {3: ['one', 'two'], 5: ['three']}\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### head\n\nReturns the head of a list.\n\nUse `arr[0]` to return the first element of the passed array.\n\n```js\nconst head = arr => arr[0];\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nhead([1, 2, 3]); // 1\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### indexOfAll\n\nReturns all indices of `val` in an array.\nIf `val` never occurs, returns `[]`.\n\nUse `Array.prototype.reduce()` to loop over elements and store indices for matching elements.\nReturn the array of indices.\n\n```js\nconst indexOfAll = (arr, val) => arr.reduce((acc, el, i) => (el === val ? [...acc, i] : acc), []);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nindexOfAll([1, 2, 3, 1, 2, 3], 1); // [0,3]\nindexOfAll([1, 2, 3], 4); // []\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### initial\n\nReturns all the elements of an array except the last one.\n\nUse `arr.slice(0,-1)` to return all but the last element of the array.\n\n```js\nconst initial = arr => arr.slice(0, -1);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ninitial([1, 2, 3]); // [1,2]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### initialize2DArray\n\nInitializes a 2D array of given width and height and value.\n\nUse `Array.prototype.map()` to generate h rows where each is a new array of size w initialize with value. If the value is not provided, default to `null`.\n\n```js\nconst initialize2DArray = (w, h, val = null) =>\n  Array.from({ length: h }).map(() => Array.from({ length: w }).fill(val));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ninitialize2DArray(2, 2, 0); // [[0,0], [0,0]]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### initializeArrayWithRange\n\nInitializes an array containing the numbers in the specified range where `start` and `end` are inclusive with their common difference `step`.\n\nUse `Array.from()` to create an array of the desired length, `(end - start + 1)/step`, and a map function to fill it with the desired values in the given range.\nYou can omit `start` to use a default value of `0`.\nYou can omit `step` to use a default value of `1`.\n\n```js\nconst initializeArrayWithRange = (end, start = 0, step = 1) =>\n  Array.from({ length: Math.ceil((end - start + 1) / step) }, (v, i) => i * step + start);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ninitializeArrayWithRange(5); // [0,1,2,3,4,5]\ninitializeArrayWithRange(7, 3); // [3,4,5,6,7]\ninitializeArrayWithRange(9, 0, 2); // [0,2,4,6,8]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### initializeArrayWithRangeRight\n\nInitializes an array containing the numbers in the specified range (in reverse) where `start` and `end` are inclusive with their common difference `step`.\n\nUse `Array.from(Math.ceil((end+1-start)/step))` to create an array of the desired length(the amounts of elements is equal to `(end-start)/step` or `(end+1-start)/step` for inclusive end), `Array.prototype.map()` to fill with the desired values in a range.\nYou can omit `start` to use a default value of `0`.\nYou can omit `step` to use a default value of `1`.\n\n```js\nconst initializeArrayWithRangeRight = (end, start = 0, step = 1) =>\n  Array.from({ length: Math.ceil((end + 1 - start) / step) }).map(\n    (v, i, arr) => (arr.length - i - 1) * step + start\n  );\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ninitializeArrayWithRangeRight(5); // [5,4,3,2,1,0]\ninitializeArrayWithRangeRight(7, 3); // [7,6,5,4,3]\ninitializeArrayWithRangeRight(9, 0, 2); // [8,6,4,2,0]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### initializeArrayWithValues\n\nInitializes and fills an array with the specified values.\n\nUse `Array(n)` to create an array of the desired length, `fill(v)` to fill it with the desired values.\nYou can omit `val` to use a default value of `0`.\n\n```js\nconst initializeArrayWithValues = (n, val = 0) => Array(n).fill(val);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ninitializeArrayWithValues(5, 2); // [2, 2, 2, 2, 2]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### initializeNDArray\n\nCreate a n-dimensional array with given value.\n\nUse recursion.\nUse `Array.prototype.map()` to generate rows where each is a new array initialized using `initializeNDArray`.\n\n```js\nconst initializeNDArray = (val, ...args) =>\n  args.length === 0\n    ? val\n    : Array.from({ length: args[0] }).map(() => initializeNDArray(val, ...args.slice(1)));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\ninitializeNDArray(1, 3); // [1,1,1]\ninitializeNDArray(5, 2, 2, 2); // [[[5,5],[5,5]],[[5,5],[5,5]]]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### intersection\n\nReturns a list of elements that exist in both arrays.\n\nCreate a `Set` from `b`, then use `Array.prototype.filter()` on `a` to only keep values contained in `b`.\n\n```js\nconst intersection = (a, b) => {\n  const s = new Set(b);\n  return a.filter(x => s.has(x));\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nintersection([1, 2, 3], [4, 3, 2]); // [2, 3]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### intersectionBy\n\nReturns a list of elements that exist in both arrays, after applying the provided function to each array element of both.\n\nCreate a `Set` by applying `fn` to all elements in `b`, then use `Array.prototype.filter()` on `a` to only keep elements, which produce values contained in `b` when `fn` is applied to them.\n\n```js\nconst intersectionBy = (a, b, fn) => {\n  const s = new Set(b.map(fn));\n  return a.filter(x => s.has(fn(x)));\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nintersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); // [2.1]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### intersectionWith\n\nReturns a list of elements that exist in both arrays, using a provided comparator function.\n\nUse `Array.prototype.filter()` and `Array.prototype.findIndex()` in combination with the provided comparator to determine intersecting values.\n\n```js\nconst intersectionWith = (a, b, comp) => a.filter(x => b.findIndex(y => comp(x, y)) !== -1);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nintersectionWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0, 3.9], (a, b) => Math.round(a) === Math.round(b)); // [1.5, 3, 0]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### isSorted\n\nReturns `1` if the array is sorted in ascending order, `-1` if it is sorted in descending order or `0` if it is not sorted.\n\nCalculate the ordering `direction` for the first two elements.\nUse `Object.entries()` to loop over array objects and compare them in pairs.\nReturn `0` if the `direction` changes or the `direction` if the last element is reached.\n\n```js\nconst isSorted = arr => {\n  let direction = -(arr[0] - arr[1]);\n  for (let [i, val] of arr.entries()) {\n    direction = !direction ? -(arr[i - 1] - arr[i]) : direction;\n    if (i === arr.length - 1) return !direction ? 0 : direction;\n    else if ((val - arr[i + 1]) * direction > 0) return 0;\n  }\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nisSorted([0, 1, 2, 2]); // 1\nisSorted([4, 3, 2]); // -1\nisSorted([4, 3, 5]); // 0\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### join\n\nJoins all elements of an array into a string and returns this string.\nUses a separator and an end separator.\n\nUse `Array.prototype.reduce()` to combine elements into a string.\nOmit the second argument, `separator`, to use a default separator of `','`.\nOmit the third argument, `end`, to use the same value as `separator` by default.\n\n```js\nconst join = (arr, separator = ',', end = separator) =>\n  arr.reduce(\n    (acc, val, i) =>\n      i === arr.length - 2\n        ? acc + val + end\n        : i === arr.length - 1\n          ? acc + val\n          : acc + val + separator,\n    ''\n  );\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\njoin(['pen', 'pineapple', 'apple', 'pen'], ',', '&'); // \"pen,pineapple,apple&pen\"\njoin(['pen', 'pineapple', 'apple', 'pen'], ','); // \"pen,pineapple,apple,pen\"\njoin(['pen', 'pineapple', 'apple', 'pen']); // \"pen,pineapple,apple,pen\"\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### JSONtoCSV ![advanced](/advanced.svg)\n\nConverts an array of objects to a comma-separated values (CSV) string that contains only the `columns` specified.\n\nUse `Array.prototype.join(delimiter)` to combine all the names in `columns` to create the first row.\nUse `Array.prototype.map()` and `Array.prototype.reduce()` to create a row for each object, substituting non-existent values with empty strings and only mapping values in `columns`.\nUse `Array.prototype.join('\\n')` to combine all rows into a string.\nOmit the third argument, `delimiter`, to use a default delimiter of `,`.\n\n```js\nconst JSONtoCSV = (arr, columns, delimiter = ',') =>\n  [\n    columns.join(delimiter),\n    ...arr.map(obj =>\n      columns.reduce(\n        (acc, key) => `${acc}${!acc.length ? '' : delimiter}\"${!obj[key] ? '' : obj[key]}\"`,\n        ''\n      )\n    )\n  ].join('\\n');\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nJSONtoCSV([{ a: 1, b: 2 }, { a: 3, b: 4, c: 5 }, { a: 6 }, { b: 7 }], ['a', 'b']); // 'a,b\\n\"1\",\"2\"\\n\"3\",\"4\"\\n\"6\",\"\"\\n\"\",\"7\"'\nJSONtoCSV([{ a: 1, b: 2 }, { a: 3, b: 4, c: 5 }, { a: 6 }, { b: 7 }], ['a', 'b'], ';'); // 'a;b\\n\"1\";\"2\"\\n\"3\";\"4\"\\n\"6\";\"\"\\n\"\";\"7\"'\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### last\n\nReturns the last element in an array.\n\nUse `arr.length - 1` to compute the index of the last element of the given array and returning it.\n\n```js\nconst last = arr => arr[arr.length - 1];\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nlast([1, 2, 3]); // 3\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### longestItem\n\nTakes any number of iterable objects or objects with a `length` property and returns the longest one.\nIf multiple objects have the same length, the first one will be returned.\nReturns `undefined` if no arguments are provided.\n\nUse `Array.prototype.reduce()`, comparing the `length` of objects to find the longest one.\n\n```js\nconst longestItem = (...vals) => vals.reduce((a, x) => (x.length > a.length ? x : a));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nlongestItem('this', 'is', 'a', 'testcase'); // 'testcase'\nlongestItem(...['a', 'ab', 'abc']); // 'abc'\nlongestItem(...['a', 'ab', 'abc'], 'abcd'); // 'abcd'\nlongestItem([1, 2, 3], [1, 2], [1, 2, 3, 4, 5]); // [1, 2, 3, 4, 5]\nlongestItem([1, 2, 3], 'foobar'); // 'foobar'\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### mapObject ![advanced](/advanced.svg)\n\nMaps the values of an array to an object using a function, where the key-value pairs consist of the original value as the key and the mapped value.\n\nUse an anonymous inner function scope to declare an undefined memory space, using closures to store a return value. Use a new `Array` to store the array with a map of the function over its data set and a comma operator to return a second step, without needing to move from one context to another (due to closures and order of operations).\n\n```js\nconst mapObject = (arr, fn) =>\n  (a => (\n    (a = [arr, arr.map(fn)]), a[0].reduce((acc, val, ind) => ((acc[val] = a[1][ind]), acc), {})\n  ))();\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nconst squareIt = arr => mapObject(arr, a => a * a);\nsquareIt([1, 2, 3]); // { 1: 1, 2: 4, 3: 9 }\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### maxN\n\nReturns the `n` maximum elements from the provided array.\nIf `n` is greater than or equal to the provided array's length, then return the original array (sorted in descending order).\n\nUse `Array.prototype.sort()` combined with the spread operator (`...`) to create a shallow clone of the array and sort it in descending order.\nUse `Array.prototype.slice()` to get the specified number of elements.\nOmit the second argument, `n`, to get a one-element array.\n\n```js\nconst maxN = (arr, n = 1) => [...arr].sort((a, b) => b - a).slice(0, n);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nmaxN([1, 2, 3]); // [3]\nmaxN([1, 2, 3], 2); // [3,2]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### minN\n\nReturns the `n` minimum elements from the provided array.\nIf `n` is greater than or equal to the provided array's length, then return the original array (sorted in ascending order).\n\nUse `Array.prototype.sort()` combined with the spread operator (`...`) to create a shallow clone of the array and sort it in ascending order.\nUse `Array.prototype.slice()` to get the specified number of elements.\nOmit the second argument, `n`, to get a one-element array.\n\n```js\nconst minN = (arr, n = 1) => [...arr].sort((a, b) => a - b).slice(0, n);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nminN([1, 2, 3]); // [1]\nminN([1, 2, 3], 2); // [1,2]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### none\n\nReturns `true` if the provided predicate function returns `false` for all elements in a collection, `false` otherwise.\n\nUse `Array.prototype.some()` to test if any elements in the collection return `true` based on `fn`.\nOmit the second argument, `fn`, to use `Boolean` as a default.\n\n```js\nconst none = (arr, fn = Boolean) => !arr.some(fn);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nnone([0, 1, 3, 0], x => x == 2); // true\nnone([0, 0, 0]); // true\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### nthElement\n\nReturns the nth element of an array.\n\nUse `Array.prototype.slice()` to get an array containing the nth element at the first place.\nIf the index is out of bounds, return `undefined`.\nOmit the second argument, `n`, to get the first element of the array.\n\n```js\nconst nthElement = (arr, n = 0) => (n === -1 ? arr.slice(n) : arr.slice(n, n + 1))[0];\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nnthElement(['a', 'b', 'c'], 1); // 'b'\nnthElement(['a', 'b', 'b'], -3); // 'a'\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### offset\n\nMoves the specified amount of elements to the end of the array.\n\nUse `Array.prototype.slice()` twice to get the elements after the specified index and the elements before that.\nUse the spread operator(`...`) to combine the two into one array.\nIf `offset` is negative, the elements will be moved from end to start.\n\n```js\nconst offset = (arr, offset) => [...arr.slice(offset), ...arr.slice(0, offset)];\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\noffset([1, 2, 3, 4, 5], 2); // [3, 4, 5, 1, 2]\noffset([1, 2, 3, 4, 5], -2); // [4, 5, 1, 2, 3]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### partition\n\nGroups the elements into two arrays, depending on the provided function's truthiness for each element.\n\nUse `Array.prototype.reduce()` to create an array of two arrays.\nUse `Array.prototype.push()` to add elements for which `fn` returns `true` to the first array and elements for which `fn` returns `false` to the second one.\n\n```js\nconst partition = (arr, fn) =>\n  arr.reduce(\n    (acc, val, i, arr) => {\n      acc[fn(val, i, arr) ? 0 : 1].push(val);\n      return acc;\n    },\n    [[], []]\n  );\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nconst users = [{ user: 'barney', age: 36, active: false }, { user: 'fred', age: 40, active: true }];\npartition(users, o => o.active); // [[{ 'user': 'fred',    'age': 40, 'active': true }],[{ 'user': 'barney',  'age': 36, 'active': false }]]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### permutations ![advanced](/advanced.svg)\n\n⚠️ **WARNING**: This function's execution time increases exponentially with each array element. Anything more than 8 to 10 entries will cause your browser to hang as it tries to solve all the different combinations.\n\nGenerates all permutations of an array's elements (contains duplicates).\n\nUse recursion.\nFor each element in the given array, create all the partial permutations for the rest of its elements.\nUse `Array.prototype.map()` to combine the element with each partial permutation, then `Array.prototype.reduce()` to combine all permutations in one array.\nBase cases are for array `length` equal to `2` or `1`.\n\n```js\nconst permutations = arr => {\n  if (arr.length <= 2) return arr.length === 2 ? [arr, [arr[1], arr[0]]] : arr;\n  return arr.reduce(\n    (acc, item, i) =>\n      acc.concat(\n        permutations([...arr.slice(0, i), ...arr.slice(i + 1)]).map(val => [item, ...val])\n      ),\n    []\n  );\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\npermutations([1, 33, 5]); // [ [ 1, 33, 5 ], [ 1, 5, 33 ], [ 33, 1, 5 ], [ 33, 5, 1 ], [ 5, 1, 33 ], [ 5, 33, 1 ] ]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### pull\n\nMutates the original array to filter out the values specified.\n\nUse `Array.prototype.filter()` and `Array.prototype.includes()` to pull out the values that are not needed.\nUse `Array.prototype.length = 0` to mutate the passed in an array by resetting it's length to zero and `Array.prototype.push()` to re-populate it with only the pulled values.\n\n_(For a snippet that does not mutate the original array see [`without`](#without))_\n\n```js\nconst pull = (arr, ...args) => {\n  let argState = Array.isArray(args[0]) ? args[0] : args;\n  let pulled = arr.filter((v, i) => !argState.includes(v));\n  arr.length = 0;\n  pulled.forEach(v => arr.push(v));\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nlet myArray = ['a', 'b', 'c', 'a', 'b', 'c'];\npull(myArray, 'a', 'c'); // myArray = [ 'b', 'b' ]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### pullAtIndex ![advanced](/advanced.svg)\n\nMutates the original array to filter out the values at the specified indexes.\n\nUse `Array.prototype.filter()` and `Array.prototype.includes()` to pull out the values that are not needed.\nUse `Array.prototype.length = 0` to mutate the passed in an array by resetting it's length to zero and `Array.prototype.push()` to re-populate it with only the pulled values.\nUse `Array.prototype.push()` to keep track of pulled values\n\n```js\nconst pullAtIndex = (arr, pullArr) => {\n  let removed = [];\n  let pulled = arr\n    .map((v, i) => (pullArr.includes(i) ? removed.push(v) : v))\n    .filter((v, i) => !pullArr.includes(i));\n  arr.length = 0;\n  pulled.forEach(v => arr.push(v));\n  return removed;\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nlet myArray = ['a', 'b', 'c', 'd'];\nlet pulled = pullAtIndex(myArray, [1, 3]); // myArray = [ 'a', 'c' ] , pulled = [ 'b', 'd' ]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### pullAtValue ![advanced](/advanced.svg)\n\nMutates the original array to filter out the values specified. Returns the removed elements.\n\nUse `Array.prototype.filter()` and `Array.prototype.includes()` to pull out the values that are not needed.\nUse `Array.prototype.length = 0` to mutate the passed in an array by resetting it's length to zero and `Array.prototype.push()` to re-populate it with only the pulled values.\nUse `Array.prototype.push()` to keep track of pulled values\n\n```js\nconst pullAtValue = (arr, pullArr) => {\n  let removed = [],\n    pushToRemove = arr.forEach((v, i) => (pullArr.includes(v) ? removed.push(v) : v)),\n    mutateTo = arr.filter((v, i) => !pullArr.includes(v));\n  arr.length = 0;\n  mutateTo.forEach(v => arr.push(v));\n  return removed;\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nlet myArray = ['a', 'b', 'c', 'd'];\nlet pulled = pullAtValue(myArray, ['b', 'd']); // myArray = [ 'a', 'c' ] , pulled = [ 'b', 'd' ]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### pullBy ![advanced](/advanced.svg)\n\nMutates the original array to filter out the values specified, based on a given iterator function.\n\nCheck if the last argument provided in a function.\nUse `Array.prototype.map()` to apply the iterator function `fn` to all array elements.\nUse `Array.prototype.filter()` and `Array.prototype.includes()` to pull out the values that are not needed.\nUse `Array.prototype.length = 0` to mutate the passed in an array by resetting it's length to zero and `Array.prototype.push()` to re-populate it with only the pulled values.\n\n```js\nconst pullBy = (arr, ...args) => {\n  const length = args.length;\n  let fn = length > 1 ? args[length - 1] : undefined;\n  fn = typeof fn == 'function' ? (args.pop(), fn) : undefined;\n  let argState = (Array.isArray(args[0]) ? args[0] : args).map(val => fn(val));\n  let pulled = arr.filter((v, i) => !argState.includes(fn(v)));\n  arr.length = 0;\n  pulled.forEach(v => arr.push(v));\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nvar myArray = [{ x: 1 }, { x: 2 }, { x: 3 }, { x: 1 }];\npullBy(myArray, [{ x: 1 }, { x: 3 }], o => o.x); // myArray = [{ x: 2 }]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### reducedFilter\n\nFilter an array of objects based on a condition while also filtering out unspecified keys.\n\nUse `Array.prototype.filter()` to filter the array based on the predicate `fn` so that it returns the objects for which the condition returned a truthy value.\nOn the filtered array, use `Array.prototype.map()` to return the new object using `Array.prototype.reduce()` to filter out the keys which were not supplied as the `keys` argument.\n\n```js\nconst reducedFilter = (data, keys, fn) =>\n  data.filter(fn).map(el =>\n    keys.reduce((acc, key) => {\n      acc[key] = el[key];\n      return acc;\n    }, {})\n  );\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nconst data = [\n  {\n    id: 1,\n    name: 'john',\n    age: 24\n  },\n  {\n    id: 2,\n    name: 'mike',\n    age: 50\n  }\n];\n\nreducedFilter(data, ['id', 'name'], item => item.age > 24); // [{ id: 2, name: 'mike'}]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### reduceSuccessive\n\nApplies a function against an accumulator and each element in the array (from left to right), returning an array of successively reduced values.\n\nUse `Array.prototype.reduce()` to apply the given function to the given array, storing each new result.\n\n```js\nconst reduceSuccessive = (arr, fn, acc) =>\n  arr.reduce((res, val, i, arr) => (res.push(fn(res.slice(-1)[0], val, i, arr)), res), [acc]);\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nreduceSuccessive([1, 2, 3, 4, 5, 6], (acc, val) => acc + val, 0); // [0, 1, 3, 6, 10, 15, 21]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### reduceWhich\n\nReturns the minimum/maximum value of an array, after applying the provided function to set comparing rule.\n\nUse `Array.prototype.reduce()` in combination with the `comparator` function to get the appropriate element in the array.\nYou can omit the second parameter, `comparator`, to use the default one that returns the minimum element in the array.\n\n```js\nconst reduceWhich = (arr, comparator = (a, b) => a - b) =>\n  arr.reduce((a, b) => (comparator(a, b) >= 0 ? b : a));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nreduceWhich([1, 3, 2]); // 1\nreduceWhich([1, 3, 2], (a, b) => b - a); // 3\nreduceWhich(\n  [{ name: 'Tom', age: 12 }, { name: 'Jack', age: 18 }, { name: 'Lucy', age: 9 }],\n  (a, b) => a.age - b.age\n); // {name: \"Lucy\", age: 9}\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### reject\n\nTakes a predicate and array, like `Array.prototype.filter()`, but only keeps `x` if `pred(x) === false`.\n\n```js\nconst reject = (pred, array) => array.filter((...args) => !pred(...args));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nreject(x => x % 2 === 0, [1, 2, 3, 4, 5]); // [1, 3, 5]\nreject(word => word.length > 4, ['Apple', 'Pear', 'Kiwi', 'Banana']); // ['Pear', 'Kiwi']\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### remove\n\nRemoves elements from an array for which the given function returns `false`.\n\nUse `Array.prototype.filter()` to find array elements that return truthy values and `Array.prototype.reduce()` to remove elements using `Array.prototype.splice()`.\nThe `func` is invoked with three arguments (`value, index, array`).\n\n```js\nconst remove = (arr, func) =>\n  Array.isArray(arr)\n    ? arr.filter(func).reduce((acc, val) => {\n      arr.splice(arr.indexOf(val), 1);\n      return acc.concat(val);\n    }, [])\n    : [];\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nremove([1, 2, 3, 4], n => n % 2 === 0); // [2, 4]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### sample\n\nReturns a random element from an array.\n\nUse `Math.random()` to generate a random number, multiply it by `length` and round it off to the nearest whole number using `Math.floor()`.\nThis method also works with strings.\n\n```js\nconst sample = arr => arr[Math.floor(Math.random() * arr.length)];\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nsample([3, 7, 9, 11]); // 9\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### sampleSize\n\nGets `n` random elements at unique keys from `array` up to the size of `array`.\n\nShuffle the array using the [Fisher-Yates algorithm](https://github.com/30-seconds/30-seconds-of-code#shuffle).\nUse `Array.prototype.slice()` to get the first `n` elements.\nOmit the second argument, `n` to get only one element at random from the array.\n\n```js\nconst sampleSize = ([...arr], n = 1) => {\n  let m = arr.length;\n  while (m) {\n    const i = Math.floor(Math.random() * m--);\n    [arr[m], arr[i]] = [arr[i], arr[m]];\n  }\n  return arr.slice(0, n);\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nsampleSize([1, 2, 3], 2); // [3,1]\nsampleSize([1, 2, 3], 4); // [2,3,1]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### shank\n\nHas the same functionality as [`Array.prototype.splice()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice), but returning a new array instead of mutating the original array.\n\nUse `Array.prototype.slice()` and `Array.prototype.concat()` to get a new array with the new contents after removing existing elements and/or adding new elements.\nOmit the second argument, `index`, to start at `0`.\nOmit the third argument, `delCount`, to remove `0` elements.\nOmit the fourth argument, `elements`, in order to not add any new elements.\n\n```js\nconst shank = (arr, index = 0, delCount = 0, ...elements) =>\n  arr\n    .slice(0, index)\n    .concat(elements)\n    .concat(arr.slice(index + delCount));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nconst names = ['alpha', 'bravo', 'charlie'];\nconst namesAndDelta = shank(names, 1, 0, 'delta'); // [ 'alpha', 'delta', 'bravo', 'charlie' ]\nconst namesNoBravo = shank(names, 1, 1); // [ 'alpha', 'charlie' ]\nconsole.log(names); // ['alpha', 'bravo', 'charlie']\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### shuffle\n\nRandomizes the order of the values of an array, returning a new array.\n\nUses the [Fisher-Yates algorithm](https://github.com/30-seconds/30-seconds-of-code#shuffle) to reorder the elements of the array.\n\n```js\nconst shuffle = ([...arr]) => {\n  let m = arr.length;\n  while (m) {\n    const i = Math.floor(Math.random() * m--);\n    [arr[m], arr[i]] = [arr[i], arr[m]];\n  }\n  return arr;\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nconst foo = [1, 2, 3];\nshuffle(foo); // [2, 3, 1], foo = [1, 2, 3]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### similarity\n\nReturns an array of elements that appear in both arrays.\n\nUse `Array.prototype.filter()` to remove values that are not part of `values`, determined using `Array.prototype.includes()`.\n\n```js\nconst similarity = (arr, values) => arr.filter(v => values.includes(v));\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nsimilarity([1, 2, 3], [1, 2, 4]); // [1, 2]\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### sortedIndex\n\nReturns the lowest index at which value should be inserted into array in order to maintain its sort order.\n\nCheck if the array is sorted in descending order (loosely).\nUse `Array.prototype.findIndex()` to find the appropriate index where the element should be inserted.\n\n```js\nconst sortedIndex = (arr, n) => {\n  const isDescending = arr[0] > arr[arr.length - 1];\n  const index = arr.findIndex(el => (isDescending ? n >= el : n <= el));\n  return index === -1 ? arr.length : index;\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nsortedIndex([5, 3, 2, 1], 4); // 1\nsortedIndex([30, 50], 40); // 1\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### sortedIndexBy\n\nReturns the lowest index at which value should be inserted into array in order to maintain its sort order, based on a provided iterator function.\n\nCheck if the array is sorted in descending order (loosely).\nUse `Array.prototype.findIndex()` to find the appropriate index where the element should be inserted, based on the iterator function `fn`.\n\n```js\nconst sortedIndexBy = (arr, n, fn) => {\n  const isDescending = fn(arr[0]) > fn(arr[arr.length - 1]);\n  const val = fn(n);\n  const index = arr.findIndex(el => (isDescending ? val >= fn(el) : val <= fn(el)));\n  return index === -1 ? arr.length : index;\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nsortedIndexBy([{ x: 4 }, { x: 5 }], { x: 4 }, o => o.x); // 0\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### sortedLastIndex\n\nReturns the highest index at which value should be inserted into array in order to maintain its sort order.\n\nCheck if the array is sorted in descending order (loosely).\nUse `Array.prototype.reverse()` and `Array.prototype.findIndex()` to find the appropriate last index where the element should be inserted.\n\n```js\nconst sortedLastIndex = (arr, n) => {\n  const isDescending = arr[0] > arr[arr.length - 1];\n  const index = arr.reverse().findIndex(el => (isDescending ? n <= el : n >= el));\n  return index === -1 ? 0 : arr.length - index;\n};\n```\n\n<details>\n<summary>Examples</summary>\n\n```js\nsortedLastIndex([10, 20, 30, 30, 40], 30); // 4\n```\n\n</details>\n\n<br>[⬆ Back to top](#contents)\n\n### sor","maintainers":[{"name":"30secondsofcode","email":"30secondsofcode@gmail.com"},{"name":"chalarangelo","email":"chalarangelo@gmail.com"}],"time":{"modified":"2023-04-05T01:22:22.437Z","created":"2018-01-02T21:13:30.465Z","0.0.0":"2018-01-02T21:13:30.465Z","0.0.1":"2018-01-02T21:18:01.365Z","0.0.2":"2018-02-16T12:12:55.182Z","0.0.3":"2018-04-07T17:42:05.566Z","0.0.4":"2018-07-14T08:30:24.020Z","1.0.0":"2018-07-16T16:46:31.650Z","1.1.0":"2018-09-22T08:32:19.843Z","1.2.0":"2018-11-10T13:23:02.546Z","1.2.1":"2018-11-10T13:25:05.511Z","1.2.2":"2018-11-10T14:16:11.310Z","1.2.3":"2018-12-05T15:12:09.359Z"},"homepage":"https://30secondsofcode.org/","keywords":["javascript","snippets","list"],"repository":{"type":"git","url":"git+https://github.com/30-seconds/30-seconds-of-code.git"},"author":{"name":"Chalarangelo","url":"chalarangelo@gmail.com"},"bugs":{"url":"https://github.com/30-seconds/30-seconds-of-code/issues"},"license":"CC0-1.0","readmeFilename":"README.md","users":{"spmsupun":true,"flumpus-dev":true}}