Travis build: 870
This commit is contained in:
29
README.md
29
README.md
@ -314,6 +314,7 @@ _30s.average(1, 2, 3);
|
|||||||
* [`luhnCheck`](#luhncheck-)
|
* [`luhnCheck`](#luhncheck-)
|
||||||
* [`maxBy`](#maxby)
|
* [`maxBy`](#maxby)
|
||||||
* [`median`](#median)
|
* [`median`](#median)
|
||||||
|
* [`midpoint`](#midpoint)
|
||||||
* [`minBy`](#minby)
|
* [`minBy`](#minby)
|
||||||
* [`percentile`](#percentile)
|
* [`percentile`](#percentile)
|
||||||
* [`powerset`](#powerset)
|
* [`powerset`](#powerset)
|
||||||
@ -1254,14 +1255,14 @@ Filters out the falsy values in an array.
|
|||||||
Use `Array.prototype.filter()` to get an array containing only truthy values.
|
Use `Array.prototype.filter()` to get an array containing only truthy values.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const filterFalsy = arr => arr.filter(Boolean);
|
const filterFalsy = arr => arr.filter(Boolean);
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Examples</summary>
|
<summary>Examples</summary>
|
||||||
|
|
||||||
```js
|
```js
|
||||||
filterFalsy(['', true, {}, false, 'sample', 1, 0]); // [true, {}, 'sample', 1]
|
filterFalsy(['', true, {}, false, 'sample', 1, 0]); // [true, {}, 'sample', 1]
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
@ -5839,6 +5840,30 @@ const median = arr => {
|
|||||||
median([5, 6, 50, 1, -5]); // 5
|
median([5, 6, 50, 1, -5]); // 5
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<br>[⬆ Back to top](#contents)
|
||||||
|
|
||||||
|
### midpoint
|
||||||
|
|
||||||
|
Calculates the midpoint between two pairs of (x,y) points.
|
||||||
|
|
||||||
|
Destructure the array to get `x1`, `y1`, `x2` and `y2`, calculate the midpoint for each dimension by dividing the sum of the two endpoints by `2`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const midpoint = ([x1, y1], [x2, y2]) => [(x1 + x2) / 2, (y1 + y2) / 2];
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Examples</summary>
|
||||||
|
|
||||||
|
```js
|
||||||
|
midpoint([2, 2], [4, 4]); // [3, 3]
|
||||||
|
midpoint([4, 4], [6, 6]); // [5, 5]
|
||||||
|
midpoint([1, 3], [2, 4]); // [1.5, 3.5]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<br>[⬆ Back to top](#contents)
|
<br>[⬆ Back to top](#contents)
|
||||||
|
|||||||
@ -341,6 +341,7 @@
|
|||||||
<li><a tags="math,utility,advanced" href="./math#luhncheck">luhnCheck</a></li>
|
<li><a tags="math,utility,advanced" href="./math#luhncheck">luhnCheck</a></li>
|
||||||
<li><a tags="math,array,function,beginner" href="./math#maxby">maxBy</a></li>
|
<li><a tags="math,array,function,beginner" href="./math#maxby">maxBy</a></li>
|
||||||
<li><a tags="math,array,intermediate" href="./math#median">median</a></li>
|
<li><a tags="math,array,intermediate" href="./math#median">median</a></li>
|
||||||
|
<li><a tags="math,array,beginner" href="./math#midpoint">midpoint</a></li>
|
||||||
<li><a tags="math,array,function,beginner" href="./math#minby">minBy</a></li>
|
<li><a tags="math,array,function,beginner" href="./math#minby">minBy</a></li>
|
||||||
<li><a tags="math,intermediate" href="./math#percentile">percentile</a></li>
|
<li><a tags="math,intermediate" href="./math#percentile">percentile</a></li>
|
||||||
<li><a tags="math,beginner" href="./math#powerset">powerset</a></li>
|
<li><a tags="math,beginner" href="./math#powerset">powerset</a></li>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -341,6 +341,7 @@
|
|||||||
<li><a tags="math,utility,advanced" href="./math#luhncheck">luhnCheck</a></li>
|
<li><a tags="math,utility,advanced" href="./math#luhncheck">luhnCheck</a></li>
|
||||||
<li><a tags="math,array,function,beginner" href="./math#maxby">maxBy</a></li>
|
<li><a tags="math,array,function,beginner" href="./math#maxby">maxBy</a></li>
|
||||||
<li><a tags="math,array,intermediate" href="./math#median">median</a></li>
|
<li><a tags="math,array,intermediate" href="./math#median">median</a></li>
|
||||||
|
<li><a tags="math,array,beginner" href="./math#midpoint">midpoint</a></li>
|
||||||
<li><a tags="math,array,function,beginner" href="./math#minby">minBy</a></li>
|
<li><a tags="math,array,function,beginner" href="./math#minby">minBy</a></li>
|
||||||
<li><a tags="math,intermediate" href="./math#percentile">percentile</a></li>
|
<li><a tags="math,intermediate" href="./math#percentile">percentile</a></li>
|
||||||
<li><a tags="math,beginner" href="./math#powerset">powerset</a></li>
|
<li><a tags="math,beginner" href="./math#powerset">powerset</a></li>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -5,9 +5,9 @@ Filters out the falsy values in an array.
|
|||||||
Use `Array.prototype.filter()` to get an array containing only truthy values.
|
Use `Array.prototype.filter()` to get an array containing only truthy values.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const filterFalsy = arr => arr.filter(Boolean);
|
const filterFalsy = arr => arr.filter(Boolean);
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
filterFalsy(['', true, {}, false, 'sample', 1, 0]); // [true, {}, 'sample', 1]
|
filterFalsy(['', true, {}, false, 'sample', 1, 0]); // [true, {}, 'sample', 1]
|
||||||
```
|
```
|
||||||
|
|||||||
@ -329,7 +329,7 @@ const fibonacci = n =>
|
|||||||
(acc, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i),
|
(acc, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i),
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
const filterFalsy = arr => arr.filter(Boolean);
|
const filterFalsy = arr => arr.filter(Boolean);
|
||||||
const filterNonUnique = arr => arr.filter(i => arr.indexOf(i) === arr.lastIndexOf(i));
|
const filterNonUnique = arr => arr.filter(i => arr.indexOf(i) === arr.lastIndexOf(i));
|
||||||
const filterNonUniqueBy = (arr, fn) =>
|
const filterNonUniqueBy = (arr, fn) =>
|
||||||
arr.filter((v, i) => arr.every((x, j) => (i === j) === fn(v, x, i, j)));
|
arr.filter((v, i) => arr.every((x, j) => (i === j) === fn(v, x, i, j)));
|
||||||
@ -714,6 +714,7 @@ const merge = (...objs) =>
|
|||||||
}, {}),
|
}, {}),
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
|
const midpoint = ([x1, y1], [x2, y2]) => [(x1 + x2) / 2, (y1 + y2) / 2];
|
||||||
const minBy = (arr, fn) => Math.min(...arr.map(typeof fn === 'function' ? fn : val => val[fn]));
|
const minBy = (arr, fn) => Math.min(...arr.map(typeof fn === 'function' ? fn : val => val[fn]));
|
||||||
const minDate = (...dates) => new Date(Math.min.apply(null, ...dates));
|
const minDate = (...dates) => new Date(Math.min.apply(null, ...dates));
|
||||||
const minN = (arr, n = 1) => [...arr].sort((a, b) => a - b).slice(0, n);
|
const minN = (arr, n = 1) => [...arr].sort((a, b) => a - b).slice(0, n);
|
||||||
@ -1491,4 +1492,4 @@ const speechSynthesis = message => {
|
|||||||
const squareSum = (...args) => args.reduce((squareSum, number) => squareSum + Math.pow(number, 2), 0);
|
const squareSum = (...args) => args.reduce((squareSum, number) => squareSum + Math.pow(number, 2), 0);
|
||||||
|
|
||||||
|
|
||||||
module.exports = {CSVToArray,CSVToJSON,JSONToFile,JSONtoCSV,RGBToHex,URLJoin,UUIDGeneratorBrowser,UUIDGeneratorNode,all,allEqual,any,approximatelyEqual,arrayToCSV,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,counter,createElement,createEventHub,currentURL,curry,dayOfYear,debounce,decapitalize,deepClone,deepFlatten,deepFreeze,defaults,defer,degreesToRads,delay,detectDeviceType,difference,differenceBy,differenceWith,dig,digitize,distance,drop,dropRight,dropRightWhile,dropWhile,elementContains,elementIsVisibleInViewport,elo,equals,escapeHTML,escapeRegExp,everyNth,extendHex,factorial,fibonacci,filterFalsy,filterNonUnique,filterNonUniqueBy,findKey,findLast,findLastIndex,findLastKey,flatten,flattenObject,flip,forEachRight,forOwn,forOwnRight,formatDuration,fromCamelCase,functionName,functions,gcd,geometricProgression,get,getColonTimeFromDate,getDaysDiffBetweenDates,getImages,getMeridiemSuffixOfInteger,getScrollPosition,getStyle,getType,getURLParameters,groupBy,hammingDistance,hasClass,hasFlags,hashBrowser,hashNode,head,hexToRGB,hide,httpGet,httpPost,httpsRedirect,hz,inRange,indentString,indexOfAll,initial,initialize2DArray,initializeArrayWithRange,initializeArrayWithRangeRight,initializeArrayWithValues,initializeNDArray,insertAfter,insertBefore,intersection,intersectionBy,intersectionWith,invertKeyValues,is,isAbsoluteURL,isAfterDate,isAnagram,isArrayLike,isBeforeDate,isBoolean,isBrowser,isBrowserTabFocused,isDivisible,isDuplexStream,isEmpty,isEven,isFunction,isLowerCase,isNegativeZero,isNil,isNull,isNumber,isObject,isObjectLike,isPlainObject,isPrime,isPrimitive,isPromiseLike,isReadableStream,isSameDate,isSorted,isStream,isString,isSymbol,isTravisCI,isUndefined,isUpperCase,isValidJSON,isWritableStream,join,last,lcm,longestItem,lowercaseKeys,luhnCheck,mapKeys,mapObject,mapString,mapValues,mask,matches,matchesWith,maxBy,maxDate,maxN,median,memoize,merge,minBy,minDate,minN,mostPerformant,negate,nest,nodeListToArray,none,nthArg,nthElement,objectFromPairs,objectToPairs,observeMutations,off,offset,omit,omitBy,on,onUserInputChange,once,orderBy,over,overArgs,pad,palindrome,parseCookie,partial,partialRight,partition,percentile,permutations,pick,pickBy,pipeAsyncFunctions,pipeFunctions,pluralize,powerset,prefix,prettyBytes,primes,promisify,pull,pullAtIndex,pullAtValue,pullBy,radsToDegrees,randomHexColorCode,randomIntArrayInRange,randomIntegerInRange,randomNumberInRange,readFileLines,rearg,recordAnimationFrames,redirect,reduceSuccessive,reduceWhich,reducedFilter,reject,remove,removeNonASCII,renameKeys,reverseString,round,runAsync,runPromisesInSeries,sample,sampleSize,scrollToTop,sdbm,serializeCookie,setStyle,shallowClone,shank,show,shuffle,similarity,size,sleep,smoothScroll,sortCharactersInString,sortedIndex,sortedIndexBy,sortedLastIndex,sortedLastIndexBy,splitLines,spreadOver,stableSort,standardDeviation,stringPermutations,stripHTMLTags,sum,sumBy,sumPower,symmetricDifference,symmetricDifferenceBy,symmetricDifferenceWith,tail,take,takeRight,takeRightWhile,takeWhile,throttle,timeTaken,times,toCamelCase,toCurrency,toDecimalMark,toHash,toKebabCase,toOrdinalSuffix,toSafeInteger,toSnakeCase,toTitleCase,toggleClass,tomorrow,transform,triggerEvent,truncateString,truthCheckCollection,unary,uncurry,unescapeHTML,unflattenObject,unfold,union,unionBy,unionWith,uniqueElements,uniqueElementsBy,uniqueElementsByRight,uniqueSymmetricDifference,untildify,unzip,unzipWith,validateNumber,when,without,words,xProd,yesNo,zip,zipObject,zipWith,JSONToDate,binarySearch,celsiusToFahrenheit,cleanObj,collatz,countVowels,factors,fahrenheitToCelsius,fibonacciCountUntilNum,fibonacciUntilNum,heronArea,howManyTimes,httpDelete,httpPut,isArmstrongNumber,isSimilar,kmphToMph,levenshteinDistance,mphToKmph,pipeLog,quickSort,removeVowels,solveRPN,speechSynthesis,squareSum}
|
module.exports = {CSVToArray,CSVToJSON,JSONToFile,JSONtoCSV,RGBToHex,URLJoin,UUIDGeneratorBrowser,UUIDGeneratorNode,all,allEqual,any,approximatelyEqual,arrayToCSV,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,counter,createElement,createEventHub,currentURL,curry,dayOfYear,debounce,decapitalize,deepClone,deepFlatten,deepFreeze,defaults,defer,degreesToRads,delay,detectDeviceType,difference,differenceBy,differenceWith,dig,digitize,distance,drop,dropRight,dropRightWhile,dropWhile,elementContains,elementIsVisibleInViewport,elo,equals,escapeHTML,escapeRegExp,everyNth,extendHex,factorial,fibonacci,filterFalsy,filterNonUnique,filterNonUniqueBy,findKey,findLast,findLastIndex,findLastKey,flatten,flattenObject,flip,forEachRight,forOwn,forOwnRight,formatDuration,fromCamelCase,functionName,functions,gcd,geometricProgression,get,getColonTimeFromDate,getDaysDiffBetweenDates,getImages,getMeridiemSuffixOfInteger,getScrollPosition,getStyle,getType,getURLParameters,groupBy,hammingDistance,hasClass,hasFlags,hashBrowser,hashNode,head,hexToRGB,hide,httpGet,httpPost,httpsRedirect,hz,inRange,indentString,indexOfAll,initial,initialize2DArray,initializeArrayWithRange,initializeArrayWithRangeRight,initializeArrayWithValues,initializeNDArray,insertAfter,insertBefore,intersection,intersectionBy,intersectionWith,invertKeyValues,is,isAbsoluteURL,isAfterDate,isAnagram,isArrayLike,isBeforeDate,isBoolean,isBrowser,isBrowserTabFocused,isDivisible,isDuplexStream,isEmpty,isEven,isFunction,isLowerCase,isNegativeZero,isNil,isNull,isNumber,isObject,isObjectLike,isPlainObject,isPrime,isPrimitive,isPromiseLike,isReadableStream,isSameDate,isSorted,isStream,isString,isSymbol,isTravisCI,isUndefined,isUpperCase,isValidJSON,isWritableStream,join,last,lcm,longestItem,lowercaseKeys,luhnCheck,mapKeys,mapObject,mapString,mapValues,mask,matches,matchesWith,maxBy,maxDate,maxN,median,memoize,merge,midpoint,minBy,minDate,minN,mostPerformant,negate,nest,nodeListToArray,none,nthArg,nthElement,objectFromPairs,objectToPairs,observeMutations,off,offset,omit,omitBy,on,onUserInputChange,once,orderBy,over,overArgs,pad,palindrome,parseCookie,partial,partialRight,partition,percentile,permutations,pick,pickBy,pipeAsyncFunctions,pipeFunctions,pluralize,powerset,prefix,prettyBytes,primes,promisify,pull,pullAtIndex,pullAtValue,pullBy,radsToDegrees,randomHexColorCode,randomIntArrayInRange,randomIntegerInRange,randomNumberInRange,readFileLines,rearg,recordAnimationFrames,redirect,reduceSuccessive,reduceWhich,reducedFilter,reject,remove,removeNonASCII,renameKeys,reverseString,round,runAsync,runPromisesInSeries,sample,sampleSize,scrollToTop,sdbm,serializeCookie,setStyle,shallowClone,shank,show,shuffle,similarity,size,sleep,smoothScroll,sortCharactersInString,sortedIndex,sortedIndexBy,sortedLastIndex,sortedLastIndexBy,splitLines,spreadOver,stableSort,standardDeviation,stringPermutations,stripHTMLTags,sum,sumBy,sumPower,symmetricDifference,symmetricDifferenceBy,symmetricDifferenceWith,tail,take,takeRight,takeRightWhile,takeWhile,throttle,timeTaken,times,toCamelCase,toCurrency,toDecimalMark,toHash,toKebabCase,toOrdinalSuffix,toSafeInteger,toSnakeCase,toTitleCase,toggleClass,tomorrow,transform,triggerEvent,truncateString,truthCheckCollection,unary,uncurry,unescapeHTML,unflattenObject,unfold,union,unionBy,unionWith,uniqueElements,uniqueElementsBy,uniqueElementsByRight,uniqueSymmetricDifference,untildify,unzip,unzipWith,validateNumber,when,without,words,xProd,yesNo,zip,zipObject,zipWith,JSONToDate,binarySearch,celsiusToFahrenheit,cleanObj,collatz,countVowels,factors,fahrenheitToCelsius,fibonacciCountUntilNum,fibonacciUntilNum,heronArea,howManyTimes,httpDelete,httpPut,isArmstrongNumber,isSimilar,kmphToMph,levenshteinDistance,mphToKmph,pipeLog,quickSort,removeVowels,solveRPN,speechSynthesis,squareSum}
|
||||||
Reference in New Issue
Block a user