fix conflicts

This commit is contained in:
Rohit Tanwar
2018-02-17 22:10:34 +05:30
55 changed files with 246 additions and 367 deletions

18
.npmignore Normal file
View File

@ -0,0 +1,18 @@
snippet-template.md
tag_database
travis.log
CONTRIBUTING.md
COLLABORATING.md
CODE_OF_CONDUCT.md
.travis.yml
.mdlrc.style.rb
.mdlrc
.codeclimate.yml
test/*
static-parts/*
snippets_archive/*
scripts/*
locale/*
docs/*
.travis/*
.github/*

View File

@ -99,9 +99,7 @@ average(1, 2, 3);
<summary>View contents</summary> <summary>View contents</summary>
* [`all`](#all) * [`all`](#all)
* [`allBy`](#allby)
* [`any`](#any) * [`any`](#any)
* [`anyBy`](#anyby)
* [`bifurcate`](#bifurcate) * [`bifurcate`](#bifurcate)
* [`bifurcateBy`](#bifurcateby) * [`bifurcateBy`](#bifurcateby)
* [`chunk`](#chunk) * [`chunk`](#chunk)
@ -141,7 +139,6 @@ average(1, 2, 3);
* [`maxN`](#maxn) * [`maxN`](#maxn)
* [`minN`](#minn) * [`minN`](#minn)
* [`none`](#none) * [`none`](#none)
* [`noneBy`](#noneby)
* [`nthElement`](#nthelement) * [`nthElement`](#nthelement)
* [`partition`](#partition) * [`partition`](#partition)
* [`pull`](#pull) * [`pull`](#pull)
@ -776,41 +773,21 @@ const unary = fn => val => fn(val);
### all ### all
Returns `true` if all elements in a collection are truthy, `false` otherwise.
Use `Array.every(Boolean)` to test if all elements in the collection are truthy.
```js
const all = arr => arr.every(Boolean);
```
<details>
<summary>Examples</summary>
```js
all([1, 2, 3]); // true
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### allBy
Returns `true` if the provided predicate function returns `true` for all elements in a collection, `false` otherwise. Returns `true` if the provided predicate function returns `true` for all elements in a collection, `false` otherwise.
Use `Array.every()` to test if all elements in the collection return `true` based on `fn`. Use `Array.every()` to test if all elements in the collection return `true` based on `fn`.
Omit the second argument, `fn`, to use `Boolean` as a default.
```js ```js
const allBy = (arr, fn) => arr.every(fn); const all = (arr, fn = Boolean) => arr.every(fn);
``` ```
<details> <details>
<summary>Examples</summary> <summary>Examples</summary>
```js ```js
allBy([4, 2, 3], x => x > 1); // true all([4, 2, 3], x => x > 1); // true
all([1, 2, 3]); // true
``` ```
</details> </details>
@ -820,41 +797,21 @@ allBy([4, 2, 3], x => x > 1); // true
### any ### any
Returns `true` if at least one element in a collection is truthy, `false` otherwise.
Use `Array.some(Boolean)` to test if any elements in the collection are truthy.
```js
const any = arr => arr.some(Boolean);
```
<details>
<summary>Examples</summary>
```js
any([0, 0, 1, 0]); // true
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### anyBy
Returns `true` if the provided predicate function returns `true` for at least one element in a collection, `false` otherwise. Returns `true` if the provided predicate function returns `true` for at least one element in a collection, `false` otherwise.
Use `Array.some()` to test if any elements in the collection return `true` based on `fn`. Use `Array.some()` to test if any elements in the collection return `true` based on `fn`.
Omit the second argument, `fn`, to use `Boolean` as a default.
```js ```js
const anyBy = (arr, fn) => arr.some(fn); const any = (arr, fn = Boolean) => arr.some(fn);
``` ```
<details> <details>
<summary>Examples</summary> <summary>Examples</summary>
```js ```js
anyBy([0, 1, 2, 0], x => x >= 2); // true any([0, 1, 2, 0], x => x >= 2); // true
any([0, 0, 1, 0]); // true
``` ```
</details> </details>
@ -1815,41 +1772,21 @@ minN([1, 2, 3], 2); // [1,2]
### none ### none
Returns `true` if no elements in a collection are truthy, `false` otherwise.
Use `!Array.some(Boolean)` to test if any elements in the collection are truthy.
```js
const none = arr => !arr.some(Boolean);
```
<details>
<summary>Examples</summary>
```js
none([0, 0, 0]); // true
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### noneBy
Returns `true` if the provided predicate function returns `false` for all elements in a collection, `false` otherwise. Returns `true` if the provided predicate function returns `false` for all elements in a collection, `false` otherwise.
Use `Array.some()` to test if any elements in the collection return `true` based on `fn`. Use `Array.some()` to test if any elements in the collection return `true` based on `fn`.
Omit the second argument, `fn`, to use `Boolean` as a default.
```js ```js
const noneBy = (arr, fn) => !arr.some(fn); const none = (arr, fn = Boolean) => !arr.some(fn);
``` ```
<details> <details>
<summary>Examples</summary> <summary>Examples</summary>
```js ```js
noneBy([0, 1, 3, 0], x => x == 2); // true none([0, 1, 3, 0], x => x == 2); // true
none([0, 0, 0]); // true
``` ```
</details> </details>

17
dist/_30s.es5.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

14
dist/_30s.esm.js vendored
View File

@ -25,9 +25,7 @@ const UUIDGeneratorNode = () =>
(c ^ (crypto$1.randomBytes(1)[0] & (15 >> (c / 4)))).toString(16) (c ^ (crypto$1.randomBytes(1)[0] & (15 >> (c / 4)))).toString(16)
); );
const all = arr => arr.every(Boolean); const all = (arr, fn = Boolean) => arr.every(fn);
const allBy = (arr, fn) => arr.every(fn);
const anagrams = str => { const anagrams = str => {
if (str.length <= 2) return str.length === 2 ? [str, str[1] + str[0]] : [str]; if (str.length <= 2) return str.length === 2 ? [str, str[1] + str[0]] : [str];
@ -40,9 +38,7 @@ const anagrams = str => {
); );
}; };
const any = arr => arr.some(Boolean); const any = (arr, fn = Boolean) => arr.some(fn);
const anyBy = (arr, fn) => arr.some(fn);
const approximatelyEqual = (v1, v2, epsilon = 0.001) => Math.abs(v1 - v2) < epsilon; const approximatelyEqual = (v1, v2, epsilon = 0.001) => Math.abs(v1 - v2) < epsilon;
@ -792,9 +788,7 @@ const mostPerformant = (fns, iterations = 10000) => {
const negate = func => (...args) => !func(...args); const negate = func => (...args) => !func(...args);
const none = arr => !arr.some(Boolean); const none = (arr, fn = Boolean) => !arr.some(fn);
const noneBy = (arr, fn) => !arr.some(fn);
const nthArg = n => (...args) => args.slice(n)[0]; const nthArg = n => (...args) => args.slice(n)[0];
@ -1423,6 +1417,6 @@ const zipWith = (...arrays) => {
return fn ? result.map(arr => fn(...arr)) : result; return fn ? result.map(arr => fn(...arr)) : result;
}; };
var imports = {JSONToFile,RGBToHex,URLJoin,UUIDGeneratorBrowser,UUIDGeneratorNode,all,allBy,anagrams,any,anyBy,approximatelyEqual,arrayToHtmlList,ary,atob,attempt,average,averageBy,bifurcate,bifurcateBy,bind,bindAll,bindKey,binomialCoefficient,bottomVisible,btoa,byteSize,call,capitalize,capitalizeEveryWord,castArray,chainAsync,chunk,clampNumber,cloneRegExp,coalesce,coalesceFactory,collectInto,colorize,compact,compose,composeRight,converge,copyToClipboard,countBy,countOccurrences,createElement,createEventHub,currentURL,curry,debounce,decapitalize,deepClone,deepFlatten,defaults,defer,degreesToRads,delay,detectDeviceType,difference,differenceBy,differenceWith,digitize,distance,drop,dropRight,dropRightWhile,dropWhile,elementIsVisibleInViewport,elo,equals,escapeHTML,escapeRegExp,everyNth,extendHex,factorial,fibonacci,filterNonUnique,findKey,findLast,findLastIndex,findLastKey,flatten,flattenObject,flip,forEachRight,forOwn,forOwnRight,formatDuration,fromCamelCase,functionName,functions,gcd,geometricProgression,get,getColonTimeFromDate,getDaysDiffBetweenDates,getMeridiemSuffixOfInteger,getScrollPosition,getStyle,getType,getURLParameters,groupBy,hammingDistance,hasClass,hasFlags,hashBrowser,hashNode,head,hexToRGB,hide,httpGet,httpPost,httpsRedirect,inRange,indexOfAll,initial,initialize2DArray,initializeArrayWithRange,initializeArrayWithRangeRight,initializeArrayWithValues,intersection,intersectionBy,intersectionWith,invertKeyValues,is,isAbsoluteURL,isArrayLike,isBoolean,isDivisible,isEmpty,isEven,isFunction,isLowerCase,isNil,isNull,isNumber,isObject,isObjectLike,isPlainObject,isPrime,isPrimitive,isPromiseLike,isSorted,isString,isSymbol,isTravisCI,isUndefined,isUpperCase,isValidJSON,join,last,lcm,longestItem,lowercaseKeys,luhnCheck,mapKeys,mapObject,mapValues,mask,matches,matchesWith,maxBy,maxN,median,memoize,merge,minBy,minN,mostPerformant,negate,none,noneBy,nthArg,nthElement,objectFromPairs,objectToPairs,observeMutations,off,omit,omitBy,on,onUserInputChange,once,orderBy,over,overArgs,palindrome,parseCookie,partial,partialRight,partition,percentile,pick,pickBy,pipeAsyncFunctions,pipeFunctions,pluralize,powerset,prettyBytes,primes,promisify,pull,pullAtIndex,pullAtValue,pullBy,radsToDegrees,randomHexColorCode,randomIntArrayInRange,randomIntegerInRange,randomNumberInRange,readFileLines,rearg,redirect,reduceSuccessive,reduceWhich,reducedFilter,remove,removeNonASCII,reverseString,round,runAsync,runPromisesInSeries,sample,sampleSize,scrollToTop,sdbm,serializeCookie,setStyle,shallowClone,show,shuffle,similarity,size,sleep,sortCharactersInString,sortedIndex,sortedIndexBy,sortedLastIndex,sortedLastIndexBy,splitLines,spreadOver,standardDeviation,stripHTMLTags,sum,sumBy,sumPower,symmetricDifference,symmetricDifferenceBy,symmetricDifferenceWith,tail,take,takeRight,takeRightWhile,takeWhile,throttle,timeTaken,times,toCamelCase,toCurrency,toDecimalMark,toKebabCase,toOrdinalSuffix,toSafeInteger,toSnakeCase,toggleClass,tomorrow,transform,truncateString,truthCheckCollection,unary,uncurry,unescapeHTML,unflattenObject,unfold,union,unionBy,unionWith,uniqueElements,untildify,unzip,unzipWith,validateNumber,without,words,xProd,yesNo,zip,zipObject,zipWith,} var imports = {JSONToFile,RGBToHex,URLJoin,UUIDGeneratorBrowser,UUIDGeneratorNode,all,anagrams,any,approximatelyEqual,arrayToHtmlList,ary,atob,attempt,average,averageBy,bifurcate,bifurcateBy,bind,bindAll,bindKey,binomialCoefficient,bottomVisible,btoa,byteSize,call,capitalize,capitalizeEveryWord,castArray,chainAsync,chunk,clampNumber,cloneRegExp,coalesce,coalesceFactory,collectInto,colorize,compact,compose,composeRight,converge,copyToClipboard,countBy,countOccurrences,createElement,createEventHub,currentURL,curry,debounce,decapitalize,deepClone,deepFlatten,defaults,defer,degreesToRads,delay,detectDeviceType,difference,differenceBy,differenceWith,digitize,distance,drop,dropRight,dropRightWhile,dropWhile,elementIsVisibleInViewport,elo,equals,escapeHTML,escapeRegExp,everyNth,extendHex,factorial,fibonacci,filterNonUnique,findKey,findLast,findLastIndex,findLastKey,flatten,flattenObject,flip,forEachRight,forOwn,forOwnRight,formatDuration,fromCamelCase,functionName,functions,gcd,geometricProgression,get,getColonTimeFromDate,getDaysDiffBetweenDates,getMeridiemSuffixOfInteger,getScrollPosition,getStyle,getType,getURLParameters,groupBy,hammingDistance,hasClass,hasFlags,hashBrowser,hashNode,head,hexToRGB,hide,httpGet,httpPost,httpsRedirect,inRange,indexOfAll,initial,initialize2DArray,initializeArrayWithRange,initializeArrayWithRangeRight,initializeArrayWithValues,intersection,intersectionBy,intersectionWith,invertKeyValues,is,isAbsoluteURL,isArrayLike,isBoolean,isDivisible,isEmpty,isEven,isFunction,isLowerCase,isNil,isNull,isNumber,isObject,isObjectLike,isPlainObject,isPrime,isPrimitive,isPromiseLike,isSorted,isString,isSymbol,isTravisCI,isUndefined,isUpperCase,isValidJSON,join,last,lcm,longestItem,lowercaseKeys,luhnCheck,mapKeys,mapObject,mapValues,mask,matches,matchesWith,maxBy,maxN,median,memoize,merge,minBy,minN,mostPerformant,negate,none,nthArg,nthElement,objectFromPairs,objectToPairs,observeMutations,off,omit,omitBy,on,onUserInputChange,once,orderBy,over,overArgs,palindrome,parseCookie,partial,partialRight,partition,percentile,pick,pickBy,pipeAsyncFunctions,pipeFunctions,pluralize,powerset,prettyBytes,primes,promisify,pull,pullAtIndex,pullAtValue,pullBy,radsToDegrees,randomHexColorCode,randomIntArrayInRange,randomIntegerInRange,randomNumberInRange,readFileLines,rearg,redirect,reduceSuccessive,reduceWhich,reducedFilter,remove,removeNonASCII,reverseString,round,runAsync,runPromisesInSeries,sample,sampleSize,scrollToTop,sdbm,serializeCookie,setStyle,shallowClone,show,shuffle,similarity,size,sleep,sortCharactersInString,sortedIndex,sortedIndexBy,sortedLastIndex,sortedLastIndexBy,splitLines,spreadOver,standardDeviation,stripHTMLTags,sum,sumBy,sumPower,symmetricDifference,symmetricDifferenceBy,symmetricDifferenceWith,tail,take,takeRight,takeRightWhile,takeWhile,throttle,timeTaken,times,toCamelCase,toCurrency,toDecimalMark,toKebabCase,toOrdinalSuffix,toSafeInteger,toSnakeCase,toggleClass,tomorrow,transform,truncateString,truthCheckCollection,unary,uncurry,unescapeHTML,unflattenObject,unfold,union,unionBy,unionWith,uniqueElements,untildify,unzip,unzipWith,validateNumber,without,words,xProd,yesNo,zip,zipObject,zipWith,}
export default imports; export default imports;

14
dist/_30s.js vendored
View File

@ -31,9 +31,7 @@ const UUIDGeneratorNode = () =>
(c ^ (crypto$1.randomBytes(1)[0] & (15 >> (c / 4)))).toString(16) (c ^ (crypto$1.randomBytes(1)[0] & (15 >> (c / 4)))).toString(16)
); );
const all = arr => arr.every(Boolean); const all = (arr, fn = Boolean) => arr.every(fn);
const allBy = (arr, fn) => arr.every(fn);
const anagrams = str => { const anagrams = str => {
if (str.length <= 2) return str.length === 2 ? [str, str[1] + str[0]] : [str]; if (str.length <= 2) return str.length === 2 ? [str, str[1] + str[0]] : [str];
@ -46,9 +44,7 @@ const anagrams = str => {
); );
}; };
const any = arr => arr.some(Boolean); const any = (arr, fn = Boolean) => arr.some(fn);
const anyBy = (arr, fn) => arr.some(fn);
const approximatelyEqual = (v1, v2, epsilon = 0.001) => Math.abs(v1 - v2) < epsilon; const approximatelyEqual = (v1, v2, epsilon = 0.001) => Math.abs(v1 - v2) < epsilon;
@ -798,9 +794,7 @@ const mostPerformant = (fns, iterations = 10000) => {
const negate = func => (...args) => !func(...args); const negate = func => (...args) => !func(...args);
const none = arr => !arr.some(Boolean); const none = (arr, fn = Boolean) => !arr.some(fn);
const noneBy = (arr, fn) => !arr.some(fn);
const nthArg = n => (...args) => args.slice(n)[0]; const nthArg = n => (...args) => args.slice(n)[0];
@ -1429,7 +1423,7 @@ const zipWith = (...arrays) => {
return fn ? result.map(arr => fn(...arr)) : result; return fn ? result.map(arr => fn(...arr)) : result;
}; };
var imports = {JSONToFile,RGBToHex,URLJoin,UUIDGeneratorBrowser,UUIDGeneratorNode,all,allBy,anagrams,any,anyBy,approximatelyEqual,arrayToHtmlList,ary,atob,attempt,average,averageBy,bifurcate,bifurcateBy,bind,bindAll,bindKey,binomialCoefficient,bottomVisible,btoa,byteSize,call,capitalize,capitalizeEveryWord,castArray,chainAsync,chunk,clampNumber,cloneRegExp,coalesce,coalesceFactory,collectInto,colorize,compact,compose,composeRight,converge,copyToClipboard,countBy,countOccurrences,createElement,createEventHub,currentURL,curry,debounce,decapitalize,deepClone,deepFlatten,defaults,defer,degreesToRads,delay,detectDeviceType,difference,differenceBy,differenceWith,digitize,distance,drop,dropRight,dropRightWhile,dropWhile,elementIsVisibleInViewport,elo,equals,escapeHTML,escapeRegExp,everyNth,extendHex,factorial,fibonacci,filterNonUnique,findKey,findLast,findLastIndex,findLastKey,flatten,flattenObject,flip,forEachRight,forOwn,forOwnRight,formatDuration,fromCamelCase,functionName,functions,gcd,geometricProgression,get,getColonTimeFromDate,getDaysDiffBetweenDates,getMeridiemSuffixOfInteger,getScrollPosition,getStyle,getType,getURLParameters,groupBy,hammingDistance,hasClass,hasFlags,hashBrowser,hashNode,head,hexToRGB,hide,httpGet,httpPost,httpsRedirect,inRange,indexOfAll,initial,initialize2DArray,initializeArrayWithRange,initializeArrayWithRangeRight,initializeArrayWithValues,intersection,intersectionBy,intersectionWith,invertKeyValues,is,isAbsoluteURL,isArrayLike,isBoolean,isDivisible,isEmpty,isEven,isFunction,isLowerCase,isNil,isNull,isNumber,isObject,isObjectLike,isPlainObject,isPrime,isPrimitive,isPromiseLike,isSorted,isString,isSymbol,isTravisCI,isUndefined,isUpperCase,isValidJSON,join,last,lcm,longestItem,lowercaseKeys,luhnCheck,mapKeys,mapObject,mapValues,mask,matches,matchesWith,maxBy,maxN,median,memoize,merge,minBy,minN,mostPerformant,negate,none,noneBy,nthArg,nthElement,objectFromPairs,objectToPairs,observeMutations,off,omit,omitBy,on,onUserInputChange,once,orderBy,over,overArgs,palindrome,parseCookie,partial,partialRight,partition,percentile,pick,pickBy,pipeAsyncFunctions,pipeFunctions,pluralize,powerset,prettyBytes,primes,promisify,pull,pullAtIndex,pullAtValue,pullBy,radsToDegrees,randomHexColorCode,randomIntArrayInRange,randomIntegerInRange,randomNumberInRange,readFileLines,rearg,redirect,reduceSuccessive,reduceWhich,reducedFilter,remove,removeNonASCII,reverseString,round,runAsync,runPromisesInSeries,sample,sampleSize,scrollToTop,sdbm,serializeCookie,setStyle,shallowClone,show,shuffle,similarity,size,sleep,sortCharactersInString,sortedIndex,sortedIndexBy,sortedLastIndex,sortedLastIndexBy,splitLines,spreadOver,standardDeviation,stripHTMLTags,sum,sumBy,sumPower,symmetricDifference,symmetricDifferenceBy,symmetricDifferenceWith,tail,take,takeRight,takeRightWhile,takeWhile,throttle,timeTaken,times,toCamelCase,toCurrency,toDecimalMark,toKebabCase,toOrdinalSuffix,toSafeInteger,toSnakeCase,toggleClass,tomorrow,transform,truncateString,truthCheckCollection,unary,uncurry,unescapeHTML,unflattenObject,unfold,union,unionBy,unionWith,uniqueElements,untildify,unzip,unzipWith,validateNumber,without,words,xProd,yesNo,zip,zipObject,zipWith,} var imports = {JSONToFile,RGBToHex,URLJoin,UUIDGeneratorBrowser,UUIDGeneratorNode,all,anagrams,any,approximatelyEqual,arrayToHtmlList,ary,atob,attempt,average,averageBy,bifurcate,bifurcateBy,bind,bindAll,bindKey,binomialCoefficient,bottomVisible,btoa,byteSize,call,capitalize,capitalizeEveryWord,castArray,chainAsync,chunk,clampNumber,cloneRegExp,coalesce,coalesceFactory,collectInto,colorize,compact,compose,composeRight,converge,copyToClipboard,countBy,countOccurrences,createElement,createEventHub,currentURL,curry,debounce,decapitalize,deepClone,deepFlatten,defaults,defer,degreesToRads,delay,detectDeviceType,difference,differenceBy,differenceWith,digitize,distance,drop,dropRight,dropRightWhile,dropWhile,elementIsVisibleInViewport,elo,equals,escapeHTML,escapeRegExp,everyNth,extendHex,factorial,fibonacci,filterNonUnique,findKey,findLast,findLastIndex,findLastKey,flatten,flattenObject,flip,forEachRight,forOwn,forOwnRight,formatDuration,fromCamelCase,functionName,functions,gcd,geometricProgression,get,getColonTimeFromDate,getDaysDiffBetweenDates,getMeridiemSuffixOfInteger,getScrollPosition,getStyle,getType,getURLParameters,groupBy,hammingDistance,hasClass,hasFlags,hashBrowser,hashNode,head,hexToRGB,hide,httpGet,httpPost,httpsRedirect,inRange,indexOfAll,initial,initialize2DArray,initializeArrayWithRange,initializeArrayWithRangeRight,initializeArrayWithValues,intersection,intersectionBy,intersectionWith,invertKeyValues,is,isAbsoluteURL,isArrayLike,isBoolean,isDivisible,isEmpty,isEven,isFunction,isLowerCase,isNil,isNull,isNumber,isObject,isObjectLike,isPlainObject,isPrime,isPrimitive,isPromiseLike,isSorted,isString,isSymbol,isTravisCI,isUndefined,isUpperCase,isValidJSON,join,last,lcm,longestItem,lowercaseKeys,luhnCheck,mapKeys,mapObject,mapValues,mask,matches,matchesWith,maxBy,maxN,median,memoize,merge,minBy,minN,mostPerformant,negate,none,nthArg,nthElement,objectFromPairs,objectToPairs,observeMutations,off,omit,omitBy,on,onUserInputChange,once,orderBy,over,overArgs,palindrome,parseCookie,partial,partialRight,partition,percentile,pick,pickBy,pipeAsyncFunctions,pipeFunctions,pluralize,powerset,prettyBytes,primes,promisify,pull,pullAtIndex,pullAtValue,pullBy,radsToDegrees,randomHexColorCode,randomIntArrayInRange,randomIntegerInRange,randomNumberInRange,readFileLines,rearg,redirect,reduceSuccessive,reduceWhich,reducedFilter,remove,removeNonASCII,reverseString,round,runAsync,runPromisesInSeries,sample,sampleSize,scrollToTop,sdbm,serializeCookie,setStyle,shallowClone,show,shuffle,similarity,size,sleep,sortCharactersInString,sortedIndex,sortedIndexBy,sortedLastIndex,sortedLastIndexBy,splitLines,spreadOver,standardDeviation,stripHTMLTags,sum,sumBy,sumPower,symmetricDifference,symmetricDifferenceBy,symmetricDifferenceWith,tail,take,takeRight,takeRightWhile,takeWhile,throttle,timeTaken,times,toCamelCase,toCurrency,toDecimalMark,toKebabCase,toOrdinalSuffix,toSafeInteger,toSnakeCase,toggleClass,tomorrow,transform,truncateString,truthCheckCollection,unary,uncurry,unescapeHTML,unflattenObject,unfold,union,unionBy,unionWith,uniqueElements,untildify,unzip,unzipWith,validateNumber,without,words,xProd,yesNo,zip,zipObject,zipWith,}
return imports; return imports;

2
dist/_30s.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -19,7 +19,7 @@
}, },
"name": "30-seconds-of-code", "name": "30-seconds-of-code",
"description": "A collection of useful JavaScript snippets.", "description": "A collection of useful JavaScript snippets.",
"version": "0.0.1", "version": "0.0.2",
"main": "dist/_30s.js", "main": "dist/_30s.js",
"module": "dist/_30s.esm.js", "module": "dist/_30s.esm.js",
"scripts": { "scripts": {

View File

@ -1,13 +1,15 @@
### all ### all
Returns `true` if all elements in a collection are truthy, `false` otherwise. Returns `true` if the provided predicate function returns `true` for all elements in a collection, `false` otherwise.
Use `Array.every(Boolean)` to test if all elements in the collection are truthy. Use `Array.every()` to test if all elements in the collection return `true` based on `fn`.
Omit the second argument, `fn`, to use `Boolean` as a default.
```js ```js
const all = arr => arr.every(Boolean); const all = (arr, fn = Boolean) => arr.every(fn);
``` ```
```js ```js
all([4, 2, 3], x => x > 1); // true
all([1, 2, 3]); // true all([1, 2, 3]); // true
``` ```

View File

@ -1,13 +0,0 @@
### allBy
Returns `true` if the provided predicate function returns `true` for all elements in a collection, `false` otherwise.
Use `Array.every()` to test if all elements in the collection return `true` based on `fn`.
```js
const allBy = (arr, fn) => arr.every(fn);
```
```js
allBy([4, 2, 3], x => x > 1); // true
```

View File

@ -1,13 +1,15 @@
### any ### any
Returns `true` if at least one element in a collection is truthy, `false` otherwise. Returns `true` if the provided predicate function returns `true` for at least one element in a collection, `false` otherwise.
Use `Array.some(Boolean)` to test if any elements in the collection are truthy. Use `Array.some()` to test if any elements in the collection return `true` based on `fn`.
Omit the second argument, `fn`, to use `Boolean` as a default.
```js ```js
const any = arr => arr.some(Boolean); const any = (arr, fn = Boolean) => arr.some(fn);
``` ```
```js ```js
any([0, 1, 2, 0], x => x >= 2); // true
any([0, 0, 1, 0]); // true any([0, 0, 1, 0]); // true
``` ```

View File

@ -1,13 +0,0 @@
### anyBy
Returns `true` if the provided predicate function returns `true` for at least one element in a collection, `false` otherwise.
Use `Array.some()` to test if any elements in the collection return `true` based on `fn`.
```js
const anyBy = (arr, fn) => arr.some(fn);
```
```js
anyBy([0, 1, 2, 0], x => x >= 2); // true
```

View File

@ -1,13 +1,15 @@
### none ### none
Returns `true` if no elements in a collection are truthy, `false` otherwise. Returns `true` if the provided predicate function returns `false` for all elements in a collection, `false` otherwise.
Use `!Array.some(Boolean)` to test if any elements in the collection are truthy. Use `Array.some()` to test if any elements in the collection return `true` based on `fn`.
Omit the second argument, `fn`, to use `Boolean` as a default.
```js ```js
const none = arr => !arr.some(Boolean); const none = (arr, fn = Boolean) => !arr.some(fn);
``` ```
```js ```js
none([0, 1, 3, 0], x => x == 2); // true
none([0, 0, 0]); // true none([0, 0, 0]); // true
``` ```

View File

@ -1,13 +0,0 @@
### noneBy
Returns `true` if the provided predicate function returns `false` for all elements in a collection, `false` otherwise.
Use `Array.some()` to test if any elements in the collection return `true` based on `fn`.
```js
const noneBy = (arr, fn) => !arr.some(fn);
```
```js
noneBy([0, 1, 3, 0], x => x == 2); // true
```

View File

@ -1,8 +1,6 @@
all:array all:array,function
allBy:array,function
anagrams:string,recursion anagrams:string,recursion
any:array any:array,function
anyBy:array,function
approximatelyEqual:math approximatelyEqual:math
arrayToHtmlList:browser,array arrayToHtmlList:browser,array
ary:adapter,function ary:adapter,function
@ -164,8 +162,7 @@ minBy:math,array,function
minN:array,math minN:array,math
mostPerformant:utility,function mostPerformant:utility,function
negate:function negate:function
none:array none:array,function
noneBy:array,function
nthArg:utility,function nthArg:utility,function
nthElement:array nthElement:array
objectFromPairs:object,array objectFromPairs:object,array

View File

@ -1,2 +1,2 @@
const all = arr => arr.every(Boolean); const all = (arr, fn = Boolean) => arr.every(fn);
module.exports = all; module.exports = all;

View File

@ -11,6 +11,8 @@ test('Testing all', (t) => {
t.false(all([undefined,1]), 'Returns false for arrays with undefined'); t.false(all([undefined,1]), 'Returns false for arrays with undefined');
t.false(all([null,1]), 'Returns false for arrays with null'); t.false(all([null,1]), 'Returns false for arrays with null');
t.false(all(['',1]), 'Returns false for arrays with empty strings'); t.false(all(['',1]), 'Returns false for arrays with empty strings');
t.true(all([4,1,2,3], x => x >= 1), 'Returns true with predicate function');
t.false(all([0,1], x => x >= 1), 'Returns false with a predicate function');
//t.deepEqual(all(args..), 'Expected'); //t.deepEqual(all(args..), 'Expected');
//t.equal(all(args..), 'Expected'); //t.equal(all(args..), 'Expected');
//t.false(all(args..), 'Expected'); //t.false(all(args..), 'Expected');

View File

@ -1,2 +0,0 @@
const allBy = (arr, fn) => arr.every(fn);
module.exports = allBy;

View File

@ -1,15 +0,0 @@
const test = require('tape');
const allBy = require('./allBy.js');
test('Testing allBy', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof allBy === 'function', 'allBy is a Function');
t.true(allBy([4,1,2,3], x => x >= 1), 'Returns true with predicate function');
t.false(allBy([0,1], x => x >= 1), 'Returns false with a predicate function');
//t.deepEqual(allBy(args..), 'Expected');
//t.equal(allBy(args..), 'Expected');
//t.false(allBy(args..), 'Expected');
//t.throws(allBy(args..), 'Expected');
t.end();
});

View File

@ -1,2 +1,2 @@
const any = arr => arr.some(Boolean); const any = (arr, fn = Boolean) => arr.some(fn);
module.exports = any; module.exports = any;

View File

@ -8,6 +8,8 @@ test('Testing any', (t) => {
t.true(any([0,1,2,3]), 'Returns true for arrays with at least one truthy value'); t.true(any([0,1,2,3]), 'Returns true for arrays with at least one truthy value');
t.false(any([0,0]), 'Returns false for arrays with no truthy values'); t.false(any([0,0]), 'Returns false for arrays with no truthy values');
t.false(any([NaN,0,undefined,null,'']), 'Returns false for arrays with no truthy values'); t.false(any([NaN,0,undefined,null,'']), 'Returns false for arrays with no truthy values');
t.true(any([4,1,0,3], x => x >= 1), 'Returns true with predicate function');
t.false(any([0,1], x => x < 0), 'Returns false with a predicate function');
//t.deepEqual(any(args..), 'Expected'); //t.deepEqual(any(args..), 'Expected');
//t.equal(any(args..), 'Expected'); //t.equal(any(args..), 'Expected');
//t.false(any(args..), 'Expected'); //t.false(any(args..), 'Expected');

View File

@ -1,2 +0,0 @@
const anyBy = (arr, fn) => arr.some(fn);
module.exports = anyBy;

View File

@ -1,15 +0,0 @@
const test = require('tape');
const anyBy = require('./anyBy.js');
test('Testing anyBy', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof anyBy === 'function', 'anyBy is a Function');
t.true(anyBy([4,1,0,3], x => x >= 1), 'Returns true with predicate function');
t.false(anyBy([0,1], x => x < 0), 'Returns false with a predicate function');
//t.deepEqual(anyBy(args..), 'Expected');
//t.equal(anyBy(args..), 'Expected');
//t.false(anyBy(args..), 'Expected');
//t.throws(anyBy(args..), 'Expected');
t.end();
});

View File

@ -5,9 +5,10 @@ test('Testing arrayToHtmlList', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof arrayToHtmlList === 'function', 'arrayToHtmlList is a Function'); t.true(typeof arrayToHtmlList === 'function', 'arrayToHtmlList is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(arrayToHtmlList(args..), 'Expected'); //t.deepEqual(arrayToHtmlList(args..), 'Expected');
//t.equal(arrayToHtmlList(args..), 'Expected'); //t.equal(arrayToHtmlList(args..), 'Expected');
//t.false(arrayToHtmlList(args..), 'Expected'); //t.false(arrayToHtmlList(args..), 'Expected');
//t.throws(arrayToHtmlList(args..), 'Expected'); //t.throws(arrayToHtmlList(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,22 +5,19 @@ test('Testing chainAsync', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof chainAsync === 'function', 'chainAsync is a Function'); t.true(typeof chainAsync === 'function', 'chainAsync is a Function');
//t.deepEqual(chainAsync(args..), 'Expected'); chainAsync([
// chainAsync([ next => {
// next => { next();
// next(); },
// }, next => {
// next => { (() => {
// (() =>{ next();
// next() })();
// })(); },
// }, next => {
// next => { t.pass("Calls all functions in an array");
// t.pass("Calls all functions in an array"); }
// next(); ]);
// }
// ]);
//
// // Ensure we wait for the 2nd assertion to be made // // Ensure we wait for the 2nd assertion to be made
// t.plan(2); // t.plan(2);

View File

@ -5,9 +5,10 @@ test('Testing createElement', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof createElement === 'function', 'createElement is a Function'); t.true(typeof createElement === 'function', 'createElement is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(createElement(args..), 'Expected'); //t.deepEqual(createElement(args..), 'Expected');
//t.equal(createElement(args..), 'Expected'); //t.equal(createElement(args..), 'Expected');
//t.false(createElement(args..), 'Expected'); //t.false(createElement(args..), 'Expected');
//t.throws(createElement(args..), 'Expected'); //t.throws(createElement(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing createEventHub', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof createEventHub === 'function', 'createEventHub is a Function'); t.true(typeof createEventHub === 'function', 'createEventHub is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(createEventHub(args..), 'Expected'); //t.deepEqual(createEventHub(args..), 'Expected');
//t.equal(createEventHub(args..), 'Expected'); //t.equal(createEventHub(args..), 'Expected');
//t.false(createEventHub(args..), 'Expected'); //t.false(createEventHub(args..), 'Expected');
//t.throws(createEventHub(args..), 'Expected'); //t.throws(createEventHub(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing currentURL', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof currentURL === 'function', 'currentURL is a Function'); t.true(typeof currentURL === 'function', 'currentURL is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(currentURL(args..), 'Expected'); //t.deepEqual(currentURL(args..), 'Expected');
//t.equal(currentURL(args..), 'Expected'); //t.equal(currentURL(args..), 'Expected');
//t.false(currentURL(args..), 'Expected'); //t.false(currentURL(args..), 'Expected');
//t.throws(currentURL(args..), 'Expected'); //t.throws(currentURL(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing debounce', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof debounce === 'function', 'debounce is a Function'); t.true(typeof debounce === 'function', 'debounce is a Function');
debounce(() => {t.pass('Works as expected');}, 250);
//t.deepEqual(debounce(args..), 'Expected'); //t.deepEqual(debounce(args..), 'Expected');
//t.equal(debounce(args..), 'Expected'); //t.equal(debounce(args..), 'Expected');
//t.false(debounce(args..), 'Expected'); //t.false(debounce(args..), 'Expected');
//t.throws(debounce(args..), 'Expected'); //t.throws(debounce(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing defaults', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof defaults === 'function', 'defaults is a Function'); t.true(typeof defaults === 'function', 'defaults is a Function');
t.deepEqual(defaults({ a: 1 }, { b: 2 }, { b: 6 }, { a: 3 }), { a: 1, b: 2 }, 'Assigns default values for undefined properties');
//t.deepEqual(defaults(args..), 'Expected'); //t.deepEqual(defaults(args..), 'Expected');
//t.equal(defaults(args..), 'Expected'); //t.equal(defaults(args..), 'Expected');
//t.false(defaults(args..), 'Expected'); //t.false(defaults(args..), 'Expected');
//t.throws(defaults(args..), 'Expected'); //t.throws(defaults(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing defer', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof defer === 'function', 'defer is a Function'); t.true(typeof defer === 'function', 'defer is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(defer(args..), 'Expected'); //t.deepEqual(defer(args..), 'Expected');
//t.equal(defer(args..), 'Expected'); //t.equal(defer(args..), 'Expected');
//t.false(defer(args..), 'Expected'); //t.false(defer(args..), 'Expected');
//t.throws(defer(args..), 'Expected'); //t.throws(defer(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,16 @@ test('Testing delay', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof delay === 'function', 'delay is a Function'); t.true(typeof delay === 'function', 'delay is a Function');
delay(
function(text) {
t.equals(text, 'test', 'Works as expecting, passing arguments properly');
},
1000,
'test'
);
//t.deepEqual(delay(args..), 'Expected'); //t.deepEqual(delay(args..), 'Expected');
//t.equal(delay(args..), 'Expected'); //t.equal(delay(args..), 'Expected');
//t.false(delay(args..), 'Expected'); //t.false(delay(args..), 'Expected');
//t.throws(delay(args..), 'Expected'); //t.throws(delay(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing getScrollPosition', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof getScrollPosition === 'function', 'getScrollPosition is a Function'); t.true(typeof getScrollPosition === 'function', 'getScrollPosition is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(getScrollPosition(args..), 'Expected'); //t.deepEqual(getScrollPosition(args..), 'Expected');
//t.equal(getScrollPosition(args..), 'Expected'); //t.equal(getScrollPosition(args..), 'Expected');
//t.false(getScrollPosition(args..), 'Expected'); //t.false(getScrollPosition(args..), 'Expected');
//t.throws(getScrollPosition(args..), 'Expected'); //t.throws(getScrollPosition(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing getStyle', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof getStyle === 'function', 'getStyle is a Function'); t.true(typeof getStyle === 'function', 'getStyle is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(getStyle(args..), 'Expected'); //t.deepEqual(getStyle(args..), 'Expected');
//t.equal(getStyle(args..), 'Expected'); //t.equal(getStyle(args..), 'Expected');
//t.false(getStyle(args..), 'Expected'); //t.false(getStyle(args..), 'Expected');
//t.throws(getStyle(args..), 'Expected'); //t.throws(getStyle(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing hasFlags', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof hasFlags === 'function', 'hasFlags is a Function'); t.true(typeof hasFlags === 'function', 'hasFlags is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(hasFlags(args..), 'Expected'); //t.deepEqual(hasFlags(args..), 'Expected');
//t.equal(hasFlags(args..), 'Expected'); //t.equal(hasFlags(args..), 'Expected');
//t.false(hasFlags(args..), 'Expected'); //t.false(hasFlags(args..), 'Expected');
//t.throws(hasFlags(args..), 'Expected'); //t.throws(hasFlags(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing hashBrowser', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof hashBrowser === 'function', 'hashBrowser is a Function'); t.true(typeof hashBrowser === 'function', 'hashBrowser is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(hashBrowser(args..), 'Expected'); //t.deepEqual(hashBrowser(args..), 'Expected');
//t.equal(hashBrowser(args..), 'Expected'); //t.equal(hashBrowser(args..), 'Expected');
//t.false(hashBrowser(args..), 'Expected'); //t.false(hashBrowser(args..), 'Expected');
//t.throws(hashBrowser(args..), 'Expected'); //t.throws(hashBrowser(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing hide', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof hide === 'function', 'hide is a Function'); t.true(typeof hide === 'function', 'hide is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(hide(args..), 'Expected'); //t.deepEqual(hide(args..), 'Expected');
//t.equal(hide(args..), 'Expected'); //t.equal(hide(args..), 'Expected');
//t.false(hide(args..), 'Expected'); //t.false(hide(args..), 'Expected');
//t.throws(hide(args..), 'Expected'); //t.throws(hide(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing mostPerformant', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof mostPerformant === 'function', 'mostPerformant is a Function'); t.true(typeof mostPerformant === 'function', 'mostPerformant is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(mostPerformant(args..), 'Expected'); //t.deepEqual(mostPerformant(args..), 'Expected');
//t.equal(mostPerformant(args..), 'Expected'); //t.equal(mostPerformant(args..), 'Expected');
//t.false(mostPerformant(args..), 'Expected'); //t.false(mostPerformant(args..), 'Expected');
//t.throws(mostPerformant(args..), 'Expected'); //t.throws(mostPerformant(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -1,2 +1,2 @@
const none = arr => !arr.some(Boolean); const none = (arr, fn = Boolean) => !arr.some(fn);
module.exports = none; module.exports = none;

View File

@ -7,6 +7,8 @@ test('Testing none', (t) => {
t.true(typeof none === 'function', 'none is a Function'); t.true(typeof none === 'function', 'none is a Function');
t.true(none([0,undefined,NaN,null,'']), 'Returns true for arrays with no truthy values'); t.true(none([0,undefined,NaN,null,'']), 'Returns true for arrays with no truthy values');
t.false(none([0,1]), 'Returns false for arrays with at least one truthy value'); t.false(none([0,1]), 'Returns false for arrays with at least one truthy value');
t.true(none([4,1,0,3], x => x < 0), 'Returns true with a predicate function');
t.false(none([0,1,2], x => x === 1), 'Returns false with predicate function');
//t.deepEqual(none(args..), 'Expected'); //t.deepEqual(none(args..), 'Expected');
//t.equal(none(args..), 'Expected'); //t.equal(none(args..), 'Expected');
//t.false(none(args..), 'Expected'); //t.false(none(args..), 'Expected');

View File

@ -1,2 +0,0 @@
const noneBy = (arr, fn) => !arr.some(fn);
module.exports = noneBy;

View File

@ -1,15 +0,0 @@
const test = require('tape');
const noneBy = require('./noneBy.js');
test('Testing noneBy', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof noneBy === 'function', 'noneBy is a Function');
t.true(noneBy([4,1,0,3], x => x < 0), 'Returns true with a predicate function');
t.false(noneBy([0,1,2], x => x === 1), 'Returns false with predicate function');
//t.deepEqual(noneBy(args..), 'Expected');
//t.equal(noneBy(args..), 'Expected');
//t.false(noneBy(args..), 'Expected');
//t.throws(noneBy(args..), 'Expected');
t.end();
});

View File

@ -5,9 +5,10 @@ test('Testing off', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof off === 'function', 'off is a Function'); t.true(typeof off === 'function', 'off is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(off(args..), 'Expected'); //t.deepEqual(off(args..), 'Expected');
//t.equal(off(args..), 'Expected'); //t.equal(off(args..), 'Expected');
//t.false(off(args..), 'Expected'); //t.false(off(args..), 'Expected');
//t.throws(off(args..), 'Expected'); //t.throws(off(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing on', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof on === 'function', 'on is a Function'); t.true(typeof on === 'function', 'on is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(on(args..), 'Expected'); //t.deepEqual(on(args..), 'Expected');
//t.equal(on(args..), 'Expected'); //t.equal(on(args..), 'Expected');
//t.false(on(args..), 'Expected'); //t.false(on(args..), 'Expected');
//t.throws(on(args..), 'Expected'); //t.throws(on(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing onUserInputChange', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof onUserInputChange === 'function', 'onUserInputChange is a Function'); t.true(typeof onUserInputChange === 'function', 'onUserInputChange is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(onUserInputChange(args..), 'Expected'); //t.deepEqual(onUserInputChange(args..), 'Expected');
//t.equal(onUserInputChange(args..), 'Expected'); //t.equal(onUserInputChange(args..), 'Expected');
//t.false(onUserInputChange(args..), 'Expected'); //t.false(onUserInputChange(args..), 'Expected');
//t.throws(onUserInputChange(args..), 'Expected'); //t.throws(onUserInputChange(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing once', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof once === 'function', 'once is a Function'); t.true(typeof once === 'function', 'once is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(once(args..), 'Expected'); //t.deepEqual(once(args..), 'Expected');
//t.equal(once(args..), 'Expected'); //t.equal(once(args..), 'Expected');
//t.false(once(args..), 'Expected'); //t.false(once(args..), 'Expected');
//t.throws(once(args..), 'Expected'); //t.throws(once(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -8,8 +8,8 @@ test('Testing randomHexColorCode', (t) => {
//t.deepEqual(randomHexColorCode(args..), 'Expected'); //t.deepEqual(randomHexColorCode(args..), 'Expected');
t.equal(randomHexColorCode().length, 7); t.equal(randomHexColorCode().length, 7);
t.true(randomHexColorCode().startsWith('#'),'The color code starts with "#"'); t.true(randomHexColorCode().startsWith('#'),'The color code starts with "#"');
t.true(randomHexColorCode().slice(1).match(/[^0123456789abcdef]/i) === null) t.true(randomHexColorCode().slice(1).match(/[^0123456789abcdef]/i) === null,'The color code contains only valid hex-digits');
//t.false(randomHexColorCode(args..), 'Expected'); //t.false(randomHexColorCode(args..), 'Expected');
//t.throws(randomHexColorCode(args..), 'Expected'); //t.throws(randomHexColorCode(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing setStyle', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof setStyle === 'function', 'setStyle is a Function'); t.true(typeof setStyle === 'function', 'setStyle is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(setStyle(args..), 'Expected'); //t.deepEqual(setStyle(args..), 'Expected');
//t.equal(setStyle(args..), 'Expected'); //t.equal(setStyle(args..), 'Expected');
//t.false(setStyle(args..), 'Expected'); //t.false(setStyle(args..), 'Expected');
//t.throws(setStyle(args..), 'Expected'); //t.throws(setStyle(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing show', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof show === 'function', 'show is a Function'); t.true(typeof show === 'function', 'show is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(show(args..), 'Expected'); //t.deepEqual(show(args..), 'Expected');
//t.equal(show(args..), 'Expected'); //t.equal(show(args..), 'Expected');
//t.false(show(args..), 'Expected'); //t.false(show(args..), 'Expected');
//t.throws(show(args..), 'Expected'); //t.throws(show(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,13 @@ test('Testing sleep', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof sleep === 'function', 'sleep is a Function'); t.true(typeof sleep === 'function', 'sleep is a Function');
async function sleepyWork() {
await sleep(1000);
t.pass('Works as expected');
}
//t.deepEqual(sleep(args..), 'Expected'); //t.deepEqual(sleep(args..), 'Expected');
//t.equal(sleep(args..), 'Expected'); //t.equal(sleep(args..), 'Expected');
//t.false(sleep(args..), 'Expected'); //t.false(sleep(args..), 'Expected');
//t.throws(sleep(args..), 'Expected'); //t.throws(sleep(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -1,24 +1,20 @@
Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time) Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
> 30-seconds-of-code@0.0.1 test R:\github\30-seconds-of-code > 30-seconds-of-code@0.0.2 test /home/travis/build/Chalarangelo/30-seconds-of-code
> tape test/**/*.test.js | tap-spec > tape test/**/*.test.js | tap-spec
Testing all Testing all
all is a Function all is a Function
Returns true for arrays with no falsey values Returns true for arrays with no falsey values
Returns false for arrays with 0 Returns false for arrays with 0
Returns false for arrays with NaN Returns false for arrays with NaN
Returns false for arrays with undefined Returns false for arrays with undefined
Returns false for arrays with null Returns false for arrays with null
Returns false for arrays with empty strings Returns false for arrays with empty strings
✔ Returns true with predicate function
Testing allBy ✔ Returns false with a predicate function
√ allBy is a Function
√ Returns true with predicate function
√ Returns false with a predicate function
Testing anagrams Testing anagrams
@ -29,16 +25,12 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing any Testing any
any is a Function any is a Function
Returns true for arrays with at least one truthy value Returns true for arrays with at least one truthy value
Returns false for arrays with no truthy values Returns false for arrays with no truthy values
Returns false for arrays with no truthy values Returns false for arrays with no truthy values
✔ Returns true with predicate function
Testing anyBy ✔ Returns false with a predicate function
√ anyBy is a Function
√ Returns true with predicate function
√ Returns false with a predicate function
Testing approximatelyEqual Testing approximatelyEqual
@ -50,7 +42,8 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing arrayToHtmlList Testing arrayToHtmlList
arrayToHtmlList is a Function arrayToHtmlList is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing ary Testing ary
@ -71,18 +64,18 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing average Testing average
average is a Function average is a Function
average(true) returns 0 average(true) returns 0
average(false) returns 1 average(false) returns 1
average(9, 1) returns 5 average(9, 1) returns 5
average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631) returns 32163.909090909092 average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631) returns 32163.909090909092
average(1, 2, 3) returns 2 average(1, 2, 3) returns 2
average(null) returns 0 average(null) returns 0
average(1, 2, 3) returns NaN average(1, 2, 3) returns NaN
average(String) returns NaN average(String) returns NaN
average({ a: 123}) returns NaN average({ a: 123}) returns NaN
average([undefined, 0, string]) returns NaN average([undefined, 0, string]) returns NaN
average([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run average([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run
Testing averageBy Testing averageBy
@ -180,7 +173,8 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing chainAsync Testing chainAsync
chainAsync is a Function chainAsync is a Function
✔ Calls all functions in an array
Testing chunk Testing chunk
@ -279,15 +273,18 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing createElement Testing createElement
createElement is a Function createElement is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing createEventHub Testing createEventHub
createEventHub is a Function createEventHub is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing currentURL Testing currentURL
currentURL is a Function currentURL is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing curry Testing curry
@ -318,11 +315,13 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing defaults Testing defaults
defaults is a Function defaults is a Function
✔ Assigns default values for undefined properties
Testing defer Testing defer
defer is a Function defer is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing degreesToRads Testing degreesToRads
@ -576,11 +575,13 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing getScrollPosition Testing getScrollPosition
getScrollPosition is a Function getScrollPosition is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing getStyle Testing getStyle
getStyle is a Function getStyle is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing getType Testing getType
@ -609,11 +610,13 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing hasFlags Testing hasFlags
hasFlags is a Function hasFlags is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing hashBrowser Testing hashBrowser
hashBrowser is a Function hashBrowser is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing hashNode Testing hashNode
@ -640,7 +643,8 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing hide Testing hide
hide is a Function hide is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing howManyTimes Testing howManyTimes
@ -1086,7 +1090,8 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing mostPerformant Testing mostPerformant
mostPerformant is a Function mostPerformant is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing negate Testing negate
@ -1095,15 +1100,11 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing none Testing none
none is a Function none is a Function
Returns true for arrays with no truthy values Returns true for arrays with no truthy values
Returns false for arrays with at least one truthy value Returns false for arrays with at least one truthy value
✔ Returns true with a predicate function
Testing noneBy ✔ Returns false with predicate function
√ noneBy is a Function
√ Returns true with a predicate function
√ Returns false with predicate function
Testing nthArg Testing nthArg
@ -1135,7 +1136,8 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing off Testing off
off is a Function off is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing omit Testing omit
@ -1149,15 +1151,18 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing on Testing on
on is a Function on is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing once Testing once
once is a Function onUserInputChange is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing onUserInputChange Testing onUserInputChange
onUserInputChange is a Function once is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing orderBy Testing orderBy
@ -1299,10 +1304,10 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing randomHexColorCode Testing randomHexColorCode
randomHexColorCode is a Function randomHexColorCode is a Function
should be equal should be equal
The color code starts with "#" The color code starts with "#"
√ should be truthy ✔ The color code contains only valid hex-digits
Testing randomIntArrayInRange Testing randomIntArrayInRange
@ -1435,7 +1440,8 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing setStyle Testing setStyle
setStyle is a Function setStyle is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing shallowClone Testing shallowClone
@ -1445,7 +1451,8 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing show Testing show
show is a Function show is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing shuffle Testing shuffle
@ -1586,12 +1593,13 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing throttle Testing throttle
throttle is a Function throttle is a Function
✔ Tested by @chalarangelo on 16/02/2018
Testing times Testing times
times is a Function timeTaken is a Function
√ Runs a function the specified amount of times ✔ Tested by @chalarangelo on 16/02/2018
Testing timeTaken Testing timeTaken
@ -1656,18 +1664,8 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing toSafeInteger Testing toSafeInteger
toSafeInteger is a Function toggleClass is a Function
√ Number(toSafeInteger(3.2)) is a number ✔ Tested by @chalarangelo on 16/02/2018
√ Converts a value to a safe integer
√ toSafeInteger('4.2') returns 4
√ toSafeInteger(4.6) returns 5
√ toSafeInteger([]) returns 0
√ isNaN(toSafeInteger([1.5, 3124])) is true
√ isNaN(toSafeInteger('string')) is true
√ isNaN(toSafeInteger({})) is true
√ isNaN(toSafeInteger()) is true
√ toSafeInteger(Infinity) returns 9007199254740991
√ toSafeInteger(3.2) takes less than 2s to run
Testing toSnakeCase Testing toSnakeCase
@ -1890,16 +1888,17 @@ Test log for: Sat Feb 17 2018 21:51:17 GMT+0530 (India Standard Time)
Testing zipWith Testing zipWith
zipWith is a Function zipWith is a Function
√ Runs the function provided ✔ Sends a GET request
Runs promises in series Runs the function provided
Sends a GET request Sends a POST request
√ Works with multiple promises ✔ Runs promises in series
√ Sends a POST request ✔ Works as expecting, passing arguments properly
✔ Works with multiple promises
total: 951 total: 970
passing: 951 passing: 970
duration: 5.6s duration: 2.5s

View File

@ -5,9 +5,10 @@ test('Testing throttle', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof throttle === 'function', 'throttle is a Function'); t.true(typeof throttle === 'function', 'throttle is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(throttle(args..), 'Expected'); //t.deepEqual(throttle(args..), 'Expected');
//t.equal(throttle(args..), 'Expected'); //t.equal(throttle(args..), 'Expected');
//t.false(throttle(args..), 'Expected'); //t.false(throttle(args..), 'Expected');
//t.throws(throttle(args..), 'Expected'); //t.throws(throttle(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing timeTaken', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof timeTaken === 'function', 'timeTaken is a Function'); t.true(typeof timeTaken === 'function', 'timeTaken is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(timeTaken(args..), 'Expected'); //t.deepEqual(timeTaken(args..), 'Expected');
//t.equal(timeTaken(args..), 'Expected'); //t.equal(timeTaken(args..), 'Expected');
//t.false(timeTaken(args..), 'Expected'); //t.false(timeTaken(args..), 'Expected');
//t.throws(timeTaken(args..), 'Expected'); //t.throws(timeTaken(args..), 'Expected');
t.end(); t.end();
}); });

View File

@ -5,9 +5,10 @@ test('Testing toggleClass', (t) => {
//For more information on all the methods supported by tape //For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape //Please go to https://github.com/substack/tape
t.true(typeof toggleClass === 'function', 'toggleClass is a Function'); t.true(typeof toggleClass === 'function', 'toggleClass is a Function');
t.pass('Tested by @chalarangelo on 16/02/2018');
//t.deepEqual(toggleClass(args..), 'Expected'); //t.deepEqual(toggleClass(args..), 'Expected');
//t.equal(toggleClass(args..), 'Expected'); //t.equal(toggleClass(args..), 'Expected');
//t.false(toggleClass(args..), 'Expected'); //t.false(toggleClass(args..), 'Expected');
//t.throws(toggleClass(args..), 'Expected'); //t.throws(toggleClass(args..), 'Expected');
t.end(); t.end();
}); });