Housekeeping, fix security vulnerabilities

This commit is contained in:
Angelos Chalaris
2019-08-19 11:18:37 +03:00
parent 3ed60da1cd
commit 6281883952
25 changed files with 6439 additions and 6760 deletions

View File

@ -1,45 +0,0 @@
version: "2" # required to adjust maintainability checks
plugins:
eslint:
enabled: true
markdownlint:
enabled: true
# initial: .mdlrc
# config: .mdlrc.style.rb
fixme:
enabled: true
checks:
argument-count:
config:
threshold: 4
complex-logic:
config:
threshold: 4
file-lines:
config:
threshold: 250
method-complexity:
config:
threshold: 5
method-count:
config:
threshold: 20
method-lines:
config:
threshold: 25
nested-control-flow:
config:
threshold: 4
return-statements:
config:
threshold: 4
similar-code:
config:
threshold: # language-specific defaults. an override will affect all languages.
identical-code:
config:
threshold: # language-specific defaults. an override will affect all languages
exclude_patterns:
- "locale/"
- "**/test/"
- "dist/"

View File

@ -14,7 +14,6 @@ script:
- npm run builder - npm run builder
- npm run packager - npm run packager
- npm run tester - npm run tester
- npm run test
- npm run vscoder - npm run vscoder
after_success: after_success:
- chmod +x .travis/push.sh - chmod +x .travis/push.sh

View File

@ -2,9 +2,8 @@
# 30 seconds of code # 30 seconds of code
[![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/> [![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) [![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) <br/>
[![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) [![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg)](https://github.com/Flet/semistandard) <br/> [![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) [![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg)](https://github.com/Flet/semistandard) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)
[![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) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)
> Curated collection of useful JavaScript snippets that you can understand in 30 seconds or less. > Curated collection of useful JavaScript snippets that you can understand in 30 seconds or less.
@ -712,11 +711,11 @@ multiplyAndAdd5(5, 2); // 15
Converts an asynchronous function to return a promise. Converts an asynchronous function to return a promise.
*In Node 8+, you can use [`util.promisify`](https://nodejs.org/api/util.html#util_util_promisify_original)*
Use currying to return a function returning a `Promise` that calls the original function. Use currying to return a function returning a `Promise` that calls the original function.
Use the `...rest` operator to pass in all the parameters. Use the `...rest` operator to pass in all the parameters.
*In Node 8+, you can use [`util.promisify`](https://nodejs.org/api/util.html#util_util_promisify_original)*
```js ```js
const promisify = func => (...args) => const promisify = func => (...args) =>
new Promise((resolve, reject) => new Promise((resolve, reject) =>
@ -2030,8 +2029,6 @@ Mutates the original array to filter out the values specified.
Use `Array.prototype.filter()` and `Array.prototype.includes()` to pull out the values that are not needed. Use `Array.prototype.filter()` and `Array.prototype.includes()` to pull out the values that are not needed.
Use `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. Use `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.
_(For a snippet that does not mutate the original array see [`without`](#without))_
```js ```js
const pull = (arr, ...args) => { const pull = (arr, ...args) => {
let argState = Array.isArray(args[0]) ? args[0] : args; let argState = Array.isArray(args[0]) ? args[0] : args;
@ -3005,8 +3002,6 @@ Filters out the elements of an array, that have one of the specified values.
Use `Array.prototype.filter()` to create an array excluding(using `!Array.includes()`) all given values. Use `Array.prototype.filter()` to create an array excluding(using `!Array.includes()`) all given values.
_(For a snippet that mutates the original array see [`pull`](#pull))_
```js ```js
const without = (arr, ...args) => arr.filter(v => !args.includes(v)); const without = (arr, ...args) => arr.filter(v => !args.includes(v));
``` ```
@ -3104,9 +3099,8 @@ The function is invoked with the elements of each group `(...group)`.
```js ```js
const zipWith = (...array) => { const zipWith = (...array) => {
const fn = typeof array[array.length - 1] === 'function' ? array.pop() : undefined; const fn = typeof array[array.length - 1] === 'function' ? array.pop() : undefined;
return Array.from( return Array.from({ length: Math.max(...array.map(a => a.length)) }, (_, i) =>
{ length: Math.max(...array.map(a => a.length)) }, fn ? fn(...array.map(a => a[i])) : array.map(a => a[i])
(_, i) => (fn ? fn(...array.map(a => a[i])) : array.map(a => a[i]))
); );
}; };
``` ```
@ -6706,9 +6700,8 @@ Calls `Object.freeze(obj)` recursively on all unfrozen properties of passed obje
```js ```js
const deepFreeze = obj => const deepFreeze = obj =>
Object.keys(obj).forEach( Object.keys(obj).forEach(prop =>
prop => !(obj[prop] instanceof Object) || Object.isFrozen(obj[prop]) ? null : deepFreeze(obj[prop])
!(obj[prop] instanceof Object) || Object.isFrozen(obj[prop]) ? null : deepFreeze(obj[prop])
) || Object.freeze(obj); ) || Object.freeze(obj);
``` ```
@ -6761,10 +6754,9 @@ deepGet(data, ['foo', 'bar', 'baz', 8, 'foz']); // null
### deepMapKeys ![advanced](/advanced.svg) ### deepMapKeys ![advanced](/advanced.svg)
Deep maps an object keys. Deep maps an object's keys.
Creates an object with the same values as the provided object and keys generated by running the provided function for each key. Creates an object with the same values as the provided object and keys generated by running the provided function for each key.
Use `Object.keys(obj)` to iterate over the object's keys. Use `Object.keys(obj)` to iterate over the object's keys.
Use `Array.prototype.reduce()` to create a new object with the same values and mapped keys using `fn`. Use `Array.prototype.reduce()` to create a new object with the same values and mapped keys using `fn`.
@ -6776,7 +6768,7 @@ const deepMapKeys = (obj, f) =>
? Object.keys(obj).reduce((acc, current) => { ? Object.keys(obj).reduce((acc, current) => {
const val = obj[current]; const val = obj[current];
acc[f(current)] = acc[f(current)] =
val !== null && typeof val === 'object' ? deepMapKeys(val, f) : (acc[f(current)] = val); val !== null && typeof val === 'object' ? deepMapKeys(val, f) : (acc[f(current)] = val);
return acc; return acc;
}, {}) }, {})
: obj; : obj;
@ -7236,11 +7228,10 @@ If no function is provided, the values will be compared using the equality opera
```js ```js
const matchesWith = (obj, source, fn) => const matchesWith = (obj, source, fn) =>
Object.keys(source).every( Object.keys(source).every(key =>
key => obj.hasOwnProperty(key) && fn
obj.hasOwnProperty(key) && fn ? fn(obj[key], source[key], key, obj, source)
? fn(obj[key], source[key], key, obj, source) : obj[key] == source[key]
: obj[key] == source[key]
); );
``` ```
@ -7554,7 +7545,6 @@ Get type of `val` (`array`, `object` or `string`).
Use `length` property for arrays. Use `length` property for arrays.
Use `length` or `size` value if available or number of keys for objects. Use `length` or `size` value if available or number of keys for objects.
Use `size` of a [`Blob` object](https://developer.mozilla.org/en-US/docs/Web/API/Blob) created from `val` for strings. Use `size` of a [`Blob` object](https://developer.mozilla.org/en-US/docs/Web/API/Blob) created from `val` for strings.
Split strings into array of characters with `split('')` and return its length. Split strings into array of characters with `split('')` and return its length.
```js ```js

21
dist/_30s.esm.js vendored
View File

@ -202,9 +202,8 @@ const deepClone = obj => {
}; };
const deepFlatten = arr => [].concat(...arr.map(v => (Array.isArray(v) ? deepFlatten(v) : v))); const deepFlatten = arr => [].concat(...arr.map(v => (Array.isArray(v) ? deepFlatten(v) : v)));
const deepFreeze = obj => const deepFreeze = obj =>
Object.keys(obj).forEach( Object.keys(obj).forEach(prop =>
prop => !(obj[prop] instanceof Object) || Object.isFrozen(obj[prop]) ? null : deepFreeze(obj[prop])
!(obj[prop] instanceof Object) || Object.isFrozen(obj[prop]) ? null : deepFreeze(obj[prop])
) || Object.freeze(obj); ) || Object.freeze(obj);
const deepGet = (obj, keys) => keys.reduce((xs, x) => (xs && xs[x] ? xs[x] : null), obj); const deepGet = (obj, keys) => keys.reduce((xs, x) => (xs && xs[x] ? xs[x] : null), obj);
const deepMapKeys = (obj, f) => const deepMapKeys = (obj, f) =>
@ -214,7 +213,7 @@ const deepMapKeys = (obj, f) =>
? Object.keys(obj).reduce((acc, current) => { ? Object.keys(obj).reduce((acc, current) => {
const val = obj[current]; const val = obj[current];
acc[f(current)] = acc[f(current)] =
val !== null && typeof val === 'object' ? deepMapKeys(val, f) : (acc[f(current)] = val); val !== null && typeof val === 'object' ? deepMapKeys(val, f) : (acc[f(current)] = val);
return acc; return acc;
}, {}) }, {})
: obj; : obj;
@ -705,11 +704,10 @@ const mask = (cc, num = 4, mask = '*') => `${cc}`.slice(-num).padStart(`${cc}`.l
const matches = (obj, source) => const matches = (obj, source) =>
Object.keys(source).every(key => obj.hasOwnProperty(key) && obj[key] === source[key]); Object.keys(source).every(key => obj.hasOwnProperty(key) && obj[key] === source[key]);
const matchesWith = (obj, source, fn) => const matchesWith = (obj, source, fn) =>
Object.keys(source).every( Object.keys(source).every(key =>
key => obj.hasOwnProperty(key) && fn
obj.hasOwnProperty(key) && fn ? fn(obj[key], source[key], key, obj, source)
? fn(obj[key], source[key], key, obj, source) : obj[key] == source[key]
: obj[key] == source[key]
); );
const maxBy = (arr, fn) => Math.max(...arr.map(typeof fn === 'function' ? fn : val => val[fn])); const maxBy = (arr, fn) => Math.max(...arr.map(typeof fn === 'function' ? fn : val => val[fn]));
const maxDate = dates => new Date(Math.max(...dates)); const maxDate = dates => new Date(Math.max(...dates));
@ -1371,9 +1369,8 @@ const zipObject = (props, values) =>
props.reduce((obj, prop, index) => ((obj[prop] = values[index]), obj), {}); props.reduce((obj, prop, index) => ((obj[prop] = values[index]), obj), {});
const zipWith = (...array) => { const zipWith = (...array) => {
const fn = typeof array[array.length - 1] === 'function' ? array.pop() : undefined; const fn = typeof array[array.length - 1] === 'function' ? array.pop() : undefined;
return Array.from( return Array.from({ length: Math.max(...array.map(a => a.length)) }, (_, i) =>
{ length: Math.max(...array.map(a => a.length)) }, fn ? fn(...array.map(a => a[i])) : array.map(a => a[i])
(_, i) => (fn ? fn(...array.map(a => a[i])) : array.map(a => a[i]))
); );
}; };
const binarySearch = (arr, val, start = 0, end = arr.length - 1) => { const binarySearch = (arr, val, start = 0, end = arr.length - 1) => {

21
dist/_30s.js vendored
View File

@ -208,9 +208,8 @@
}; };
const deepFlatten = arr => [].concat(...arr.map(v => (Array.isArray(v) ? deepFlatten(v) : v))); const deepFlatten = arr => [].concat(...arr.map(v => (Array.isArray(v) ? deepFlatten(v) : v)));
const deepFreeze = obj => const deepFreeze = obj =>
Object.keys(obj).forEach( Object.keys(obj).forEach(prop =>
prop => !(obj[prop] instanceof Object) || Object.isFrozen(obj[prop]) ? null : deepFreeze(obj[prop])
!(obj[prop] instanceof Object) || Object.isFrozen(obj[prop]) ? null : deepFreeze(obj[prop])
) || Object.freeze(obj); ) || Object.freeze(obj);
const deepGet = (obj, keys) => keys.reduce((xs, x) => (xs && xs[x] ? xs[x] : null), obj); const deepGet = (obj, keys) => keys.reduce((xs, x) => (xs && xs[x] ? xs[x] : null), obj);
const deepMapKeys = (obj, f) => const deepMapKeys = (obj, f) =>
@ -220,7 +219,7 @@
? Object.keys(obj).reduce((acc, current) => { ? Object.keys(obj).reduce((acc, current) => {
const val = obj[current]; const val = obj[current];
acc[f(current)] = acc[f(current)] =
val !== null && typeof val === 'object' ? deepMapKeys(val, f) : (acc[f(current)] = val); val !== null && typeof val === 'object' ? deepMapKeys(val, f) : (acc[f(current)] = val);
return acc; return acc;
}, {}) }, {})
: obj; : obj;
@ -711,11 +710,10 @@
const matches = (obj, source) => const matches = (obj, source) =>
Object.keys(source).every(key => obj.hasOwnProperty(key) && obj[key] === source[key]); Object.keys(source).every(key => obj.hasOwnProperty(key) && obj[key] === source[key]);
const matchesWith = (obj, source, fn) => const matchesWith = (obj, source, fn) =>
Object.keys(source).every( Object.keys(source).every(key =>
key => obj.hasOwnProperty(key) && fn
obj.hasOwnProperty(key) && fn ? fn(obj[key], source[key], key, obj, source)
? fn(obj[key], source[key], key, obj, source) : obj[key] == source[key]
: obj[key] == source[key]
); );
const maxBy = (arr, fn) => Math.max(...arr.map(typeof fn === 'function' ? fn : val => val[fn])); const maxBy = (arr, fn) => Math.max(...arr.map(typeof fn === 'function' ? fn : val => val[fn]));
const maxDate = dates => new Date(Math.max(...dates)); const maxDate = dates => new Date(Math.max(...dates));
@ -1377,9 +1375,8 @@
props.reduce((obj, prop, index) => ((obj[prop] = values[index]), obj), {}); props.reduce((obj, prop, index) => ((obj[prop] = values[index]), obj), {});
const zipWith = (...array) => { const zipWith = (...array) => {
const fn = typeof array[array.length - 1] === 'function' ? array.pop() : undefined; const fn = typeof array[array.length - 1] === 'function' ? array.pop() : undefined;
return Array.from( return Array.from({ length: Math.max(...array.map(a => a.length)) }, (_, i) =>
{ length: Math.max(...array.map(a => a.length)) }, fn ? fn(...array.map(a => a[i])) : array.map(a => a[i])
(_, i) => (fn ? fn(...array.map(a => a[i])) : array.map(a => a[i]))
); );
}; };
const binarySearch = (arr, val, start = 0, end = arr.length - 1) => { const binarySearch = (arr, val, start = 0, end = arr.length - 1) => {

10362
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@
"tester": "node ./scripts/tdd.js", "tester": "node ./scripts/tdd.js",
"vscoder": "node ./scripts/vscodegen.js", "vscoder": "node ./scripts/vscodegen.js",
"packager": "node ./scripts/module.js", "packager": "node ./scripts/module.js",
"test": "jest --verbose --coverage" "test": "jest --verbose --coverage --testPathIgnorePatterns=\".cache\""
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -63,7 +63,7 @@
"gatsby-transformer-remark": "^2.6.6", "gatsby-transformer-remark": "^2.6.6",
"gatsby-transformer-sharp": "^2.2.3", "gatsby-transformer-sharp": "^2.2.3",
"gsap": "^2.1.3", "gsap": "^2.1.3",
"jest": "^23.6.0", "jest": "^24.9.0",
"kleur": "^3.0.3", "kleur": "^3.0.3",
"markdown-builder": "^0.9.0", "markdown-builder": "^0.9.0",
"node-sass": "^4.12.0", "node-sass": "^4.12.0",

View File

@ -40,7 +40,7 @@ try {
process.exit(0); process.exit(0);
} }
else { else {
childProcess.execSync('npm test'); childProcess.execSync('npm test', { stdio: 'inherit' });
} }
console.log(`${green('SUCCESS!')} All tests ran successfully!`); console.log(`${green('SUCCESS!')} All tests ran successfully!`);
} catch (err) { } catch (err) {

View File

@ -12,7 +12,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "48d538bccbc7be7e78b8f6a69004055c4b21324d2c8d7cbc4cba0cd42e4f67fb" "hash": "90bc13657b6f59a1e0014e6672b9b95f925f4948e9324125a79e34d0a21b4468"
} }
}, },
{ {
@ -27,7 +27,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "d59410c4fa0ea5173af553068c1e1d4ef931695e084c50cdd8166b0cd0278722" "hash": "07ea927d2724e68224c7f80499159c3795650fe2e18e123e3df1a55e2313f624"
} }
}, },
{ {
@ -42,7 +42,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "aaefc9bd6e9170001fe4754b1bc7bb9808ab97a5bec7fc6ceb1193be2f8009b1" "hash": "23455050bdb213ec6e15eb7ba8bd3fa7ecfc5bd82f73929c6c9754588f8a9e12"
} }
}, },
{ {
@ -57,7 +57,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "0280a47e49f505d5f10e0e0bd2c3ab28a6ea2b931fc83f63155f8395f64a1840" "hash": "ab508ec0a9fb3d7a1269ace24e4909152b74ed95e6481323e1fdd66aa1ee19b9"
} }
}, },
{ {
@ -72,7 +72,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "961b406dfe98746e3a267532b0703ee7c5c1b1c01a0e04c1f9e13e0fd0aeced1" "hash": "fdd106047031a9cd32d33ebe1d5bb5c992c5ce2675712da378080e46f9ca50a2"
} }
}, },
{ {
@ -87,7 +87,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "8eed39b1040d6472e2fd619abf744848d30f12eebffda2711966c616d474524f" "hash": "1e15cb532a03c2b283df16b6ee9079777679940f0032d9ce3e3193988c1f3d6c"
} }
}, },
{ {
@ -102,7 +102,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "a39ade2ae05ad86443446b335dbc019e3ac734fe0c1a542d50b929c554040fc0" "hash": "5d91abbc4451394c1fe4290d63a0913e2cf41b1c02ffe8e9276b491c0f3803f1"
} }
}, },
{ {
@ -117,7 +117,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "35488eb0f56b59035b56cc67fa0a5e1a970162ede4aafd97ebb2b4009c321c01" "hash": "0b757d87765c3539b1b921ff9b915195a81e0f0653d95ca2382deea1f69a22d8"
} }
}, },
{ {
@ -132,7 +132,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "6ff845c13444a06569be548ce9e69900b7001516c44c315795f34b31e9baa833" "hash": "d3d2d3e886ab1aa06315d00020c577884833a2fa2de851c2e736e398ebd21dc2"
} }
}, },
{ {
@ -147,7 +147,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "d0be594ab377cbeb2910308610af5890b3468c06e7567cd0995a84d11aaccf47" "hash": "9cb879ebfd9ca4a4da57f81f26a512017ece8f57d3892738d249319bfce01cc7"
} }
}, },
{ {
@ -162,7 +162,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "52ffa251dfc4e2bec7160a9066ef24a8c3047706e1ad2837f9d987cdf4d5f73e" "hash": "80bc7d5ac13bb3efe634dec4beacc3b9d3e72a973359b163bce3ccd7bda4f4b8"
} }
}, },
{ {
@ -177,7 +177,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "4fccb2abe966313a742d13965ee46cfd1094763a2697591eddb19c1c5af1db7e" "hash": "4f0e17ac776e2d66e0b036a5b4dc080d34917df6a408f792d20440f98daa0273"
} }
}, },
{ {
@ -192,7 +192,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "7eb4b1ffc1cbe28c10190bb82b7731ade2d79e78a5569bdee62af33a1020f2f5" "hash": "f6dccbcfcf5f64cdfef16c87efac6c58bfb3448b1e35c913475277d39e3aeffa"
} }
}, },
{ {
@ -207,7 +207,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "71ebcdb61794d8222fcf447509d206ffb10dc8068072a88c6b587e21e76fc7f2" "hash": "99ea08c72cebd7fc5f46731d47f3f2caaad25c2bf36403fe1d9c9e01699994f0"
} }
}, },
{ {
@ -222,7 +222,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "250615cfc281e99014b97d054c722d3ba6aa4190ccf66dd719e530ec80aec3bd" "hash": "e2d9d4521c2abf0fe239ee83e33624f6d23c461f3fcd8f42f3c1bd067033d2b3"
} }
}, },
{ {
@ -238,7 +238,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "33e1e304fead4088971a60d4da974d0e9380370560f383ddb1ddc14e628df18b" "hash": "33934cf9fb3f740afb520c98f0375de095c8abdc0113728cb71362ba2f1402a0"
} }
}, },
{ {
@ -253,7 +253,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "f885a599e1185f8480445e1eb0c4a5cb8bf33948d7893f013dd4e8085478fe7a" "hash": "def6f0c50fd613013b41723b5c0aa86398b567bb196325fd6da4403f91bae8bb"
} }
}, },
{ {
@ -268,7 +268,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "9f71509c5937cb68b65ef31893b1ad723ce6690e8ecd161707cb222ab67a475b" "hash": "16986950549052514c4d82ec65c555118b3e9c7270ed9efe108d45fab9f26cb4"
} }
}, },
{ {
@ -283,7 +283,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "d1ec7968c8f8c48642a3f91878db84330231bdf84bf74633dc0754456e951338" "hash": "1d6a2b08234f9b86ffb095bb645b5cc22624d17aa2d06badc177df3bd0a7055f"
} }
}, },
{ {
@ -298,7 +298,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "dba6fa36424c23d601c4e463463a5f23d32b51d8b058a6c5020d3b4098a65e51" "hash": "d264febc32505d36187d7cd7aa948766e520c36af21cedd16001af19cda0cd3a"
} }
}, },
{ {
@ -314,7 +314,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "5c26069a02342eadd2c5ba2656a1b211da8f1a94da03c2cc31a5090be556d7b7" "hash": "b0e8729f35e7e7fb2406fe5c194cac83630cffe0d99dd671f08e832436a6e724"
} }
}, },
{ {
@ -329,7 +329,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "5c6f8e292db8506568de362aa63890047f9d5a65d35143cfca1e27562642c414" "hash": "45953ff742f8edfb77f0c1dfbcf28f85b81bd4703daecaa9ba59d180fd55aa23"
} }
}, },
{ {
@ -344,7 +344,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "0c37cf46586652fd20dfa9ca682d3635f01fe61c46864f9773f6b258e8f3b6f6" "hash": "ff1f2f2a5cb5f00cf80322d9af5ce37d9c9b1492c468ea04c112b8a55be71232"
} }
}, },
{ {
@ -359,7 +359,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "9859dbef05dc0398e825150b50fccfea370583cf6b807c00c9e83b769d2b51c0" "hash": "fc2ca6d0b44a47a3b0eb638ec47d10964eff3dab91707186cc96dc53d178c135"
} }
}, },
{ {
@ -374,7 +374,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "19837ac6714833e9c5fe698811e171cc2598f7b9405a4847b33b8d3b35debf8a" "hash": "f665ac48ee5f707eff3f0a13c9d9e844370765fa083e96126a6d64da8c29275a"
} }
} }
], ],

View File

@ -8,9 +8,9 @@
"fileName": "binarySearch.md", "fileName": "binarySearch.md",
"text": "Use recursion. Similar to `Array.prototype.indexOf()` that finds the index of a value within an array.\nThe difference being this operation only works with sorted arrays which offers a major performance boost due to it's logarithmic nature when compared to a linear search or `Array.prototype.indexOf()`.\n\nSearch a sorted array by repeatedly dividing the search interval in half.\nBegin with an interval covering the whole array.\nIf the value of the search is less than the item in the middle of the interval, recurse into the lower half. Otherwise recurse into the upper half.\nRepeatedly recurse until the value is found which is the mid or you've recursed to a point that is greater than the length which means the value doesn't exist and return `-1`.\n\n", "text": "Use recursion. Similar to `Array.prototype.indexOf()` that finds the index of a value within an array.\nThe difference being this operation only works with sorted arrays which offers a major performance boost due to it's logarithmic nature when compared to a linear search or `Array.prototype.indexOf()`.\n\nSearch a sorted array by repeatedly dividing the search interval in half.\nBegin with an interval covering the whole array.\nIf the value of the search is less than the item in the middle of the interval, recurse into the lower half. Otherwise recurse into the upper half.\nRepeatedly recurse until the value is found which is the mid or you've recursed to a point that is greater than the length which means the value doesn't exist and return `-1`.\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const binarySearch = (arr, val, start = 0, end = arr.length - 1) => {\n if (start > end) return -1;\n const mid = Math.floor((start + end) / 2);\n if (arr[mid] > val) return binarySearch(arr, val, start, mid - 1);\n if (arr[mid] < val) return binarySearch(arr, val, mid + 1, end);\n return mid;\n};", "es6": "const binarySearch = (arr, val, start = 0, end = arr.length - 1) => {\r\n if (start > end) return -1;\r\n const mid = Math.floor((start + end) / 2);\r\n if (arr[mid] > val) return binarySearch(arr, val, start, mid - 1);\r\n if (arr[mid] < val) return binarySearch(arr, val, mid + 1, end);\r\n return mid;\r\n};",
"es5": "var binarySearch = function binarySearch(arr, val) {\n var start = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var end = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : arr.length - 1;\n if (start > end) return -1;\n var mid = Math.floor((start + end) / 2);\n if (arr[mid] > val) return binarySearch(arr, val, start, mid - 1);\n if (arr[mid] < val) return binarySearch(arr, val, mid + 1, end);\n return mid;\n};", "es5": "var binarySearch = function binarySearch(arr, val) {\n var start = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var end = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : arr.length - 1;\n if (start > end) return -1;\n var mid = Math.floor((start + end) / 2);\n if (arr[mid] > val) return binarySearch(arr, val, start, mid - 1);\n if (arr[mid] < val) return binarySearch(arr, val, mid + 1, end);\n return mid;\n};",
"example": "binarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 6); // 2\nbinarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 21); // -1" "example": "binarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 6); // 2\r\nbinarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 21); // -1"
}, },
"tags": [ "tags": [
"algorithm", "algorithm",
@ -18,7 +18,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "48d538bccbc7be7e78b8f6a69004055c4b21324d2c8d7cbc4cba0cd42e4f67fb" "hash": "90bc13657b6f59a1e0014e6672b9b95f925f4948e9324125a79e34d0a21b4468"
} }
}, },
{ {
@ -39,7 +39,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "d59410c4fa0ea5173af553068c1e1d4ef931695e084c50cdd8166b0cd0278722" "hash": "07ea927d2724e68224c7f80499159c3795650fe2e18e123e3df1a55e2313f624"
} }
}, },
{ {
@ -50,9 +50,9 @@
"fileName": "cleanObj.md", "fileName": "cleanObj.md",
"text": "Removes any properties except the ones specified from a JSON object.\n\nUse `Object.keys()` method to loop over given JSON object and deleting keys that are not included in given array.\nIf you pass a special key,`childIndicator`, it will search deeply apply the function to inner objects, too.\n\n", "text": "Removes any properties except the ones specified from a JSON object.\n\nUse `Object.keys()` method to loop over given JSON object and deleting keys that are not included in given array.\nIf you pass a special key,`childIndicator`, it will search deeply apply the function to inner objects, too.\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const cleanObj = (obj, keysToKeep = [], childIndicator) => {\n Object.keys(obj).forEach(key => {\n if (key === childIndicator) {\n cleanObj(obj[key], keysToKeep, childIndicator);\n } else if (!keysToKeep.includes(key)) {\n delete obj[key];\n }\n });\n return obj;\n};", "es6": "const cleanObj = (obj, keysToKeep = [], childIndicator) => {\r\n Object.keys(obj).forEach(key => {\r\n if (key === childIndicator) {\r\n cleanObj(obj[key], keysToKeep, childIndicator);\r\n } else if (!keysToKeep.includes(key)) {\r\n delete obj[key];\r\n }\r\n });\r\n return obj;\r\n};",
"es5": "var cleanObj = function cleanObj(obj) {\n var keysToKeep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n var childIndicator = arguments.length > 2 ? arguments[2] : undefined;\n Object.keys(obj).forEach(function (key) {\n if (key === childIndicator) {\n cleanObj(obj[key], keysToKeep, childIndicator);\n } else if (!keysToKeep.includes(key)) {\n delete obj[key];\n }\n });\n return obj;\n};", "es5": "var cleanObj = function cleanObj(obj) {\n var keysToKeep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n var childIndicator = arguments.length > 2 ? arguments[2] : undefined;\n Object.keys(obj).forEach(function (key) {\n if (key === childIndicator) {\n cleanObj(obj[key], keysToKeep, childIndicator);\n } else if (!keysToKeep.includes(key)) {\n delete obj[key];\n }\n });\n return obj;\n};",
"example": "const testObj = { a: 1, b: 2, children: { a: 1, b: 2 } };\ncleanObj(testObj, ['a'], 'children'); // { a: 1, children : { a: 1}}" "example": "const testObj = { a: 1, b: 2, children: { a: 1, b: 2 } };\r\ncleanObj(testObj, ['a'], 'children'); // { a: 1, children : { a: 1}}"
}, },
"tags": [ "tags": [
"object", "object",
@ -60,7 +60,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "aaefc9bd6e9170001fe4754b1bc7bb9808ab97a5bec7fc6ceb1193be2f8009b1" "hash": "23455050bdb213ec6e15eb7ba8bd3fa7ecfc5bd82f73929c6c9754588f8a9e12"
} }
}, },
{ {
@ -81,7 +81,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "0280a47e49f505d5f10e0e0bd2c3ab28a6ea2b931fc83f63155f8395f64a1840" "hash": "ab508ec0a9fb3d7a1269ace24e4909152b74ed95e6481323e1fdd66aa1ee19b9"
} }
}, },
{ {
@ -94,7 +94,7 @@
"codeBlocks": { "codeBlocks": {
"es6": "const countVowels = str => (str.match(/[aeiou]/gi) || []).length;", "es6": "const countVowels = str => (str.match(/[aeiou]/gi) || []).length;",
"es5": "var countVowels = function countVowels(str) {\n return (str.match(/[aeiou]/gi) || []).length;\n};", "es5": "var countVowels = function countVowels(str) {\n return (str.match(/[aeiou]/gi) || []).length;\n};",
"example": "countVowels('foobar'); // 3\ncountVowels('gym'); // 0" "example": "countVowels('foobar'); // 3\r\ncountVowels('gym'); // 0"
}, },
"tags": [ "tags": [
"string", "string",
@ -102,7 +102,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "961b406dfe98746e3a267532b0703ee7c5c1b1c01a0e04c1f9e13e0fd0aeced1" "hash": "fdd106047031a9cd32d33ebe1d5bb5c992c5ce2675712da378080e46f9ca50a2"
} }
}, },
{ {
@ -113,9 +113,9 @@
"fileName": "factors.md", "fileName": "factors.md",
"text": "Returns the array of factors of the given `num`.\nIf the second argument is set to `true` returns only the prime factors of `num`.\nIf `num` is `1` or `0` returns an empty array.\nIf `num` is less than `0` returns all the factors of `-int` together with their additive inverses.\n\nUse `Array.from()`, `Array.prototype.map()` and `Array.prototype.filter()` to find all the factors of `num`.\nIf given `num` is negative, use `Array.prototype.reduce()` to add the additive inverses to the array.\nReturn all results if `primes` is `false`, else determine and return only the prime factors using `isPrime` and `Array.prototype.filter()`.\nOmit the second argument, `primes`, to return prime and non-prime factors by default.\n\n**Note**:- _Negative numbers are not considered prime._\n\n", "text": "Returns the array of factors of the given `num`.\nIf the second argument is set to `true` returns only the prime factors of `num`.\nIf `num` is `1` or `0` returns an empty array.\nIf `num` is less than `0` returns all the factors of `-int` together with their additive inverses.\n\nUse `Array.from()`, `Array.prototype.map()` and `Array.prototype.filter()` to find all the factors of `num`.\nIf given `num` is negative, use `Array.prototype.reduce()` to add the additive inverses to the array.\nReturn all results if `primes` is `false`, else determine and return only the prime factors using `isPrime` and `Array.prototype.filter()`.\nOmit the second argument, `primes`, to return prime and non-prime factors by default.\n\n**Note**:- _Negative numbers are not considered prime._\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const factors = (num, primes = false) => {\n const isPrime = num => {\n const boundary = Math.floor(Math.sqrt(num));\n for (var i = 2; i <= boundary; i++) if (num % i === 0) return false;\n return num >= 2;\n };\n const isNeg = num < 0;\n num = isNeg ? -num : num;\n let array = Array.from({ length: num - 1 })\n .map((val, i) => (num % (i + 2) === 0 ? i + 2 : false))\n .filter(val => val);\n if (isNeg)\n array = array.reduce((acc, val) => {\n acc.push(val);\n acc.push(-val);\n return acc;\n }, []);\n return primes ? array.filter(isPrime) : array;\n};", "es6": "const factors = (num, primes = false) => {\r\n const isPrime = num => {\r\n const boundary = Math.floor(Math.sqrt(num));\r\n for (var i = 2; i <= boundary; i++) if (num % i === 0) return false;\r\n return num >= 2;\r\n };\r\n const isNeg = num < 0;\r\n num = isNeg ? -num : num;\r\n let array = Array.from({ length: num - 1 })\r\n .map((val, i) => (num % (i + 2) === 0 ? i + 2 : false))\r\n .filter(val => val);\r\n if (isNeg)\r\n array = array.reduce((acc, val) => {\r\n acc.push(val);\r\n acc.push(-val);\r\n return acc;\r\n }, []);\r\n return primes ? array.filter(isPrime) : array;\r\n};",
"es5": "var factors = function factors(num) {\n var primes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n var isPrime = function isPrime(num) {\n var boundary = Math.floor(Math.sqrt(num));\n\n for (var i = 2; i <= boundary; i++) {\n if (num % i === 0) return false;\n }\n\n return num >= 2;\n };\n\n var isNeg = num < 0;\n num = isNeg ? -num : num;\n var array = Array.from({\n length: num - 1\n }).map(function (val, i) {\n return num % (i + 2) === 0 ? i + 2 : false;\n }).filter(function (val) {\n return val;\n });\n if (isNeg) array = array.reduce(function (acc, val) {\n acc.push(val);\n acc.push(-val);\n return acc;\n }, []);\n return primes ? array.filter(isPrime) : array;\n};", "es5": "var factors = function factors(num) {\n var primes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n var isPrime = function isPrime(num) {\n var boundary = Math.floor(Math.sqrt(num));\n\n for (var i = 2; i <= boundary; i++) {\n if (num % i === 0) return false;\n }\n\n return num >= 2;\n };\n\n var isNeg = num < 0;\n num = isNeg ? -num : num;\n var array = Array.from({\n length: num - 1\n }).map(function (val, i) {\n return num % (i + 2) === 0 ? i + 2 : false;\n }).filter(function (val) {\n return val;\n });\n if (isNeg) array = array.reduce(function (acc, val) {\n acc.push(val);\n acc.push(-val);\n return acc;\n }, []);\n return primes ? array.filter(isPrime) : array;\n};",
"example": "factors(12); // [2,3,4,6,12]\nfactors(12, true); // [2,3]\nfactors(-12); // [2, -2, 3, -3, 4, -4, 6, -6, 12, -12]\nfactors(-12, true); // [2,3]" "example": "factors(12); // [2,3,4,6,12]\r\nfactors(12, true); // [2,3]\r\nfactors(-12); // [2, -2, 3, -3, 4, -4, 6, -6, 12, -12]\r\nfactors(-12, true); // [2,3]"
}, },
"tags": [ "tags": [
"math", "math",
@ -123,7 +123,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "8eed39b1040d6472e2fd619abf744848d30f12eebffda2711966c616d474524f" "hash": "1e15cb532a03c2b283df16b6ee9079777679940f0032d9ce3e3193988c1f3d6c"
} }
}, },
{ {
@ -144,7 +144,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "a39ade2ae05ad86443446b335dbc019e3ac734fe0c1a542d50b929c554040fc0" "hash": "5d91abbc4451394c1fe4290d63a0913e2cf41b1c02ffe8e9276b491c0f3803f1"
} }
}, },
{ {
@ -155,7 +155,7 @@
"fileName": "fibonacciCountUntilNum.md", "fileName": "fibonacciCountUntilNum.md",
"text": "Returns the number of fibonnacci numbers up to `num`(`0` and `num` inclusive).\n\nUse a mathematical formula to calculate the number of fibonacci numbers until `num`.\n\n", "text": "Returns the number of fibonnacci numbers up to `num`(`0` and `num` inclusive).\n\nUse a mathematical formula to calculate the number of fibonacci numbers until `num`.\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const fibonacciCountUntilNum = num =>\n Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2));", "es6": "const fibonacciCountUntilNum = num =>\r\n Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2));",
"es5": "var fibonacciCountUntilNum = function fibonacciCountUntilNum(num) {\n return Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2));\n};", "es5": "var fibonacciCountUntilNum = function fibonacciCountUntilNum(num) {\n return Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2));\n};",
"example": "fibonacciCountUntilNum(10); // 7" "example": "fibonacciCountUntilNum(10); // 7"
}, },
@ -165,7 +165,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "35488eb0f56b59035b56cc67fa0a5e1a970162ede4aafd97ebb2b4009c321c01" "hash": "0b757d87765c3539b1b921ff9b915195a81e0f0653d95ca2382deea1f69a22d8"
} }
}, },
{ {
@ -176,7 +176,7 @@
"fileName": "fibonacciUntilNum.md", "fileName": "fibonacciUntilNum.md",
"text": "Generates an array, containing the Fibonacci sequence, up until the nth term.\n\nCreate an empty array of the specific length, initializing the first two values (`0` and `1`).\nUse `Array.prototype.reduce()` to add values into the array, using the sum of the last two values, except for the first two.\nUses a mathematical formula to calculate the length of the array required.\n\n", "text": "Generates an array, containing the Fibonacci sequence, up until the nth term.\n\nCreate an empty array of the specific length, initializing the first two values (`0` and `1`).\nUse `Array.prototype.reduce()` to add values into the array, using the sum of the last two values, except for the first two.\nUses a mathematical formula to calculate the length of the array required.\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const fibonacciUntilNum = num => {\n let n = Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2));\n return Array.from({ length: n }).reduce(\n (acc, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i),\n []\n );\n};", "es6": "const fibonacciUntilNum = num => {\r\n let n = Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2));\r\n return Array.from({ length: n }).reduce(\r\n (acc, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i),\r\n []\r\n );\r\n};",
"es5": "var fibonacciUntilNum = function fibonacciUntilNum(num) {\n var n = Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2));\n return Array.from({\n length: n\n }).reduce(function (acc, val, i) {\n return acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i);\n }, []);\n};", "es5": "var fibonacciUntilNum = function fibonacciUntilNum(num) {\n var n = Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2));\n return Array.from({\n length: n\n }).reduce(function (acc, val, i) {\n return acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i);\n }, []);\n};",
"example": "fibonacciUntilNum(10); // [ 0, 1, 1, 2, 3, 5, 8 ]" "example": "fibonacciUntilNum(10); // [ 0, 1, 1, 2, 3, 5, 8 ]"
}, },
@ -186,7 +186,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "6ff845c13444a06569be548ce9e69900b7001516c44c315795f34b31e9baa833" "hash": "d3d2d3e886ab1aa06315d00020c577884833a2fa2de851c2e736e398ebd21dc2"
} }
}, },
{ {
@ -197,7 +197,7 @@
"fileName": "heronArea.md", "fileName": "heronArea.md",
"text": "Returns the area of a triangle using only the 3 side lengths, Heron's formula. Assumes that the sides define a valid triangle. Does NOT assume it is a right triangle.\n\nMore information on what Heron's formula is and why it works available here: https://en.wikipedia.org/wiki/Heron%27s_formula.\n\nUses `Math.sqrt()` to find the square root of a value.\n\n", "text": "Returns the area of a triangle using only the 3 side lengths, Heron's formula. Assumes that the sides define a valid triangle. Does NOT assume it is a right triangle.\n\nMore information on what Heron's formula is and why it works available here: https://en.wikipedia.org/wiki/Heron%27s_formula.\n\nUses `Math.sqrt()` to find the square root of a value.\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const heronArea = (side_a, side_b, side_c) => {\n const p = (side_a + side_b + side_c) / 2\n return Math.sqrt(p * (p-side_a) * (p-side_b) * (p-side_c))\n };", "es6": "const heronArea = (side_a, side_b, side_c) => {\r\n const p = (side_a + side_b + side_c) / 2\r\n return Math.sqrt(p * (p-side_a) * (p-side_b) * (p-side_c))\r\n };",
"es5": "var heronArea = function heronArea(side_a, side_b, side_c) {\n var p = (side_a + side_b + side_c) / 2;\n return Math.sqrt(p * (p - side_a) * (p - side_b) * (p - side_c));\n};", "es5": "var heronArea = function heronArea(side_a, side_b, side_c) {\n var p = (side_a + side_b + side_c) / 2;\n return Math.sqrt(p * (p - side_a) * (p - side_b) * (p - side_c));\n};",
"example": "heronArea(3, 4, 5); // 6" "example": "heronArea(3, 4, 5); // 6"
}, },
@ -207,7 +207,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "d0be594ab377cbeb2910308610af5890b3468c06e7567cd0995a84d11aaccf47" "hash": "9cb879ebfd9ca4a4da57f81f26a512017ece8f57d3892738d249319bfce01cc7"
} }
}, },
{ {
@ -218,9 +218,9 @@
"fileName": "howManyTimes.md", "fileName": "howManyTimes.md",
"text": "Returns the number of times `num` can be divided by `divisor` (integer or fractional) without getting a fractional answer.\nWorks for both negative and positive integers.\n\nIf `divisor` is `-1` or `1` return `Infinity`.\nIf `divisor` is `-0` or `0` return `0`.\nOtherwise, keep dividing `num` with `divisor` and incrementing `i`, while the result is an integer.\nReturn the number of times the loop was executed, `i`.\n\n", "text": "Returns the number of times `num` can be divided by `divisor` (integer or fractional) without getting a fractional answer.\nWorks for both negative and positive integers.\n\nIf `divisor` is `-1` or `1` return `Infinity`.\nIf `divisor` is `-0` or `0` return `0`.\nOtherwise, keep dividing `num` with `divisor` and incrementing `i`, while the result is an integer.\nReturn the number of times the loop was executed, `i`.\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const howManyTimes = (num, divisor) => {\n if (divisor === 1 || divisor === -1) return Infinity;\n if (divisor === 0) return 0;\n let i = 0;\n while (Number.isInteger(num / divisor)) {\n i++;\n num = num / divisor;\n }\n return i;\n};", "es6": "const howManyTimes = (num, divisor) => {\r\n if (divisor === 1 || divisor === -1) return Infinity;\r\n if (divisor === 0) return 0;\r\n let i = 0;\r\n while (Number.isInteger(num / divisor)) {\r\n i++;\r\n num = num / divisor;\r\n }\r\n return i;\r\n};",
"es5": "var howManyTimes = function howManyTimes(num, divisor) {\n if (divisor === 1 || divisor === -1) return Infinity;\n if (divisor === 0) return 0;\n var i = 0;\n\n while (Number.isInteger(num / divisor)) {\n i++;\n num = num / divisor;\n }\n\n return i;\n};", "es5": "var howManyTimes = function howManyTimes(num, divisor) {\n if (divisor === 1 || divisor === -1) return Infinity;\n if (divisor === 0) return 0;\n var i = 0;\n\n while (Number.isInteger(num / divisor)) {\n i++;\n num = num / divisor;\n }\n\n return i;\n};",
"example": "howManyTimes(100, 2); // 2\nhowManyTimes(100, 2.5); // 2\nhowManyTimes(100, 0); // 0\nhowManyTimes(100, -1); // Infinity" "example": "howManyTimes(100, 2); // 2\r\nhowManyTimes(100, 2.5); // 2\r\nhowManyTimes(100, 0); // 0\r\nhowManyTimes(100, -1); // Infinity"
}, },
"tags": [ "tags": [
"math", "math",
@ -228,7 +228,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "52ffa251dfc4e2bec7160a9066ef24a8c3047706e1ad2837f9d987cdf4d5f73e" "hash": "80bc7d5ac13bb3efe634dec4beacc3b9d3e72a973359b163bce3ccd7bda4f4b8"
} }
}, },
{ {
@ -239,9 +239,9 @@
"fileName": "httpDelete.md", "fileName": "httpDelete.md",
"text": "Makes a `DELETE` request to the passed URL.\n\nUse `XMLHttpRequest` web api to make a `delete` request to the given `url`.\nHandle the `onload` event, by running the provided `callback` function.\nHandle the `onerror` event, by running the provided `err` function.\nOmit the third argument, `err` to log the request to the console's error stream by default.\n\n", "text": "Makes a `DELETE` request to the passed URL.\n\nUse `XMLHttpRequest` web api to make a `delete` request to the given `url`.\nHandle the `onload` event, by running the provided `callback` function.\nHandle the `onerror` event, by running the provided `err` function.\nOmit the third argument, `err` to log the request to the console's error stream by default.\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const httpDelete = (url, callback, err = console.error) => {\n const request = new XMLHttpRequest();\n request.open('DELETE', url, true);\n request.onload = () => callback(request);\n request.onerror = () => err(request);\n request.send();\n};", "es6": "const httpDelete = (url, callback, err = console.error) => {\r\n const request = new XMLHttpRequest();\r\n request.open('DELETE', url, true);\r\n request.onload = () => callback(request);\r\n request.onerror = () => err(request);\r\n request.send();\r\n};",
"es5": "var httpDelete = function httpDelete(url, callback) {\n var err = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : console.error;\n var request = new XMLHttpRequest();\n request.open('DELETE', url, true);\n\n request.onload = function () {\n return callback(request);\n };\n\n request.onerror = function () {\n return err(request);\n };\n\n request.send();\n};", "es5": "var httpDelete = function httpDelete(url, callback) {\n var err = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : console.error;\n var request = new XMLHttpRequest();\n request.open('DELETE', url, true);\n\n request.onload = function () {\n return callback(request);\n };\n\n request.onerror = function () {\n return err(request);\n };\n\n request.send();\n};",
"example": "httpDelete('https://website.com/users/123', request => {\n console.log(request.responseText);\n}); // 'Deletes a user from the database'" "example": "httpDelete('https://website.com/users/123', request => {\r\n console.log(request.responseText);\r\n}); // 'Deletes a user from the database'"
}, },
"tags": [ "tags": [
"browser", "browser",
@ -249,7 +249,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "4fccb2abe966313a742d13965ee46cfd1094763a2697591eddb19c1c5af1db7e" "hash": "4f0e17ac776e2d66e0b036a5b4dc080d34917df6a408f792d20440f98daa0273"
} }
}, },
{ {
@ -260,9 +260,9 @@
"fileName": "httpPut.md", "fileName": "httpPut.md",
"text": "Makes a `PUT` request to the passed URL.\n\nUse `XMLHttpRequest` web api to make a `put` request to the given `url`.\nSet the value of an `HTTP` request header with `setRequestHeader` method.\nHandle the `onload` event, by running the provided `callback` function.\nHandle the `onerror` event, by running the provided `err` function.\nOmit the last argument, `err` to log the request to the console's error stream by default.\n\n", "text": "Makes a `PUT` request to the passed URL.\n\nUse `XMLHttpRequest` web api to make a `put` request to the given `url`.\nSet the value of an `HTTP` request header with `setRequestHeader` method.\nHandle the `onload` event, by running the provided `callback` function.\nHandle the `onerror` event, by running the provided `err` function.\nOmit the last argument, `err` to log the request to the console's error stream by default.\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const httpPut = (url, data, callback, err = console.error) => {\n const request = new XMLHttpRequest();\n request.open(\"PUT\", url, true);\n request.setRequestHeader('Content-type','application/json; charset=utf-8');\n request.onload = () => callback(request);\n request.onerror = () => err(request);\n request.send(data);\n};", "es6": "const httpPut = (url, data, callback, err = console.error) => {\r\n const request = new XMLHttpRequest();\r\n request.open(\"PUT\", url, true);\r\n request.setRequestHeader('Content-type','application/json; charset=utf-8');\r\n request.onload = () => callback(request);\r\n request.onerror = () => err(request);\r\n request.send(data);\r\n};",
"es5": "var httpPut = function httpPut(url, data, callback) {\n var err = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : console.error;\n var request = new XMLHttpRequest();\n request.open(\"PUT\", url, true);\n request.setRequestHeader('Content-type', 'application/json; charset=utf-8');\n\n request.onload = function () {\n return callback(request);\n };\n\n request.onerror = function () {\n return err(request);\n };\n\n request.send(data);\n};", "es5": "var httpPut = function httpPut(url, data, callback) {\n var err = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : console.error;\n var request = new XMLHttpRequest();\n request.open(\"PUT\", url, true);\n request.setRequestHeader('Content-type', 'application/json; charset=utf-8');\n\n request.onload = function () {\n return callback(request);\n };\n\n request.onerror = function () {\n return err(request);\n };\n\n request.send(data);\n};",
"example": "const password = \"fooBaz\";\nconst data = JSON.stringify(password);\nhttpPut('https://website.com/users/123', data, request => {\n console.log(request.responseText);\n}); // 'Updates a user's password in database'" "example": "const password = \"fooBaz\";\r\nconst data = JSON.stringify(password);\r\nhttpPut('https://website.com/users/123', data, request => {\r\n console.log(request.responseText);\r\n}); // 'Updates a user's password in database'"
}, },
"tags": [ "tags": [
"browser", "browser",
@ -270,7 +270,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "7eb4b1ffc1cbe28c10190bb82b7731ade2d79e78a5569bdee62af33a1020f2f5" "hash": "f6dccbcfcf5f64cdfef16c87efac6c58bfb3448b1e35c913475277d39e3aeffa"
} }
}, },
{ {
@ -281,9 +281,9 @@
"fileName": "isArmstrongNumber.md", "fileName": "isArmstrongNumber.md",
"text": "Checks if the given number is an Armstrong number or not.\n\nConvert the given number into an array of digits. Use the exponent operator (`**`) to get the appropriate power for each digit and sum them up. If the sum is equal to the number itself, return `true` otherwise `false`.\n\n", "text": "Checks if the given number is an Armstrong number or not.\n\nConvert the given number into an array of digits. Use the exponent operator (`**`) to get the appropriate power for each digit and sum them up. If the sum is equal to the number itself, return `true` otherwise `false`.\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const isArmstrongNumber = digits =>\n (arr => arr.reduce((a, d) => a + parseInt(d) ** arr.length, 0) == digits)(\n (digits + '').split('')\n );", "es6": "const isArmstrongNumber = digits =>\r\n (arr => arr.reduce((a, d) => a + parseInt(d) ** arr.length, 0) == digits)(\r\n (digits + '').split('')\r\n );",
"es5": "var isArmstrongNumber = function isArmstrongNumber(digits) {\n return function (arr) {\n return arr.reduce(function (a, d) {\n return a + Math.pow(parseInt(d), arr.length);\n }, 0) == digits;\n }((digits + '').split(''));\n};", "es5": "var isArmstrongNumber = function isArmstrongNumber(digits) {\n return function (arr) {\n return arr.reduce(function (a, d) {\n return a + Math.pow(parseInt(d), arr.length);\n }, 0) == digits;\n }((digits + '').split(''));\n};",
"example": "isArmstrongNumber(1634); // true\nisArmstrongNumber(56); // false" "example": "isArmstrongNumber(1634); // true\r\nisArmstrongNumber(56); // false"
}, },
"tags": [ "tags": [
"math", "math",
@ -291,7 +291,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "71ebcdb61794d8222fcf447509d206ffb10dc8068072a88c6b587e21e76fc7f2" "hash": "99ea08c72cebd7fc5f46731d47f3f2caaad25c2bf36403fe1d9c9e01699994f0"
} }
}, },
{ {
@ -302,9 +302,9 @@
"fileName": "isSimilar.md", "fileName": "isSimilar.md",
"text": "Determines if the `pattern` matches with `str`.\n\nUse `String.toLowerCase()` to convert both strings to lowercase, then loop through `str` and determine if it contains all characters of `pattern` and in the correct order.\nAdapted from [here](https://github.com/forrestthewoods/lib_fts/blob/80f3f8c52db53428247e741b9efe2cde9667050c/code/fts_fuzzy_match.js#L18).\n\n", "text": "Determines if the `pattern` matches with `str`.\n\nUse `String.toLowerCase()` to convert both strings to lowercase, then loop through `str` and determine if it contains all characters of `pattern` and in the correct order.\nAdapted from [here](https://github.com/forrestthewoods/lib_fts/blob/80f3f8c52db53428247e741b9efe2cde9667050c/code/fts_fuzzy_match.js#L18).\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const isSimilar = (pattern, str) =>\n [...str].reduce(\n (matchIndex, char) =>\n char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase()\n ? matchIndex + 1\n : matchIndex,\n 0\n ) === pattern.length;", "es6": "const isSimilar = (pattern, str) =>\r\n [...str].reduce(\r\n (matchIndex, char) =>\r\n char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase()\r\n ? matchIndex + 1\r\n : matchIndex,\r\n 0\r\n ) === pattern.length;",
"es5": "function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance\"); }\n\nfunction _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\nvar isSimilar = function isSimilar(pattern, str) {\n return _toConsumableArray(str).reduce(function (matchIndex, _char) {\n return _char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase() ? matchIndex + 1 : matchIndex;\n }, 0) === pattern.length;\n};", "es5": "function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance\"); }\n\nfunction _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\nvar isSimilar = function isSimilar(pattern, str) {\n return _toConsumableArray(str).reduce(function (matchIndex, _char) {\n return _char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase() ? matchIndex + 1 : matchIndex;\n }, 0) === pattern.length;\n};",
"example": "isSimilar('rt','Rohit'); // true\nisSimilar('tr','Rohit'); // false" "example": "isSimilar('rt','Rohit'); // true\r\nisSimilar('tr','Rohit'); // false"
}, },
"tags": [ "tags": [
"string", "string",
@ -312,7 +312,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "250615cfc281e99014b97d054c722d3ba6aa4190ccf66dd719e530ec80aec3bd" "hash": "e2d9d4521c2abf0fe239ee83e33624f6d23c461f3fcd8f42f3c1bd067033d2b3"
} }
}, },
{ {
@ -323,7 +323,7 @@
"fileName": "JSONToDate.md", "fileName": "JSONToDate.md",
"text": "Converts a JSON object to a date.\n\nUse `Date()`, to convert dates in JSON format to readable format (`dd/mm/yyyy`).\n\n", "text": "Converts a JSON object to a date.\n\nUse `Date()`, to convert dates in JSON format to readable format (`dd/mm/yyyy`).\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const JSONToDate = arr => {\n const dt = new Date(parseInt(arr.toString().substr(6)));\n return `${dt.getDate()}/${dt.getMonth() + 1}/${dt.getFullYear()}`;\n};", "es6": "const JSONToDate = arr => {\r\n const dt = new Date(parseInt(arr.toString().substr(6)));\r\n return `${dt.getDate()}/${dt.getMonth() + 1}/${dt.getFullYear()}`;\r\n};",
"es5": "var JSONToDate = function JSONToDate(arr) {\n var dt = new Date(parseInt(arr.toString().substr(6)));\n return \"\".concat(dt.getDate(), \"/\").concat(dt.getMonth() + 1, \"/\").concat(dt.getFullYear());\n};", "es5": "var JSONToDate = function JSONToDate(arr) {\n var dt = new Date(parseInt(arr.toString().substr(6)));\n return \"\".concat(dt.getDate(), \"/\").concat(dt.getMonth() + 1, \"/\").concat(dt.getFullYear());\n};",
"example": "JSONToDate(/Date(1489525200000)/); // \"14/3/2017\"" "example": "JSONToDate(/Date(1489525200000)/); // \"14/3/2017\""
}, },
@ -334,7 +334,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "33e1e304fead4088971a60d4da974d0e9380370560f383ddb1ddc14e628df18b" "hash": "33934cf9fb3f740afb520c98f0375de095c8abdc0113728cb71362ba2f1402a0"
} }
}, },
{ {
@ -347,7 +347,7 @@
"codeBlocks": { "codeBlocks": {
"es6": "const kmphToMph = (kmph) => 0.621371192 * kmph;", "es6": "const kmphToMph = (kmph) => 0.621371192 * kmph;",
"es5": "var kmphToMph = function kmphToMph(kmph) {\n return 0.621371192 * kmph;\n};", "es5": "var kmphToMph = function kmphToMph(kmph) {\n return 0.621371192 * kmph;\n};",
"example": "kmphToMph(10); // 16.09344000614692\nkmphToMph(345.4); // 138.24264965280207" "example": "kmphToMph(10); // 16.09344000614692\r\nkmphToMph(345.4); // 138.24264965280207"
}, },
"tags": [ "tags": [
"math", "math",
@ -355,7 +355,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "f885a599e1185f8480445e1eb0c4a5cb8bf33948d7893f013dd4e8085478fe7a" "hash": "def6f0c50fd613013b41723b5c0aa86398b567bb196325fd6da4403f91bae8bb"
} }
}, },
{ {
@ -366,9 +366,9 @@
"fileName": "levenshteinDistance.md", "fileName": "levenshteinDistance.md",
"text": "Calculates the [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) between two strings.\n\nCalculates the number of changes (substitutions, deletions or additions) required to convert `string1` to `string2`. \nCan also be used to compare two strings as shown in the second example.\n\n", "text": "Calculates the [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) between two strings.\n\nCalculates the number of changes (substitutions, deletions or additions) required to convert `string1` to `string2`. \nCan also be used to compare two strings as shown in the second example.\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const levenshteinDistance = (string1, string2) => {\n if (string1.length === 0) return string2.length;\n if (string2.length === 0) return string1.length;\n let matrix = Array(string2.length + 1)\n .fill(0)\n .map((x, i) => [i]);\n matrix[0] = Array(string1.length + 1)\n .fill(0)\n .map((x, i) => i);\n for (let i = 1; i <= string2.length; i++) {\n for (let j = 1; j <= string1.length; j++) {\n if (string2[i - 1] === string1[j - 1]) {\n matrix[i][j] = matrix[i - 1][j - 1];\n } else {\n matrix[i][j] = Math.min(\n matrix[i - 1][j - 1] + 1,\n matrix[i][j - 1] + 1,\n matrix[i - 1][j] + 1\n );\n }\n }\n }\n return matrix[string2.length][string1.length];\n};", "es6": "const levenshteinDistance = (string1, string2) => {\r\n if (string1.length === 0) return string2.length;\r\n if (string2.length === 0) return string1.length;\r\n let matrix = Array(string2.length + 1)\r\n .fill(0)\r\n .map((x, i) => [i]);\r\n matrix[0] = Array(string1.length + 1)\r\n .fill(0)\r\n .map((x, i) => i);\r\n for (let i = 1; i <= string2.length; i++) {\r\n for (let j = 1; j <= string1.length; j++) {\r\n if (string2[i - 1] === string1[j - 1]) {\r\n matrix[i][j] = matrix[i - 1][j - 1];\r\n } else {\r\n matrix[i][j] = Math.min(\r\n matrix[i - 1][j - 1] + 1,\r\n matrix[i][j - 1] + 1,\r\n matrix[i - 1][j] + 1\r\n );\r\n }\r\n }\r\n }\r\n return matrix[string2.length][string1.length];\r\n};",
"es5": "var levenshteinDistance = function levenshteinDistance(string1, string2) {\n if (string1.length === 0) return string2.length;\n if (string2.length === 0) return string1.length;\n var matrix = Array(string2.length + 1).fill(0).map(function (x, i) {\n return [i];\n });\n matrix[0] = Array(string1.length + 1).fill(0).map(function (x, i) {\n return i;\n });\n\n for (var i = 1; i <= string2.length; i++) {\n for (var j = 1; j <= string1.length; j++) {\n if (string2[i - 1] === string1[j - 1]) {\n matrix[i][j] = matrix[i - 1][j - 1];\n } else {\n matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, matrix[i][j - 1] + 1, matrix[i - 1][j] + 1);\n }\n }\n }\n\n return matrix[string2.length][string1.length];\n};", "es5": "var levenshteinDistance = function levenshteinDistance(string1, string2) {\n if (string1.length === 0) return string2.length;\n if (string2.length === 0) return string1.length;\n var matrix = Array(string2.length + 1).fill(0).map(function (x, i) {\n return [i];\n });\n matrix[0] = Array(string1.length + 1).fill(0).map(function (x, i) {\n return i;\n });\n\n for (var i = 1; i <= string2.length; i++) {\n for (var j = 1; j <= string1.length; j++) {\n if (string2[i - 1] === string1[j - 1]) {\n matrix[i][j] = matrix[i - 1][j - 1];\n } else {\n matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, matrix[i][j - 1] + 1, matrix[i - 1][j] + 1);\n }\n }\n }\n\n return matrix[string2.length][string1.length];\n};",
"example": "levenshteinDistance('30-seconds-of-code','30-seconds-of-python-code'); // 7\nconst compareStrings = (string1,string2) => (100 - levenshteinDistance(string1,string2) / Math.max(string1.length,string2.length));\ncompareStrings('30-seconds-of-code', '30-seconds-of-python-code'); // 99.72 (%)" "example": "levenshteinDistance('30-seconds-of-code','30-seconds-of-python-code'); // 7\r\nconst compareStrings = (string1,string2) => (100 - levenshteinDistance(string1,string2) / Math.max(string1.length,string2.length));\r\ncompareStrings('30-seconds-of-code', '30-seconds-of-python-code'); // 99.72 (%)"
}, },
"tags": [ "tags": [
"algorithm", "algorithm",
@ -376,7 +376,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "9f71509c5937cb68b65ef31893b1ad723ce6690e8ecd161707cb222ab67a475b" "hash": "16986950549052514c4d82ec65c555118b3e9c7270ed9efe108d45fab9f26cb4"
} }
}, },
{ {
@ -389,7 +389,7 @@
"codeBlocks": { "codeBlocks": {
"es6": "const mphToKmph = (mph) => 1.6093440006146922 * mph;", "es6": "const mphToKmph = (mph) => 1.6093440006146922 * mph;",
"es5": "var mphToKmph = function mphToKmph(mph) {\n return 1.6093440006146922 * mph;\n};", "es5": "var mphToKmph = function mphToKmph(mph) {\n return 1.6093440006146922 * mph;\n};",
"example": "mphToKmph(10); // 16.09344000614692\nmphToKmph(85.9); // 138.24264965280207" "example": "mphToKmph(10); // 16.09344000614692\r\nmphToKmph(85.9); // 138.24264965280207"
}, },
"tags": [ "tags": [
"math", "math",
@ -397,7 +397,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "d1ec7968c8f8c48642a3f91878db84330231bdf84bf74633dc0754456e951338" "hash": "1d6a2b08234f9b86ffb095bb645b5cc22624d17aa2d06badc177df3bd0a7055f"
} }
}, },
{ {
@ -418,7 +418,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "dba6fa36424c23d601c4e463463a5f23d32b51d8b058a6c5020d3b4098a65e51" "hash": "d264febc32505d36187d7cd7aa948766e520c36af21cedd16001af19cda0cd3a"
} }
}, },
{ {
@ -429,9 +429,9 @@
"fileName": "quickSort.md", "fileName": "quickSort.md",
"text": "QuickSort an Array (ascending sort by default).\n\nUse recursion.\nUse `Array.prototype.filter` and spread operator (`...`) to create an array that all elements with values less than the pivot come before the pivot, and all elements with values greater than the pivot come after it.\nIf the parameter `desc` is truthy, return array sorts in descending order.\n\n", "text": "QuickSort an Array (ascending sort by default).\n\nUse recursion.\nUse `Array.prototype.filter` and spread operator (`...`) to create an array that all elements with values less than the pivot come before the pivot, and all elements with values greater than the pivot come after it.\nIf the parameter `desc` is truthy, return array sorts in descending order.\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const quickSort = ([n, ...nums], desc) =>\n isNaN(n)\n ? []\n : [\n ...quickSort(nums.filter(v => (desc ? v > n : v <= n)), desc),\n n,\n ...quickSort(nums.filter(v => (!desc ? v > n : v <= n)), desc)\n ];", "es6": "const quickSort = ([n, ...nums], desc) =>\r\n isNaN(n)\r\n ? []\r\n : [\r\n ...quickSort(nums.filter(v => (desc ? v > n : v <= n)), desc),\r\n n,\r\n ...quickSort(nums.filter(v => (!desc ? v > n : v <= n)), desc)\r\n ];",
"es5": "function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance\"); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\nfunction _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter); }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nvar quickSort = function quickSort(_ref, desc) {\n var _ref2 = _toArray(_ref),\n n = _ref2[0],\n nums = _ref2.slice(1);\n\n return isNaN(n) ? [] : [].concat(_toConsumableArray(quickSort(nums.filter(function (v) {\n return desc ? v > n : v <= n;\n }), desc)), [n], _toConsumableArray(quickSort(nums.filter(function (v) {\n return !desc ? v > n : v <= n;\n }), desc)));\n};", "es5": "function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance\"); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\nfunction _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter); }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nvar quickSort = function quickSort(_ref, desc) {\n var _ref2 = _toArray(_ref),\n n = _ref2[0],\n nums = _ref2.slice(1);\n\n return isNaN(n) ? [] : [].concat(_toConsumableArray(quickSort(nums.filter(function (v) {\n return desc ? v > n : v <= n;\n }), desc)), [n], _toConsumableArray(quickSort(nums.filter(function (v) {\n return !desc ? v > n : v <= n;\n }), desc)));\n};",
"example": "quickSort([4, 1, 3, 2]); // [1,2,3,4]\nquickSort([4, 1, 3, 2], true); // [4,3,2,1]" "example": "quickSort([4, 1, 3, 2]); // [1,2,3,4]\r\nquickSort([4, 1, 3, 2], true); // [4,3,2,1]"
}, },
"tags": [ "tags": [
"algorithm", "algorithm",
@ -440,7 +440,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "5c26069a02342eadd2c5ba2656a1b211da8f1a94da03c2cc31a5090be556d7b7" "hash": "b0e8729f35e7e7fb2406fe5c194cac83630cffe0d99dd671f08e832436a6e724"
} }
}, },
{ {
@ -453,7 +453,7 @@
"codeBlocks": { "codeBlocks": {
"es6": "const removeVowels = (str, repl = '') => str.replace(/[aeiou]/gi, repl);", "es6": "const removeVowels = (str, repl = '') => str.replace(/[aeiou]/gi, repl);",
"es5": "var removeVowels = function removeVowels(str) {\n var repl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n return str.replace(/[aeiou]/gi, repl);\n};", "es5": "var removeVowels = function removeVowels(str) {\n var repl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n return str.replace(/[aeiou]/gi, repl);\n};",
"example": "removeVowels(\"foobAr\"); // \"fbr\"\nremoveVowels(\"foobAr\",\"*\"); // \"f**b*r\"" "example": "removeVowels(\"foobAr\"); // \"fbr\"\r\nremoveVowels(\"foobAr\",\"*\"); // \"f**b*r\""
}, },
"tags": [ "tags": [
"string", "string",
@ -461,7 +461,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "5c6f8e292db8506568de362aa63890047f9d5a65d35143cfca1e27562642c414" "hash": "45953ff742f8edfb77f0c1dfbcf28f85b81bd4703daecaa9ba59d180fd55aa23"
} }
}, },
{ {
@ -472,9 +472,9 @@
"fileName": "solveRPN.md", "fileName": "solveRPN.md",
"text": "Solves the given mathematical expression in [reverse polish notation](https://en.wikipedia.org/wiki/Reverse_Polish_notation).\nThrows appropriate errors if there are unrecognized symbols or the expression is wrong. The valid operators are :- `+`,`-`,`*`,`/`,`^`,`**` (`^`&`**` are the exponential symbols and are same). This snippet does not supports any unary operators.\n\nUse a dictionary, `OPERATORS` to specify each operator's matching mathematical operation.\nUse `String.prototype.replace()` with a regular expression to replace `^` with `**`, `String.prototype.split()` to tokenize the string and `Array.prototype.filter()` to remove empty tokens.\nUse `Array.prototype.forEach()` to parse each `symbol`, evaluate it as a numeric value or operator and solve the mathematical expression.\nNumeric values are converted to floating point numbers and pushed to a `stack`, while operators are evaluated using the `OPERATORS` dictionary and pop elements from the `stack` to apply operations.\n\n", "text": "Solves the given mathematical expression in [reverse polish notation](https://en.wikipedia.org/wiki/Reverse_Polish_notation).\nThrows appropriate errors if there are unrecognized symbols or the expression is wrong. The valid operators are :- `+`,`-`,`*`,`/`,`^`,`**` (`^`&`**` are the exponential symbols and are same). This snippet does not supports any unary operators.\n\nUse a dictionary, `OPERATORS` to specify each operator's matching mathematical operation.\nUse `String.prototype.replace()` with a regular expression to replace `^` with `**`, `String.prototype.split()` to tokenize the string and `Array.prototype.filter()` to remove empty tokens.\nUse `Array.prototype.forEach()` to parse each `symbol`, evaluate it as a numeric value or operator and solve the mathematical expression.\nNumeric values are converted to floating point numbers and pushed to a `stack`, while operators are evaluated using the `OPERATORS` dictionary and pop elements from the `stack` to apply operations.\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const solveRPN = rpn => {\n const OPERATORS = {\n '*': (a, b) => a * b,\n '+': (a, b) => a + b,\n '-': (a, b) => a - b,\n '/': (a, b) => a / b,\n '**': (a, b) => a ** b\n };\n const [stack, solve] = [\n [],\n rpn\n .replace(/\\^/g, '**')\n .split(/\\s+/g)\n .filter(el => !/\\s+/.test(el) && el !== '')\n ];\n solve.forEach(symbol => {\n if (!isNaN(parseFloat(symbol)) && isFinite(symbol)) {\n stack.push(symbol);\n } else if (Object.keys(OPERATORS).includes(symbol)) {\n const [a, b] = [stack.pop(), stack.pop()];\n stack.push(OPERATORS[symbol](parseFloat(b), parseFloat(a)));\n } else {\n throw `${symbol} is not a recognized symbol`;\n }\n });\n if (stack.length === 1) return stack.pop();\n else throw `${rpn} is not a proper RPN. Please check it and try again`;\n};", "es6": "const solveRPN = rpn => {\r\n const OPERATORS = {\r\n '*': (a, b) => a * b,\r\n '+': (a, b) => a + b,\r\n '-': (a, b) => a - b,\r\n '/': (a, b) => a / b,\r\n '**': (a, b) => a ** b\r\n };\r\n const [stack, solve] = [\r\n [],\r\n rpn\r\n .replace(/\\^/g, '**')\r\n .split(/\\s+/g)\r\n .filter(el => !/\\s+/.test(el) && el !== '')\r\n ];\r\n solve.forEach(symbol => {\r\n if (!isNaN(parseFloat(symbol)) && isFinite(symbol)) {\r\n stack.push(symbol);\r\n } else if (Object.keys(OPERATORS).includes(symbol)) {\r\n const [a, b] = [stack.pop(), stack.pop()];\r\n stack.push(OPERATORS[symbol](parseFloat(b), parseFloat(a)));\r\n } else {\r\n throw `${symbol} is not a recognized symbol`;\r\n }\r\n });\r\n if (stack.length === 1) return stack.pop();\r\n else throw `${rpn} is not a proper RPN. Please check it and try again`;\r\n};",
"es5": "var solveRPN = function solveRPN(rpn) {\n var OPERATORS = {\n '*': function _(a, b) {\n return a * b;\n },\n '+': function _(a, b) {\n return a + b;\n },\n '-': function _(a, b) {\n return a - b;\n },\n '/': function _(a, b) {\n return a / b;\n },\n '**': function _(a, b) {\n return Math.pow(a, b);\n }\n };\n var _ref = [[], rpn.replace(/\\^/g, '**').split(/\\s+/g).filter(function (el) {\n return !/\\s+/.test(el) && el !== '';\n })],\n stack = _ref[0],\n solve = _ref[1];\n solve.forEach(function (symbol) {\n if (!isNaN(parseFloat(symbol)) && isFinite(symbol)) {\n stack.push(symbol);\n } else if (Object.keys(OPERATORS).includes(symbol)) {\n var _ref2 = [stack.pop(), stack.pop()],\n a = _ref2[0],\n b = _ref2[1];\n stack.push(OPERATORS[symbol](parseFloat(b), parseFloat(a)));\n } else {\n throw \"\".concat(symbol, \" is not a recognized symbol\");\n }\n });\n if (stack.length === 1) return stack.pop();else throw \"\".concat(rpn, \" is not a proper RPN. Please check it and try again\");\n};", "es5": "var solveRPN = function solveRPN(rpn) {\n var OPERATORS = {\n '*': function _(a, b) {\n return a * b;\n },\n '+': function _(a, b) {\n return a + b;\n },\n '-': function _(a, b) {\n return a - b;\n },\n '/': function _(a, b) {\n return a / b;\n },\n '**': function _(a, b) {\n return Math.pow(a, b);\n }\n };\n var _ref = [[], rpn.replace(/\\^/g, '**').split(/\\s+/g).filter(function (el) {\n return !/\\s+/.test(el) && el !== '';\n })],\n stack = _ref[0],\n solve = _ref[1];\n solve.forEach(function (symbol) {\n if (!isNaN(parseFloat(symbol)) && isFinite(symbol)) {\n stack.push(symbol);\n } else if (Object.keys(OPERATORS).includes(symbol)) {\n var _ref2 = [stack.pop(), stack.pop()],\n a = _ref2[0],\n b = _ref2[1];\n stack.push(OPERATORS[symbol](parseFloat(b), parseFloat(a)));\n } else {\n throw \"\".concat(symbol, \" is not a recognized symbol\");\n }\n });\n if (stack.length === 1) return stack.pop();else throw \"\".concat(rpn, \" is not a proper RPN. Please check it and try again\");\n};",
"example": "solveRPN('15 7 1 1 + - / 3 * 2 1 1 + + -'); // 5\nsolveRPN('2 3 ^'); // 8" "example": "solveRPN('15 7 1 1 + - / 3 * 2 1 1 + + -'); // 5\r\nsolveRPN('2 3 ^'); // 8"
}, },
"tags": [ "tags": [
"algorithm", "algorithm",
@ -482,7 +482,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "0c37cf46586652fd20dfa9ca682d3635f01fe61c46864f9773f6b258e8f3b6f6" "hash": "ff1f2f2a5cb5f00cf80322d9af5ce37d9c9b1492c468ea04c112b8a55be71232"
} }
}, },
{ {
@ -493,7 +493,7 @@
"fileName": "speechSynthesis.md", "fileName": "speechSynthesis.md",
"text": "Performs speech synthesis (experimental).\n\nUse `SpeechSynthesisUtterance.voice` and `window.speechSynthesis.getVoices()` to convert a message to speech.\nUse `window.speechSynthesis.speak()` to play the message.\n\nLearn more about the [SpeechSynthesisUtterance interface of the Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance).\n\n", "text": "Performs speech synthesis (experimental).\n\nUse `SpeechSynthesisUtterance.voice` and `window.speechSynthesis.getVoices()` to convert a message to speech.\nUse `window.speechSynthesis.speak()` to play the message.\n\nLearn more about the [SpeechSynthesisUtterance interface of the Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance).\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const speechSynthesis = message => {\n const msg = new SpeechSynthesisUtterance(message);\n msg.voice = window.speechSynthesis.getVoices()[0];\n window.speechSynthesis.speak(msg);\n};", "es6": "const speechSynthesis = message => {\r\n const msg = new SpeechSynthesisUtterance(message);\r\n msg.voice = window.speechSynthesis.getVoices()[0];\r\n window.speechSynthesis.speak(msg);\r\n};",
"es5": "var speechSynthesis = function speechSynthesis(message) {\n var msg = new SpeechSynthesisUtterance(message);\n msg.voice = window.speechSynthesis.getVoices()[0];\n window.speechSynthesis.speak(msg);\n};", "es5": "var speechSynthesis = function speechSynthesis(message) {\n var msg = new SpeechSynthesisUtterance(message);\n msg.voice = window.speechSynthesis.getVoices()[0];\n window.speechSynthesis.speak(msg);\n};",
"example": "speechSynthesis('Hello, World'); // // plays the message" "example": "speechSynthesis('Hello, World'); // // plays the message"
}, },
@ -503,7 +503,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "9859dbef05dc0398e825150b50fccfea370583cf6b807c00c9e83b769d2b51c0" "hash": "fc2ca6d0b44a47a3b0eb638ec47d10964eff3dab91707186cc96dc53d178c135"
} }
}, },
{ {
@ -524,7 +524,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "19837ac6714833e9c5fe698811e171cc2598f7b9405a4847b33b8d3b35debf8a" "hash": "f665ac48ee5f707eff3f0a13c9d9e844370765fa083e96126a6d64da8c29275a"
} }
} }
], ],

View File

@ -11,7 +11,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "69b3cf5153fa3348e5863392fb2d0ee3c0c7caaf4f1006bbdb65fb8ea3b365af" "hash": "9b1f6402c69f699f46f03c0ddcfb4beec171f27ca95cdded3afab446d03ad706"
} }
}, },
{ {
@ -25,7 +25,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "4a38caef0e8879fbe91f96c5d1f61c1628276502f4bb02da38ec79c75bd0e27a" "hash": "fff6c876f36872a1e20f0b75e8243a6db0468e0dc3ff1dd92fee2f5721f168e8"
} }
}, },
{ {
@ -39,7 +39,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "bb18f4bf7ba352a918752f5fae6c1838acba0c1a355d270e649b008e3e5be183" "hash": "3df6a7b2e245dbdc839da5e244a9278ff12352ec7674b70915561534275cc88a"
} }
}, },
{ {
@ -53,7 +53,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "5a8b7e5f9ac56f1008cc87c308371c282d3122746f8908ff80dbc1cdae613ef3" "hash": "fa20b67a6a5e27f8e368ea55a06add52159e0f68d4571278da2164d6d38b7762"
} }
}, },
{ {
@ -67,7 +67,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "1a44acdc588be78c7c331704b9b4ab95b461eba5b55d70ebaae484b4cf625d6f" "hash": "0ac65b7d22cbeced1c3a9910b144cdec9fc8fa27ea27d8c13604475a865b986b"
} }
}, },
{ {
@ -81,7 +81,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "510b08853e3816e62aba98e3f824bec05b124e6d1b5919bfc09319b7e9486570" "hash": "ae6338f6a82155ed3d56875810a5bbd803b07a7e8e67333592185dfb73c4924b"
} }
}, },
{ {
@ -95,7 +95,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "3f01c94cb306caf19a88b310c59fe7e488db661729afe6c100fba3c38be6e8a7" "hash": "c4d8d7610c9c97b4933d998afb0ca45c8d0b7a7778a21495c01e3b8079d63a67"
} }
}, },
{ {
@ -109,7 +109,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "62b781aea272e769d6c92bd8daf99d99141af52462218727576ff207d341d65f" "hash": "827a5cd9608b33d3721fe1e61bbc6d729147901e99aea0918e04e1f19117e6d3"
} }
}, },
{ {
@ -123,7 +123,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "9c638e81443d53eb1c59a3145716414105aed86ae4046772c63ff81bd4f605a1" "hash": "373c77da130d9876ca5a9fb71889099022cdf88e907432ded542d6a397af318a"
} }
}, },
{ {
@ -137,7 +137,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "e0c3dd77f0e3d05ed361dc491ab5fc81cb7d1be88e31e787e4bc45bd32171d2c" "hash": "22c1e8dae030c219a9e46192c4cc4084136f989a1a2aa819a03035d928362ad0"
} }
}, },
{ {
@ -151,7 +151,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "9c01b59507a6c71428df711d9089f92d8cb0b030356b061de8a4a6192bf39c93" "hash": "68a572858e08d8625b4ea0c655f167e399caefa84c5f082783f0285a9a3736d1"
} }
}, },
{ {
@ -165,7 +165,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "f1d55fd4b7da687507a0560f8878828a52a3b442d4462a344cea3324392ff66b" "hash": "afe38f75dd585f7e3ad7ea384b263284b7db20bb293cc0e48cc798b1911c9565"
} }
}, },
{ {
@ -179,7 +179,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "7c461f2980b6f1794518fd6b4b68166167fe912f8406144607c8da04d21908d7" "hash": "b05e439bab7b628f7c5af924b35141c8a5fa3c003a125a6584f4772a00040ed4"
} }
}, },
{ {
@ -193,7 +193,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "878d6b1ad8b17eebb1ac24969c4a4c269a65822a21c609221c3d96c7b989b108" "hash": "6eb566c2b02c357591c1ebfb633055b5a84a18c94b32305a0b4f12fbe3fa070b"
} }
}, },
{ {
@ -207,7 +207,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "2389500f32d8eead9e56735e78d7cc84a735b79f21ce87f902771e95290618f7" "hash": "6c6f09dd2307c988c1d3ddda5be95707777103e6e5786867ab0a4539454cd09a"
} }
}, },
{ {
@ -221,7 +221,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "5e494f687daab24e15c3853d0fccb90da6054f515f7cccd26801c6e0f38aaddc" "hash": "6b31dddf283b18bfd1ca0a4381bf9c1a2604858a4df0db70ac433718a2818b41"
} }
}, },
{ {
@ -235,7 +235,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "75d004b6c01c85c4ca20a4ffac0d859ba438f19319513e9f664ce3ce53abe699" "hash": "c2ecf2dd519743e76c507047954463998f85a12482e286eb908b1b2bce8572f5"
} }
}, },
{ {
@ -249,7 +249,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "ad0bd1bd6faba643e1ed7e5b1937a75209dffe5b995a4c19d57367c4311f836a" "hash": "1fe7dcff3a925aabcfcb6c2ce842ce95838a2695ff0e9b381c5b7ff07a6c0107"
} }
}, },
{ {
@ -263,7 +263,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "fdbdbb8739e718f6be81222bda6e69e9f64f31ac786daa7d0a3118a145aee7f2" "hash": "1b41d1d30012e6c12d81100b9d360af129c219a09307759eaf17e2721a386a66"
} }
}, },
{ {
@ -277,7 +277,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "feee663243f2a5a800908ae230338d6b3c23f8b35b1c041be4e71c65123244bd" "hash": "2008cb370a2144ec0e7d62525d4c79dd99bf6746d2feb1b47ecc31811c72fd6c"
} }
}, },
{ {
@ -291,7 +291,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "964b862cd385b8c17273b7dc3a4621050cceb412a4e7840c3e279c55b983734b" "hash": "1a0db8645a4171320747cb8e6506711da00cdcf19f75760a5b340c23ddd05112"
} }
}, },
{ {
@ -305,7 +305,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "9d60a691f67322c528e67a5d25fa97210117e7189e2a295bb400a91c1c5f7976" "hash": "5e1808b84a92cdd774c763a69e20ea65bf4c68e1781cad74fa019cc1097b3977"
} }
}, },
{ {
@ -319,7 +319,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "8d465038cf1b0d10b1e13e87f1c62ca2b641f83dfcf52d6e15fc65c23017dc9e" "hash": "5111b26c807271210d5d566c973f988515b22d110468d5fefe2853e4c6030262"
} }
}, },
{ {
@ -333,7 +333,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "3fd8b63824d879f4b990a9fb67a60d733becda3ee74c2819f46515e563d19299" "hash": "76e09f629992e786374056340026dea7a5f127036ff4fd448650a1b8ec19cdd3"
} }
}, },
{ {
@ -347,7 +347,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "ce222cb66f1299ffa59c08699cff464b5fb0daa8db3002007e8b8697f5ca5057" "hash": "637d992b13bda9cc95a3960ef85f35930e4b46bb3aa30357fbab74ee67944e23"
} }
}, },
{ {
@ -361,7 +361,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "0b478a7a88b2b463db686720064db6265b8b3161566815889ec6b00eb6e3ed20" "hash": "9d784c9282d84e522e926a44cff06665ffeda0752d9ad1a4ad0978f4656b809a"
} }
}, },
{ {
@ -375,7 +375,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "9ce0565b0108631bea1187d52c5423320eb4833e1de33b223083be9b877eede8" "hash": "9a267c3bcb47f6bd54b826697aa1c3b18d80cc0851092c98fdfe8d8c657ab95a"
} }
}, },
{ {
@ -389,7 +389,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "0e3ebc232de61abfd21f7017ed3be1bc877437f26ae4a5df2284c9d1c0e6acf9" "hash": "5e692fc6587ba97bdc8976809982d894daf464f35f080fb8b700125e25ecd91d"
} }
}, },
{ {
@ -403,7 +403,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "9c65cdbdb985a10049eb1de1402c316d257c5b667f625f0fc04a87cd4fdd32ac" "hash": "2fc2bc7a976fae32837fc7694650f34b632de9219fd162d2190155fd68cfa22d"
} }
}, },
{ {
@ -417,7 +417,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "e3f7c2a5f8b2dab4bb5bc1cf04658e8b506825c9624fa260d82f797fc02e7c78" "hash": "42c8ba24aa3636cb7d950a6ccff61cf23ca1776d0a55e1211712788a8d7bf930"
} }
}, },
{ {
@ -431,7 +431,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "29cee59e219e12f9e91bb3e6b9e80b019fed963913cd070ac7e1f7cfab842ef1" "hash": "ffc21d79a333ad55f538e1e6faf521e2b31a36a33ed86cac8a2bdb1749054d98"
} }
}, },
{ {
@ -445,7 +445,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "a0c1c7de7ccb443a0430390da1004789762a4f9e6979cb9071f950897fa8e9d4" "hash": "ce5d925a57f2112c699fefd8529d2dc438ad4f8b8045f62e0d970a9f38650710"
} }
}, },
{ {
@ -473,7 +473,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "be1cc6d8fee2ab876af349d5d99bb1fc1a4cb7884fecbb9191d3d9e60d90a703" "hash": "082d9bbccade6611576f423ffea5b2d9ee89a9102faded2a44cc90e7f51d78e0"
} }
}, },
{ {
@ -487,7 +487,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "12712370bee0ffd535998408f9977b94ac762fa6ff6b12e9b86359e14150c7af" "hash": "23ab9254b5e120452adb8cb71030c6d737882bfde7307772c81efd7f653ccf66"
} }
}, },
{ {
@ -501,7 +501,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "d774609fa3ba6788d4bacd501f6e658a7afca91526e04dd5a619cf3d30badee4" "hash": "0e5793d0f803ffd63e9ab997c5818e42c3713c88fb720a586e619faa86110abc"
} }
}, },
{ {
@ -515,7 +515,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "389aaf215eaa534d4625d1aa6aba1e047ca4e7ef1241b4129867fa4e13438cbc" "hash": "78bed830aa9e7733b948e8a242cce639d5bbfdea21254213dba31458bf9057da"
} }
}, },
{ {
@ -529,7 +529,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "3c3a3376420cf16156ce79e62ea70363fd37710ea62490264bd851fed227cb6c" "hash": "a5ce95634eb0edeaf77d2443a1c18d7152338f85407c32ebb575aada4b28e47c"
} }
}, },
{ {
@ -543,7 +543,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "25d2b0e1f222f102acdcfdedabfeec8f04b40ff808b61ce047de16f184484fa2" "hash": "b2f90fbfa2e7800d42044b637b675b40b6fa8494cb0b914f38afdfc5a5775f2c"
} }
}, },
{ {
@ -557,7 +557,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "f7948fa3ad3524b004127eaf27cd023ce12a87b1d465e3f6e37af034d1239002" "hash": "f03c37ecbe1199bbad2a2f489c8f1115cd696acec93ccdbf367e90b50554289d"
} }
}, },
{ {
@ -571,7 +571,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "7f45960c62541e01c3f7c28e75eb6e131272f81ff25d354031b2f0be1fb16ca4" "hash": "b00cdcaa57db41f761d0e12249ff022fa9df2f5770b48962389c7456f608443a"
} }
}, },
{ {
@ -585,7 +585,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "e5e1a1dffda6d69ca6247f3a5e78e629d95a4ad80ef2bd23605556068d86f419" "hash": "4c59c39acf39c93a6b5a162634fce945c93df7e9bfcd85ad912e09e91a210286"
} }
}, },
{ {
@ -599,7 +599,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "2c681c09ff405bc1c980151e4f1a3cfd54b415305bb6f3bcaf2b0cbcf9d05332" "hash": "c7892883a0bc941a9287e5adec250d431aa3900373d20ad729908bb634e0397a"
} }
}, },
{ {
@ -613,7 +613,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "ca87340c4addebe9e1a4249fce62c0ef3e9d37505b2a834b95368c2d7250d2a8" "hash": "dde9013ba2e6dc09dcd8a80f6350961b1d7173a856a3909ef10be8bf6b004cd3"
} }
}, },
{ {
@ -627,7 +627,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "f0cc0f86211a8f1ae66ea9be353f3c9adc0e56dec19579709ff6da3ebf388ace" "hash": "221cced031d7fd8c679f320a95270a97f7dcc364cdc8eaf755ac825dba6efe1e"
} }
}, },
{ {
@ -641,7 +641,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "e2812fdbe97a001ef10d72b95ffd9e4b4bdbe67e37ff7d1914eaea8583ae286c" "hash": "5554d7d4eddb70199b7e090612c727240c4f7a054e245db83c796c1d82a3e091"
} }
}, },
{ {
@ -655,7 +655,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "3b9ca98ed6c2c184e2e7bd30615fe3752c20d7c016afbf6673b005ee76d7aec4" "hash": "0c5fec36360ed400d98e47bf13c82815a6c21b1f9f3acab5e278bb6a6d7fed2d"
} }
}, },
{ {
@ -669,7 +669,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "3e028e49f3eceb813e54013fb9bf05ef253efa4fa3034353c220cf28899952be" "hash": "bb08424ba323c6a38e4ed558957873507693cebee18522a8ce7c2c217e71a8c3"
} }
}, },
{ {
@ -683,7 +683,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "61ae68cf3a3b1bbf43ffce76bdaa244fa0f5bc5dbdadcd4a06d5260f8dd3247a" "hash": "8fd86cbb0d7ee3d9da284c99ea727fe9f4111a1747cc9667897378de3f172274"
} }
}, },
{ {
@ -697,7 +697,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "4e458b6078a1a91ed7da324aa1ac20cdbf290768aa395d3ab530d95238b7a05e" "hash": "da2b3dfd609ba61bce41033444a24208be967d3889091f715de8d6d0e0acb277"
} }
}, },
{ {
@ -711,7 +711,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "c7ca87020640f844151f9422b6c473afd99620b7483f90142040cc46ffb9a7a7" "hash": "87ed27e2a8dd280ef89cf245371298ae31d485a2c33823e723161443ddb96ac2"
} }
}, },
{ {
@ -725,7 +725,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "64da7def1e95f7220ef3bbf14568350c8cbf6abe187a6f539a64f9fb2067aa5d" "hash": "3cd0002b13d233dd92910c19c3b4e9b61d1526b38bbfe56631a32c1e84439dcc"
} }
}, },
{ {
@ -739,7 +739,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "9956f9ca2dab4c5d7370f3a6ed38abbf871b6f5c11ffef6449e3791aa5229420" "hash": "e26e25937c399cf118e05073f4b54df8531a5c60bb0103611e998b79024d96f2"
} }
}, },
{ {
@ -753,7 +753,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "e03cbfde15c9f4b7c74ee034ed37f3d78809bd1ec64e2fdb62d2bf9da4c3c3ab" "hash": "88c189d901748f9a9ac6bce6478f0d9d0098fef132ecb2aa3d9fec230a0a4d11"
} }
}, },
{ {
@ -781,7 +781,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "49873aab20ab7019d8253e102d9623f086558d464241f821ed6d3de67aa0a15c" "hash": "71ea12e2e02b6de8b5db17ce07226147ce5e5da4d9e2312f114395f28172f6ab"
} }
}, },
{ {
@ -795,7 +795,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "501ba8d90343d16c419320e6896196c38e7b9b14e893ef96617f8bb108931b19" "hash": "5123f796bec733207c1f74390053dbf0219694033eb567e105325f8440a1694b"
} }
}, },
{ {
@ -809,7 +809,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "18066e6dbd116c3c589457fb5cef16b9a5728a87a4a096d91aa436c8e3aafdf4" "hash": "3a7225d0bf3aead127540ce9d1014e9e75394120d953a7951bd3b037b4accb6f"
} }
}, },
{ {
@ -823,7 +823,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "5720bf41b264de168f79f6a5a4bd2bfb3e34e0bf14668e41d3473047fe606309" "hash": "a1e0a08b4abb9397fac9607b9374dfddcae814e6a9ca2f65362acafd9bf6f2f1"
} }
}, },
{ {
@ -837,7 +837,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "ae5316c9f0178c362ae59e5c48d8e2bfca4bb4651e25696c16e7550851220251" "hash": "39c7f8c2c6c79fe0a30b827dcef4ec8b0a30b4c802a9c7a2c79d78afcb29363e"
} }
}, },
{ {
@ -851,7 +851,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "6a8d442044c67422c03c6e2d996380632d589c932b7d8bda1481196de230e83f" "hash": "6f9ad765d303fc7139a94ab23086c910650d2b1944bc7d7489a7a2adf2570114"
} }
}, },
{ {
@ -865,7 +865,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "eb4de09ddad1a858923ec46b6b7fb4fd2ec04631ce53054fe3320e25b70650f4" "hash": "6d45cb7bd8b5431f5a28a1c0a0ce04105aed21fb6fe16f594e009e3e359cd547"
} }
}, },
{ {
@ -879,7 +879,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "101704381209b0f0949dfe98c63a412dfc22736fb9b68adba02aaac76f97f606" "hash": "535cb183fee8810bea09bfb9838b6c0aeddb155b14de6ebbc783169fa7492784"
} }
}, },
{ {
@ -893,7 +893,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "ccf2722f73b32d2693b0cb050ab611f86539ce1ec620af3b277e00042e7e4402" "hash": "9c78eb4661dccc2ac6051731f3e0465f9dc85530b9431ec640ebe0425fc8df6b"
} }
}, },
{ {
@ -907,7 +907,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "4a988d97fc5256e61d4c50677b4a78ffb17a34538b34e4bbba96a8ef1638c117" "hash": "30ace7009689a46ddffbc398de94ad2df92187d8644722bd7c4db10539099793"
} }
}, },
{ {
@ -921,7 +921,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "8ccde135a72db896bd889ea27843eb9368d2a0874726aa7a2af67b30c1c57185" "hash": "0959371fd7e57beee1a6cba4bd18f0595e53f42a7675346c0f2906bcec550258"
} }
}, },
{ {
@ -935,7 +935,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "657233cddce674de187be8e93e1c8b6e38c405505b1266ca1f3fb35b965e1df2" "hash": "ef6bcadbfd0204d07f169b64a41dfca7d04c33c62554107acc2e2393352a1b4b"
} }
}, },
{ {
@ -949,7 +949,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "b70059738193173e8ef6003dbd1b751d1c77921ac1b09f372fb0140c9356aab1" "hash": "eef416d2a72cc672afa532ce4c09804efc06d97d1a29e92d955f26261f9b303d"
} }
}, },
{ {
@ -963,7 +963,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "489ab55187ce67a6138db4c0e2606dbe808624effb398ac3a18edde27c16a868" "hash": "7cf65bea40aa0b145015d5c3ddcbd1237a5eab4f03ee80b681ccf882f8f84358"
} }
}, },
{ {
@ -977,7 +977,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "e44cc3eaa39955a9044b5970b515287a4df2cf07599c9e55ad1ae4defbcc2229" "hash": "4a552f47923d4acfc4463625732f1b30652443484d4e16e234cae302d14c505c"
} }
}, },
{ {
@ -991,7 +991,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "f17eb23b5bda4e18a346a107b8dfcb8fe2ae1b0ce325657ed6b505f3c756be3b" "hash": "c0672ba48a0059421374d26236df1e8000da2716df6466eaa3ab226dd37b0ad2"
} }
}, },
{ {
@ -1005,7 +1005,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "1927b7df02d9e99369401756b6af641c68aa79e71f0e42afe5ccf812dae41709" "hash": "a48de7348bbc5c1e588f910cc335e3f7067c74588f4d22b41af2886e17b8f8fa"
} }
}, },
{ {
@ -1019,7 +1019,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "a91560cd1d2f68017e8ce5566b2a01e73201eaad0e79568e3b83d028ec29a45f" "hash": "ff7d283cbe7a0585c2abbbeea24e0ffc7dbd7fdf924f00268b2b00997c911257"
} }
}, },
{ {
@ -1033,7 +1033,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "cd2e898c927ba74fa82f23d7d307af836931c37376470431b42b7a5c01144daf" "hash": "fcd5e8583522b9c05f9cbb69eb21b6a3b54c6bbb91ce8c5e3a383d7bb878e923"
} }
}, },
{ {
@ -1047,7 +1047,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "904a3d4e0278e6947dffde8d292d8f2e8240ccb804fa68e0828e34dd9dc18944" "hash": "15726d503491392ff26c090133c0522e8c86f9f92536d4f21c883cd80d938412"
} }
}, },
{ {
@ -1061,7 +1061,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "b8b7d7ab34f8ef4ec90a4c9f6801f3d5a7f79458b24b19054d546e87d1a8492c" "hash": "455381f23dce0de0e677b7346f2cbee0559a277c7512af4044cd3c9f92eedda8"
} }
}, },
{ {
@ -1075,7 +1075,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "7427cc55336c55eae8075ffca72b387cc3ff71bd5816bb3353fbf4b6adef5b57" "hash": "d2ab3f811d41c926d7a43d5860679e38337b3f8a432badf896fdbc85ec76dea2"
} }
}, },
{ {
@ -1089,7 +1089,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "fd1d5d006310c33063503ff8d67f262707858660091b21095d44950f33714e31" "hash": "d54979056696062c54a919f4cbc6be16f07fbc834f8601630d68cbc952a7e9c3"
} }
}, },
{ {
@ -1103,7 +1103,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "0d9dd1eb69be5a77576f7d0ce4ab36297ecd5390e3da5981abc752226d1684b6" "hash": "4fd57a1c20ad5e16a5a4f1c307cd1711b8c9fb525bcf3f150161304e35573564"
} }
}, },
{ {
@ -1117,7 +1117,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "56438a14183c585f0b4c01f8a1ecae54dd2806ea9e6667c8f1636923cfe573a1" "hash": "ea13f87af462530cf44b451ff3868630c64ddb26e354673204d7915925c92233"
} }
}, },
{ {
@ -1131,7 +1131,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "592306f78398a053a2a117962e5465fbfd098ca5f66240db78799decb6178ae0" "hash": "3ad516292b5ff98bc7172199c12c5438b5c62742d1c550cf01342c23dad517e5"
} }
}, },
{ {
@ -1145,7 +1145,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "f52184fa97f6306fc9501564705022763798ab154c066ee46433d1c4be6aebb8" "hash": "3f13e1175381c9c35e191f67e488be119322acb8478e64ab7dee36ba4e08ecf2"
} }
}, },
{ {
@ -1159,7 +1159,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "d118d7eee09cda42ea03766fc8177e339c256ae5e79d94e48e87f487d51503f8" "hash": "8f6785ca3685f463fc2e44277e18280c5daead2483b4603877a58735debb0d6f"
} }
}, },
{ {
@ -1173,7 +1173,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "8581444cfe757b6d9887743a456a087d2eb1549e1460218e8235cb85a3d46035" "hash": "915bb1c0e77b041992407c60ed219c469fb2db37cb6cbf95bb285a066b314d83"
} }
}, },
{ {
@ -1187,7 +1187,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "62ecaae6452a7a185c56c884f2da30c8d9772a0cfbf5194eabe8df1c295e38a6" "hash": "5ec613163d268a55d922aa3d9b94017f5d8c4b66a34767e37f9976e5fa43c984"
} }
}, },
{ {
@ -1201,7 +1201,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "1d7a7abda34fb0a8217183729bab2f9a61e6da3113f6c50515abecfe472ea7fe" "hash": "cb458835f913a64ddedbb48d63a86a33d062a6b40ffc5e5b2cce46282f473a51"
} }
}, },
{ {
@ -1215,7 +1215,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "16b9a3620acf34ce96bb78741c7015a7f0c2d0be84cb130466afc6e4bc4a7032" "hash": "ea3c58a0be87fcaa8016ebaf59949a3071c7cb1bb8ec66a2066b9d6fc7e9b81b"
} }
}, },
{ {
@ -1229,7 +1229,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "a297da2dae0f7339a75301e2511479c9d092bf81bf34974efddfe69272fd03b9" "hash": "d7439719ff10ca1116490998b686fdf98699bdcb68c04c3ac62b648aa3858629"
} }
}, },
{ {
@ -1243,7 +1243,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "8b6be0370cdada1c2e803b26158f43221acc93a2230ae7830cada43ac4f9373a" "hash": "e4dabe4cc1e85eeb87345fde8db9a2574ca7893bcef46578b8c23ca4493d6669"
} }
}, },
{ {
@ -1257,7 +1257,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "a7ba762d239435eac955eaf586afd973db0c71a64705bda133044288a71cc031" "hash": "89cecc554d0f36b3a219a1eee645b6933ef6e545374e046504ac53e382a14bc3"
} }
}, },
{ {
@ -1271,7 +1271,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "d8327733f4308d6aba5a3ae3df1576cef507075c00df88ef8ad472260b41108c" "hash": "063085db5cd5bef6e7b38eef1722be12968fc414fd7869e37cb55811955b0657"
} }
}, },
{ {
@ -1285,7 +1285,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "58083342d74f354e79a34470f880ad05dea22ec538f2d9f59b15c17a2694dc99" "hash": "16e209d671a3a94a047782f6b95baa525c00245150dbc0a3b338f34bae12170e"
} }
}, },
{ {
@ -1299,7 +1299,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "8d774423c630890285830ca99d32e150c00fb517aa93ec30cf8cbdcd3f10657f" "hash": "2b9101658a89203204d2603ada5fed5973ddcfa6a4e3f61db9eb093cf8315d46"
} }
}, },
{ {
@ -1313,7 +1313,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "61a25e70c3e7d4b0a9d9475ff53dc4d1091b110a43e511427e12a0bba9392e01" "hash": "257f9725411883b26c39c5baa8d068561c9bc4b2fc8c733085703eff555030c7"
} }
}, },
{ {
@ -1327,7 +1327,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "082acd9ef41f1264fe2ac92e94b13a89cee1560030875f23853fcb69582142a6" "hash": "a97822bf80acd8af731ce9c9b859dd60d8be579a8c4b3823d4f97b99dd65f292"
} }
}, },
{ {
@ -1341,7 +1341,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "df2ab9779e0379c88ccba56702720cb1658754918a84fbbcd022176544fa5444" "hash": "763156f64e0a79c965d4f33b3638fe67889df018f40d558e978c3c213de46491"
} }
}, },
{ {
@ -1355,7 +1355,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "6074990eb1d04f79808ad2f4f3ddfe86f6e8546303e003c38ebe96779fde51f1" "hash": "df3b150cba515a80eafc75c4917bbf10c8eaf0fe291967cd8d8b7aaf346c8173"
} }
}, },
{ {
@ -1369,7 +1369,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "5c3c48bd06510d0971f48983872243787a33f2adfb8d9aca5f7b6ad9d776efbf" "hash": "f13c288fcb5e90874408d34298b57366a1acc0993b45a4c4fd195fc3fef953e5"
} }
}, },
{ {
@ -1383,7 +1383,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "c3ad71d08e76e152fc37aa5e63db9f35d0dc2c4ffc12810df9c82f92f98354ca" "hash": "4dc4b92880663523903693bfdf31026af5f3ca20c9e6b8b3cfa4cadb61c80eb4"
} }
} }
], ],

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,7 @@ const checkProp = (predicate, prop) => obj => !!predicate(obj[prop]);
``` ```
```js ```js
const lengthIs4 = checkProp(l => l === 4, 'length'); const lengthIs4 = checkProp(l => l === 4, 'length');
lengthIs4([]); // false lengthIs4([]); // false
lengthIs4([1,2,3,4]); // true lengthIs4([1,2,3,4]); // true

View File

@ -9,9 +9,8 @@ Calls `Object.freeze(obj)` recursively on all unfrozen properties of passed obje
```js ```js
const deepFreeze = obj => const deepFreeze = obj =>
Object.keys(obj).forEach( Object.keys(obj).forEach(prop =>
prop => !(obj[prop] instanceof Object) || Object.isFrozen(obj[prop]) ? null : deepFreeze(obj[prop])
!(obj[prop] instanceof Object) || Object.isFrozen(obj[prop]) ? null : deepFreeze(obj[prop])
) || Object.freeze(obj); ) || Object.freeze(obj);
``` ```

View File

@ -17,7 +17,7 @@ const deepMapKeys = (obj, f) =>
? Object.keys(obj).reduce((acc, current) => { ? Object.keys(obj).reduce((acc, current) => {
const val = obj[current]; const val = obj[current];
acc[f(current)] = acc[f(current)] =
val !== null && typeof val === 'object' ? deepMapKeys(val, f) : (acc[f(current)] = val); val !== null && typeof val === 'object' ? deepMapKeys(val, f) : (acc[f(current)] = val);
return acc; return acc;
}, {}) }, {})
: obj; : obj;

View File

@ -10,11 +10,10 @@ If no function is provided, the values will be compared using the equality opera
```js ```js
const matchesWith = (obj, source, fn) => const matchesWith = (obj, source, fn) =>
Object.keys(source).every( Object.keys(source).every(key =>
key => obj.hasOwnProperty(key) && fn
obj.hasOwnProperty(key) && fn ? fn(obj[key], source[key], key, obj, source)
? fn(obj[key], source[key], key, obj, source) : obj[key] == source[key]
: obj[key] == source[key]
); );
``` ```

View File

@ -14,9 +14,8 @@ The function is invoked with the elements of each group `(...group)`.
```js ```js
const zipWith = (...array) => { const zipWith = (...array) => {
const fn = typeof array[array.length - 1] === 'function' ? array.pop() : undefined; const fn = typeof array[array.length - 1] === 'function' ? array.pop() : undefined;
return Array.from( return Array.from({ length: Math.max(...array.map(a => a.length)) }, (_, i) =>
{ length: Math.max(...array.map(a => a.length)) }, fn ? fn(...array.map(a => a[i])) : array.map(a => a[i])
(_, i) => (fn ? fn(...array.map(a => a[i])) : array.map(a => a[i]))
); );
}; };
``` ```

View File

@ -67,7 +67,6 @@ export const archivePageQuery = graphql`
totalCount totalCount
edges { edges {
node { node {
excerpt(pruneLength: 400)
id id
html html
rawMarkdownBody rawMarkdownBody

View File

@ -12,7 +12,6 @@ import SimpleCard from '../components/SimpleCard';
// =================================================== // ===================================================
const GlossaryPage = props => { const GlossaryPage = props => {
const posts = props.data.snippetDataJson.data; const posts = props.data.snippetDataJson.data;
console.log(posts);
React.useEffect(() => { React.useEffect(() => {
props.dispatch(pushNewPage('Glossary', props.path)); props.dispatch(pushNewPage('Glossary', props.path));

View File

@ -14,7 +14,6 @@ import { getRawCodeBlocks as getCodeBlocks } from '../util';
// Home page (splash and search) // Home page (splash and search)
// =================================================== // ===================================================
const IndexPage = props => { const IndexPage = props => {
console.log(props);
const snippets = props.data.snippetDataJson.data.map(snippet => ({ const snippets = props.data.snippetDataJson.data.map(snippet => ({
title: snippet.title, title: snippet.title,
html: props.data.allMarkdownRemark.edges.find( html: props.data.allMarkdownRemark.edges.find(

View File

@ -17,7 +17,6 @@ import SimpleCard from '../components/SimpleCard';
// Snippet list page // Snippet list page
// =================================================== // ===================================================
const ListPage = props => { const ListPage = props => {
console.log(props);
const snippets = props.data.snippetDataJson.data.map(snippet => ({ const snippets = props.data.snippetDataJson.data.map(snippet => ({
title: snippet.title, title: snippet.title,
html: props.data.allMarkdownRemark.edges.find( html: props.data.allMarkdownRemark.edges.find(
@ -52,8 +51,6 @@ const ListPage = props => {
).node.rawMarkdownBody, ).node.rawMarkdownBody,
).code, ).code,
})); }));
console.log(snippets);
console.log(archivedSnippets);
const tags = snippets.reduce((acc, snippet) => { const tags = snippets.reduce((acc, snippet) => {
if (!snippet.tags) return acc; if (!snippet.tags) return acc;
const primaryTag = snippet.tags[0]; const primaryTag = snippet.tags[0];

View File

@ -203,9 +203,8 @@ const deepClone = obj => {
}; };
const deepFlatten = arr => [].concat(...arr.map(v => (Array.isArray(v) ? deepFlatten(v) : v))); const deepFlatten = arr => [].concat(...arr.map(v => (Array.isArray(v) ? deepFlatten(v) : v)));
const deepFreeze = obj => const deepFreeze = obj =>
Object.keys(obj).forEach( Object.keys(obj).forEach(prop =>
prop => !(obj[prop] instanceof Object) || Object.isFrozen(obj[prop]) ? null : deepFreeze(obj[prop])
!(obj[prop] instanceof Object) || Object.isFrozen(obj[prop]) ? null : deepFreeze(obj[prop])
) || Object.freeze(obj); ) || Object.freeze(obj);
const deepGet = (obj, keys) => keys.reduce((xs, x) => (xs && xs[x] ? xs[x] : null), obj); const deepGet = (obj, keys) => keys.reduce((xs, x) => (xs && xs[x] ? xs[x] : null), obj);
const deepMapKeys = (obj, f) => const deepMapKeys = (obj, f) =>
@ -215,7 +214,7 @@ const deepMapKeys = (obj, f) =>
? Object.keys(obj).reduce((acc, current) => { ? Object.keys(obj).reduce((acc, current) => {
const val = obj[current]; const val = obj[current];
acc[f(current)] = acc[f(current)] =
val !== null && typeof val === 'object' ? deepMapKeys(val, f) : (acc[f(current)] = val); val !== null && typeof val === 'object' ? deepMapKeys(val, f) : (acc[f(current)] = val);
return acc; return acc;
}, {}) }, {})
: obj; : obj;
@ -708,11 +707,10 @@ const mask = (cc, num = 4, mask = '*') => `${cc}`.slice(-num).padStart(`${cc}`.l
const matches = (obj, source) => const matches = (obj, source) =>
Object.keys(source).every(key => obj.hasOwnProperty(key) && obj[key] === source[key]); Object.keys(source).every(key => obj.hasOwnProperty(key) && obj[key] === source[key]);
const matchesWith = (obj, source, fn) => const matchesWith = (obj, source, fn) =>
Object.keys(source).every( Object.keys(source).every(key =>
key => obj.hasOwnProperty(key) && fn
obj.hasOwnProperty(key) && fn ? fn(obj[key], source[key], key, obj, source)
? fn(obj[key], source[key], key, obj, source) : obj[key] == source[key]
: obj[key] == source[key]
); );
const maxBy = (arr, fn) => Math.max(...arr.map(typeof fn === 'function' ? fn : val => val[fn])); const maxBy = (arr, fn) => Math.max(...arr.map(typeof fn === 'function' ? fn : val => val[fn]));
const maxDate = dates => new Date(Math.max(...dates)); const maxDate = dates => new Date(Math.max(...dates));
@ -1376,9 +1374,8 @@ const zipObject = (props, values) =>
props.reduce((obj, prop, index) => ((obj[prop] = values[index]), obj), {}); props.reduce((obj, prop, index) => ((obj[prop] = values[index]), obj), {});
const zipWith = (...array) => { const zipWith = (...array) => {
const fn = typeof array[array.length - 1] === 'function' ? array.pop() : undefined; const fn = typeof array[array.length - 1] === 'function' ? array.pop() : undefined;
return Array.from( return Array.from({ length: Math.max(...array.map(a => a.length)) }, (_, i) =>
{ length: Math.max(...array.map(a => a.length)) }, fn ? fn(...array.map(a => a[i])) : array.map(a => a[i])
(_, i) => (fn ? fn(...array.map(a => a[i])) : array.map(a => a[i]))
); );
}; };
const binarySearch = (arr, val, start = 0, end = arr.length - 1) => { const binarySearch = (arr, val, start = 0, end = arr.length - 1) => {

View File

@ -1,87 +0,0 @@
Command line:
"travis encrypt --add"
________ __
/ | / |
########/ ______ ______ __ __ ##/ _______
## | / \ / \ / \ / | / | / |
## | /###### | ###### | ## \ /##/ ## | /#######/
## | ## | ##/ / ## | ## /##/ ## | ## \
## | ## | /####### | ## ##/ ## | ###### |
## | ## | ## ## | ###/ ## | / ##/
##/ ##/ #######/ #/ ##/ #######/
TRajectory Analyzer and VISualizer - Open-source freeware under GNU GPL v3
Copyright (c) Martin Brehm (2009-2015)
Martin Thomas (2012-2015)
Barbara Kirchner (2009-2015)
University of Leipzig / University of Bonn.
http://www.travis-analyzer.de
Please cite:
M. Brehm and B. Kirchner, J. Chem. Inf. Model. 2011, 51 (8), pp 2007-2023.
There is absolutely no warranty on any results obtained from TRAVIS.
# Running on pl4gue at Thu Dec 21 11:44:39 2017 (PID 25714).
# Running in /home/pl4gue/Programming/30-seconds-of-code
# Source code version: Nov 07 2015.
# Compiled at Nov 17 2015 23:12:21.
# Compiler version: 5.2.1 20151028
# Target platform: Linux
# Compile flags: DEBUG_ARRAYS
# Machine: int=4b, long=8b, addr=8b, 0xA0B0C0D0=D0,C0,B0,A0.
# User home: /home/pl4gue
# Exe path: /usr/bin/travis
# Input is redirected, Output to terminal
>>> Please use a color scheme with dark background or specify "-nocolor"! <<<
No configuration file found.
Writing default configuration to /home/pl4gue/.travis.conf ...
Unknown parameter: "encrypt".
List of supported command line options:
-p <file> Loads position data from the specified trajectory file.
The file format may be *.xyz, *.pdb, *.lmp (Lammps), HISTORY (DLPOLY), or *.prmtop/*.mdcrd (Amber).
-i <file> Reads input from the specified text file.
-config <file> Load the specified configuration file.
-stream Treats input trajectory as a stream (e.g. named pipe): No fseek, etc.
-showconf Shows a tree structure of the configuration file.
-writeconf Writes the default configuration file, including all defines values.
-verbose Show detailed information about what's going on.
-nocolor Executes TRAVIS in monochrome mode.
-dimcolor Uses dim instead of bright colors.
-credits Display a list of persons who contributed to TRAVIS.
-help, -? Shows this help.
If only one argument is specified, it is assumed to be the name of a trajectory file.
If argument is specified at all, TRAVIS asks for the trajectory file to open.
Note: To show a list of all persons who contributed to TRAVIS,
please add "-credits" to your command line arguments, or set the
variable "SHOWCREDITS" to "TRUE" in your travis.conf file.
Source code from other projects used in TRAVIS:
- lmfit from Joachim Wuttke
- kiss_fft from Mark Borgerding
- voro++ from Chris Rycroft
http://www.travis-analyzer.de
Please cite:
* "TRAVIS - A Free Analyzer and Visualizer for Monte Carlo and Molecular Dynamics Trajectories",
M. Brehm, B. Kirchner; J. Chem. Inf. Model. 2011, 51 (8), pp 2007-2023.
*** The End ***

View File

@ -528,9 +528,8 @@
"prefix": "30s_deepFreeze", "prefix": "30s_deepFreeze",
"body": [ "body": [
"const deepFreeze = obj =>", "const deepFreeze = obj =>",
" Object.keys(obj).forEach(", " Object.keys(obj).forEach(prop =>",
" prop =>", " !(obj[prop] instanceof Object) || Object.isFrozen(obj[prop]) ? null : deepFreeze(obj[prop])",
" !(obj[prop] instanceof Object) || Object.isFrozen(obj[prop]) ? null : deepFreeze(obj[prop])",
" ) || Object.freeze(obj);" " ) || Object.freeze(obj);"
], ],
"description": "Deep freezes an object.\n\nCalls `Object.freeze(obj)` recursively on all unfrozen properties of passed object that are `instanceof` object.\n" "description": "Deep freezes an object.\n\nCalls `Object.freeze(obj)` recursively on all unfrozen properties of passed object that are `instanceof` object.\n"
@ -552,12 +551,12 @@
" ? Object.keys(obj).reduce((acc, current) => {", " ? Object.keys(obj).reduce((acc, current) => {",
" const val = obj[current];", " const val = obj[current];",
" acc[f(current)] =", " acc[f(current)] =",
" val !== null && typeof val === 'object' ? deepMapKeys(val, f) : (acc[f(current)] = val);", " val !== null && typeof val === 'object' ? deepMapKeys(val, f) : (acc[f(current)] = val);",
" return acc;", " return acc;",
" }, {})", " }, {})",
" : obj;" " : obj;"
], ],
"description": "Deep maps an object keys.\n\nCreates an object with the same values as the provided object and keys generated by running the provided function for each key.\n\nUse `Object.keys(obj)` to iterate over the object's keys. \nUse `Array.prototype.reduce()` to create a new object with the same values and mapped keys using `fn`.\n" "description": "Deep maps an object's keys.\n\nCreates an object with the same values as the provided object and keys generated by running the provided function for each key.\nUse `Object.keys(obj)` to iterate over the object's keys. \nUse `Array.prototype.reduce()` to create a new object with the same values and mapped keys using `fn`.\n"
}, },
"defaults": { "defaults": {
"prefix": "30s_defaults", "prefix": "30s_defaults",
@ -1861,11 +1860,10 @@
"prefix": "30s_matchesWith", "prefix": "30s_matchesWith",
"body": [ "body": [
"const matchesWith = (obj, source, fn) =>", "const matchesWith = (obj, source, fn) =>",
" Object.keys(source).every(", " Object.keys(source).every(key =>",
" key =>", " obj.hasOwnProperty(key) && fn",
" obj.hasOwnProperty(key) && fn", " ? fn(obj[key], source[key], key, obj, source)",
" ? fn(obj[key], source[key], key, obj, source)", " : obj[key] == source[key]",
" : obj[key] == source[key]",
" );" " );"
], ],
"description": "Compares two objects to determine if the first one contains equivalent property values to the second one, based on a provided function.\n\nUse `Object.keys(source)` to get all the keys of the second object, then `Array.prototype.every()`, `Object.hasOwnProperty()` and the provided function to determine if all keys exist in the first object and have equivalent values.\nIf no function is provided, the values will be compared using the equality operator.\n" "description": "Compares two objects to determine if the first one contains equivalent property values to the second one, based on a provided function.\n\nUse `Object.keys(source)` to get all the keys of the second object, then `Array.prototype.every()`, `Object.hasOwnProperty()` and the provided function to determine if all keys exist in the first object and have equivalent values.\nIf no function is provided, the values will be compared using the equality operator.\n"
@ -2348,7 +2346,7 @@
" func(...args, (err, result) => (err ? reject(err) : resolve(result)))", " func(...args, (err, result) => (err ? reject(err) : resolve(result)))",
" );" " );"
], ],
"description": "Converts 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" "description": "Converts an asynchronous function to return a promise.\n\n*In Node 8+, you can use [`util.promisify`](https://nodejs.org/api/util.html#util_util_promisify_original)*\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"
}, },
"pull": { "pull": {
"prefix": "30s_pull", "prefix": "30s_pull",
@ -2360,7 +2358,7 @@
" pulled.forEach(v => arr.push(v));", " pulled.forEach(v => arr.push(v));",
"};" "};"
], ],
"description": "Mutates 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" "description": "Mutates 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"
}, },
"pullAtIndex": { "pullAtIndex": {
"prefix": "30s_pullAtIndex", "prefix": "30s_pullAtIndex",
@ -2745,7 +2743,7 @@
" ? new Blob([val]).size", " ? new Blob([val]).size",
" : 0;" " : 0;"
], ],
"description": "Get size of arrays, objects or strings.\n\nGet type of `val` (`array`, `object` or `string`). \nUse `length` property for arrays.\nUse `length` or `size` value if available or number of keys for objects.\nUse `size` of a [`Blob` object](https://developer.mozilla.org/en-US/docs/Web/API/Blob) created from `val` for strings.\n\nSplit strings into array of characters with `split('')` and return its length.\n" "description": "Get size of arrays, objects or strings.\n\nGet type of `val` (`array`, `object` or `string`). \nUse `length` property for arrays.\nUse `length` or `size` value if available or number of keys for objects.\nUse `size` of a [`Blob` object](https://developer.mozilla.org/en-US/docs/Web/API/Blob) created from `val` for strings.\nSplit strings into array of characters with `split('')` and return its length.\n"
}, },
"sleep": { "sleep": {
"prefix": "30s_sleep", "prefix": "30s_sleep",
@ -3411,7 +3409,7 @@
"body": [ "body": [
"const without = (arr, ...args) => arr.filter(v => !args.includes(v));" "const without = (arr, ...args) => arr.filter(v => !args.includes(v));"
], ],
"description": "Filters out the elements of an array, that have one of the specified values.\n\nUse `Array.prototype.filter()` to create an array excluding(using `!Array.includes()`) all given values.\n\n_(For a snippet that mutates the original array see [`pull`](#pull))_\n" "description": "Filters out the elements of an array, that have one of the specified values.\n\nUse `Array.prototype.filter()` to create an array excluding(using `!Array.includes()`) all given values.\n"
}, },
"words": { "words": {
"prefix": "30s_words", "prefix": "30s_words",
@ -3471,9 +3469,8 @@
"body": [ "body": [
"const zipWith = (...array) => {", "const zipWith = (...array) => {",
" const fn = typeof array[array.length - 1] === 'function' ? array.pop() : undefined;", " const fn = typeof array[array.length - 1] === 'function' ? array.pop() : undefined;",
" return Array.from(", " return Array.from({ length: Math.max(...array.map(a => a.length)) }, (_, i) =>",
" { length: Math.max(...array.map(a => a.length)) },", " fn ? fn(...array.map(a => a[i])) : array.map(a => a[i])",
" (_, i) => (fn ? fn(...array.map(a => a[i])) : array.map(a => a[i]))",
" );", " );",
"};" "};"
], ],