Travis build: 1678 [cron]

This commit is contained in:
30secondsofcode
2020-01-03 17:44:11 +00:00
parent a88380728b
commit 6bfdcd360f
4 changed files with 70 additions and 28 deletions

16
dist/_30s.es5.js vendored
View File

@ -870,6 +870,12 @@
return fn(obj[key], key, obj); return fn(obj[key], key, obj);
}); });
}; };
var frequencies = function frequencies(arr) {
return arr.reduce(function (a, v) {
a[v] = a[v] ? a[v] + 1 : 1;
return a;
}, {});
};
var fromCamelCase = function fromCamelCase(str) { var fromCamelCase = function fromCamelCase(str) {
var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '_'; var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '_';
return str.replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2').replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + separator + '$2').toLowerCase(); return str.replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2').replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + separator + '$2').toLowerCase();
@ -1516,6 +1522,14 @@
return a - b; return a - b;
}).slice(0, n); }).slice(0, n);
}; };
var mostFrequent = function mostFrequent(arr) {
return Object.entries(arr.reduce(function (a, v) {
a[v] = a[v] ? a[v] + 1 : 1;
return a;
}, {})).reduce(function (a, v) {
return v[1] >= a[1] ? v : a;
}, [null, 0])[0];
};
var mostPerformant = function mostPerformant(fns) { var mostPerformant = function mostPerformant(fns) {
var iterations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10000; var iterations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10000;
var times = fns.map(function (fn) { var times = fns.map(function (fn) {
@ -3032,6 +3046,7 @@
exports.formToObject = formToObject; exports.formToObject = formToObject;
exports.forOwn = forOwn; exports.forOwn = forOwn;
exports.forOwnRight = forOwnRight; exports.forOwnRight = forOwnRight;
exports.frequencies = frequencies;
exports.fromCamelCase = fromCamelCase; exports.fromCamelCase = fromCamelCase;
exports.functionName = functionName; exports.functionName = functionName;
exports.functions = functions; exports.functions = functions;
@ -3143,6 +3158,7 @@
exports.minBy = minBy; exports.minBy = minBy;
exports.minDate = minDate; exports.minDate = minDate;
exports.minN = minN; exports.minN = minN;
exports.mostFrequent = mostFrequent;
exports.mostPerformant = mostPerformant; exports.mostPerformant = mostPerformant;
exports.negate = negate; exports.negate = negate;
exports.nest = nest; exports.nest = nest;

File diff suppressed because one or more lines are too long

40
dist/_30s.esm.js vendored
View File

@ -380,6 +380,11 @@ const forOwnRight = (obj, fn) =>
Object.keys(obj) Object.keys(obj)
.reverse() .reverse()
.forEach(key => fn(obj[key], key, obj)); .forEach(key => fn(obj[key], key, obj));
const frequencies = arr =>
arr.reduce((a, v) => {
a[v] = a[v] ? a[v] + 1 : 1;
return a;
}, {});
const fromCamelCase = (str, separator = '_') => const fromCamelCase = (str, separator = '_') =>
str str
.replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2') .replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2')
@ -655,8 +660,8 @@ const join = (arr, separator = ',', end = separator) =>
i === arr.length - 2 i === arr.length - 2
? acc + val + end ? acc + val + end
: i === arr.length - 1 : i === arr.length - 1
? acc + val ? acc + val
: acc + val + separator, : acc + val + separator,
'' ''
); );
const JSONtoCSV = (arr, columns, delimiter = ',') => const JSONtoCSV = (arr, columns, delimiter = ',') =>
@ -752,6 +757,13 @@ 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(...dates)); const minDate = dates => new Date(Math.min(...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);
const mostFrequent = arr =>
Object.entries(
arr.reduce((a, v) => {
a[v] = a[v] ? a[v] + 1 : 1;
return a;
}, {})
).reduce((a, v) => (v[1] >= a[1] ? v : a), [null, 0])[0];
const mostPerformant = (fns, iterations = 10000) => { const mostPerformant = (fns, iterations = 10000) => {
const times = fns.map(fn => { const times = fns.map(fn => {
const before = performance.now(); const before = performance.now();
@ -774,10 +786,10 @@ const objectToPairs = obj => Object.keys(obj).map(k => [k, obj[k]]);
const objectToQueryString = queryParameters => { const objectToQueryString = queryParameters => {
return queryParameters return queryParameters
? Object.entries(queryParameters).reduce((queryString, [key, val], index) => { ? Object.entries(queryParameters).reduce((queryString, [key, val], index) => {
const symbol = queryString.length === 0 ? '?' : '&'; const symbol = queryString.length === 0 ? '?' : '&';
queryString += typeof val === 'string' ? `${symbol}${key}=${val}` : ''; queryString += typeof val === 'string' ? `${symbol}${key}=${val}` : '';
return queryString; return queryString;
}, '') }, '')
: ''; : '';
}; };
const observeMutations = (element, callback, options) => { const observeMutations = (element, callback, options) => {
@ -1008,9 +1020,9 @@ const reject = (pred, array) => array.filter((...args) => !pred(...args));
const remove = (arr, func) => const remove = (arr, func) =>
Array.isArray(arr) Array.isArray(arr)
? arr.filter(func).reduce((acc, val) => { ? arr.filter(func).reduce((acc, val) => {
arr.splice(arr.indexOf(val), 1); arr.splice(arr.indexOf(val), 1);
return acc.concat(val); return acc.concat(val);
}, []) }, [])
: []; : [];
const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, ''); const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, '');
const renameKeys = (keysMap, obj) => const renameKeys = (keysMap, obj) =>
@ -1088,10 +1100,10 @@ const size = val =>
Array.isArray(val) Array.isArray(val)
? val.length ? val.length
: val && typeof val === 'object' : val && typeof val === 'object'
? val.size || val.length || Object.keys(val).length ? val.size || val.length || Object.keys(val).length
: typeof val === 'string' : typeof val === 'string'
? new Blob([val]).size ? new Blob([val]).size
: 0; : 0;
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const smoothScroll = element => const smoothScroll = element =>
document.querySelector(element).scrollIntoView({ document.querySelector(element).scrollIntoView({
@ -1569,4 +1581,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);
export { 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, checkProp, chunk, clampNumber, cloneRegExp, coalesce, coalesceFactory, collectInto, colorize, compact, compactWhitespace, compose, composeRight, converge, copyToClipboard, countBy, counter, countOccurrences, createDirIfNotExists, createElement, createEventHub, CSVToArray, CSVToJSON, currentURL, curry, dayOfYear, debounce, decapitalize, deepClone, deepFlatten, deepFreeze, deepGet, deepMapKeys, 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, formatDuration, formToObject, forOwn, forOwnRight, fromCamelCase, functionName, functions, gcd, geometricProgression, get, getColonTimeFromDate, getDaysDiffBetweenDates, getImages, getMeridiemSuffixOfInteger, getScrollPosition, getStyle, getType, getURLParameters, groupBy, hammingDistance, hasClass, hasFlags, hashBrowser, hashNode, hasKey, head, hexToRGB, hide, httpGet, httpPost, httpsRedirect, hz, includesAll, includesAny, indentString, indexOfAll, initial, initialize2DArray, initializeArrayWithRange, initializeArrayWithRangeRight, initializeArrayWithValues, initializeNDArray, inRange, 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, isOdd, isPlainObject, isPowerOfTwo, isPrime, isPrimitive, isPromiseLike, isReadableStream, isSameDate, isSorted, isStream, isString, isSymbol, isTravisCI, isUndefined, isUpperCase, isValidJSON, isWeekday, isWeekend, isWritableStream, join, JSONtoCSV, JSONToFile, last, lcm, longestItem, lowercaseKeys, luhnCheck, mapKeys, mapNumRange, 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, objectToQueryString, observeMutations, off, offset, omit, omitBy, on, once, onUserInputChange, 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, reducedFilter, reduceSuccessive, reduceWhich, reject, remove, removeNonASCII, renameKeys, reverseString, RGBToHex, round, runAsync, runPromisesInSeries, sample, sampleSize, scrollToTop, sdbm, serializeCookie, serializeForm, 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, times, timeTaken, toCamelCase, toCurrency, toDecimalMark, toggleClass, toHash, toKebabCase, tomorrow, toOrdinalSuffix, toSafeInteger, toSnakeCase, toTitleCase, transform, triggerEvent, truncateString, truthCheckCollection, unary, uncurry, unescapeHTML, unflattenObject, unfold, union, unionBy, unionWith, uniqueElements, uniqueElementsBy, uniqueElementsByRight, uniqueSymmetricDifference, untildify, unzip, unzipWith, URLJoin, UUIDGeneratorBrowser, UUIDGeneratorNode, validateNumber, vectorDistance, weightedSample, when, without, words, xProd, yesNo, yesterday, zip, zipObject, zipWith, binarySearch, celsiusToFahrenheit, cleanObj, collatz, countVowels, factors, fahrenheitToCelsius, fibonacciCountUntilNum, fibonacciUntilNum, heronArea, howManyTimes, httpDelete, httpPut, isArmstrongNumber, isSimilar, JSONToDate, kmphToMph, levenshteinDistance, mphToKmph, pipeLog, quickSort, removeVowels, solveRPN, speechSynthesis, squareSum }; export { 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, checkProp, chunk, clampNumber, cloneRegExp, coalesce, coalesceFactory, collectInto, colorize, compact, compactWhitespace, compose, composeRight, converge, copyToClipboard, countBy, counter, countOccurrences, createDirIfNotExists, createElement, createEventHub, CSVToArray, CSVToJSON, currentURL, curry, dayOfYear, debounce, decapitalize, deepClone, deepFlatten, deepFreeze, deepGet, deepMapKeys, 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, formatDuration, formToObject, forOwn, forOwnRight, frequencies, fromCamelCase, functionName, functions, gcd, geometricProgression, get, getColonTimeFromDate, getDaysDiffBetweenDates, getImages, getMeridiemSuffixOfInteger, getScrollPosition, getStyle, getType, getURLParameters, groupBy, hammingDistance, hasClass, hasFlags, hashBrowser, hashNode, hasKey, head, hexToRGB, hide, httpGet, httpPost, httpsRedirect, hz, includesAll, includesAny, indentString, indexOfAll, initial, initialize2DArray, initializeArrayWithRange, initializeArrayWithRangeRight, initializeArrayWithValues, initializeNDArray, inRange, 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, isOdd, isPlainObject, isPowerOfTwo, isPrime, isPrimitive, isPromiseLike, isReadableStream, isSameDate, isSorted, isStream, isString, isSymbol, isTravisCI, isUndefined, isUpperCase, isValidJSON, isWeekday, isWeekend, isWritableStream, join, JSONtoCSV, JSONToFile, last, lcm, longestItem, lowercaseKeys, luhnCheck, mapKeys, mapNumRange, mapObject, mapString, mapValues, mask, matches, matchesWith, maxBy, maxDate, maxN, median, memoize, merge, midpoint, minBy, minDate, minN, mostFrequent, mostPerformant, negate, nest, nodeListToArray, none, nthArg, nthElement, objectFromPairs, objectToPairs, objectToQueryString, observeMutations, off, offset, omit, omitBy, on, once, onUserInputChange, 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, reducedFilter, reduceSuccessive, reduceWhich, reject, remove, removeNonASCII, renameKeys, reverseString, RGBToHex, round, runAsync, runPromisesInSeries, sample, sampleSize, scrollToTop, sdbm, serializeCookie, serializeForm, 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, times, timeTaken, toCamelCase, toCurrency, toDecimalMark, toggleClass, toHash, toKebabCase, tomorrow, toOrdinalSuffix, toSafeInteger, toSnakeCase, toTitleCase, transform, triggerEvent, truncateString, truthCheckCollection, unary, uncurry, unescapeHTML, unflattenObject, unfold, union, unionBy, unionWith, uniqueElements, uniqueElementsBy, uniqueElementsByRight, uniqueSymmetricDifference, untildify, unzip, unzipWith, URLJoin, UUIDGeneratorBrowser, UUIDGeneratorNode, validateNumber, vectorDistance, weightedSample, when, without, words, xProd, yesNo, yesterday, zip, zipObject, zipWith, binarySearch, celsiusToFahrenheit, cleanObj, collatz, countVowels, factors, fahrenheitToCelsius, fibonacciCountUntilNum, fibonacciUntilNum, heronArea, howManyTimes, httpDelete, httpPut, isArmstrongNumber, isSimilar, JSONToDate, kmphToMph, levenshteinDistance, mphToKmph, pipeLog, quickSort, removeVowels, solveRPN, speechSynthesis, squareSum };

40
dist/_30s.js vendored
View File

@ -386,6 +386,11 @@
Object.keys(obj) Object.keys(obj)
.reverse() .reverse()
.forEach(key => fn(obj[key], key, obj)); .forEach(key => fn(obj[key], key, obj));
const frequencies = arr =>
arr.reduce((a, v) => {
a[v] = a[v] ? a[v] + 1 : 1;
return a;
}, {});
const fromCamelCase = (str, separator = '_') => const fromCamelCase = (str, separator = '_') =>
str str
.replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2') .replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2')
@ -661,8 +666,8 @@
i === arr.length - 2 i === arr.length - 2
? acc + val + end ? acc + val + end
: i === arr.length - 1 : i === arr.length - 1
? acc + val ? acc + val
: acc + val + separator, : acc + val + separator,
'' ''
); );
const JSONtoCSV = (arr, columns, delimiter = ',') => const JSONtoCSV = (arr, columns, delimiter = ',') =>
@ -758,6 +763,13 @@
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(...dates)); const minDate = dates => new Date(Math.min(...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);
const mostFrequent = arr =>
Object.entries(
arr.reduce((a, v) => {
a[v] = a[v] ? a[v] + 1 : 1;
return a;
}, {})
).reduce((a, v) => (v[1] >= a[1] ? v : a), [null, 0])[0];
const mostPerformant = (fns, iterations = 10000) => { const mostPerformant = (fns, iterations = 10000) => {
const times = fns.map(fn => { const times = fns.map(fn => {
const before = performance.now(); const before = performance.now();
@ -780,10 +792,10 @@
const objectToQueryString = queryParameters => { const objectToQueryString = queryParameters => {
return queryParameters return queryParameters
? Object.entries(queryParameters).reduce((queryString, [key, val], index) => { ? Object.entries(queryParameters).reduce((queryString, [key, val], index) => {
const symbol = queryString.length === 0 ? '?' : '&'; const symbol = queryString.length === 0 ? '?' : '&';
queryString += typeof val === 'string' ? `${symbol}${key}=${val}` : ''; queryString += typeof val === 'string' ? `${symbol}${key}=${val}` : '';
return queryString; return queryString;
}, '') }, '')
: ''; : '';
}; };
const observeMutations = (element, callback, options) => { const observeMutations = (element, callback, options) => {
@ -1014,9 +1026,9 @@
const remove = (arr, func) => const remove = (arr, func) =>
Array.isArray(arr) Array.isArray(arr)
? arr.filter(func).reduce((acc, val) => { ? arr.filter(func).reduce((acc, val) => {
arr.splice(arr.indexOf(val), 1); arr.splice(arr.indexOf(val), 1);
return acc.concat(val); return acc.concat(val);
}, []) }, [])
: []; : [];
const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, ''); const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, '');
const renameKeys = (keysMap, obj) => const renameKeys = (keysMap, obj) =>
@ -1094,10 +1106,10 @@
Array.isArray(val) Array.isArray(val)
? val.length ? val.length
: val && typeof val === 'object' : val && typeof val === 'object'
? val.size || val.length || Object.keys(val).length ? val.size || val.length || Object.keys(val).length
: typeof val === 'string' : typeof val === 'string'
? new Blob([val]).size ? new Blob([val]).size
: 0; : 0;
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const smoothScroll = element => const smoothScroll = element =>
document.querySelector(element).scrollIntoView({ document.querySelector(element).scrollIntoView({
@ -1672,6 +1684,7 @@
exports.formToObject = formToObject; exports.formToObject = formToObject;
exports.forOwn = forOwn; exports.forOwn = forOwn;
exports.forOwnRight = forOwnRight; exports.forOwnRight = forOwnRight;
exports.frequencies = frequencies;
exports.fromCamelCase = fromCamelCase; exports.fromCamelCase = fromCamelCase;
exports.functionName = functionName; exports.functionName = functionName;
exports.functions = functions; exports.functions = functions;
@ -1783,6 +1796,7 @@
exports.minBy = minBy; exports.minBy = minBy;
exports.minDate = minDate; exports.minDate = minDate;
exports.minN = minN; exports.minN = minN;
exports.mostFrequent = mostFrequent;
exports.mostPerformant = mostPerformant; exports.mostPerformant = mostPerformant;
exports.negate = negate; exports.negate = negate;
exports.nest = nest; exports.nest = nest;