Travis build: 1102 [cron]
This commit is contained in:
92
dist/_30s.es5.js
vendored
92
dist/_30s.es5.js
vendored
@ -851,6 +851,15 @@
|
|||||||
return fn(obj[key], key, obj);
|
return fn(obj[key], key, obj);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
var formToObject = function formToObject(form) {
|
||||||
|
return Array.from(new FormData(form)).reduce(function (acc, _ref10) {
|
||||||
|
var _ref11 = _slicedToArray(_ref10, 2),
|
||||||
|
key = _ref11[0],
|
||||||
|
value = _ref11[1];
|
||||||
|
|
||||||
|
return _objectSpread({}, acc, _defineProperty({}, key, value));
|
||||||
|
}, {});
|
||||||
|
};
|
||||||
var formatDuration = function formatDuration(ms) {
|
var formatDuration = function formatDuration(ms) {
|
||||||
if (ms < 0) ms = -ms;
|
if (ms < 0) ms = -ms;
|
||||||
var time = {
|
var time = {
|
||||||
@ -862,10 +871,10 @@
|
|||||||
};
|
};
|
||||||
return Object.entries(time).filter(function (val) {
|
return Object.entries(time).filter(function (val) {
|
||||||
return val[1] !== 0;
|
return val[1] !== 0;
|
||||||
}).map(function (_ref10) {
|
}).map(function (_ref12) {
|
||||||
var _ref11 = _slicedToArray(_ref10, 2),
|
var _ref13 = _slicedToArray(_ref12, 2),
|
||||||
key = _ref11[0],
|
key = _ref13[0],
|
||||||
val = _ref11[1];
|
val = _ref13[1];
|
||||||
|
|
||||||
return "".concat(val, " ").concat(key).concat(val !== 1 ? 's' : '');
|
return "".concat(val, " ").concat(key).concat(val !== 1 ? 's' : '');
|
||||||
}).join(', ');
|
}).join(', ');
|
||||||
@ -1065,9 +1074,9 @@
|
|||||||
var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
||||||
|
|
||||||
if (end && start > end) {
|
if (end && start > end) {
|
||||||
var _ref12 = [start, end];
|
var _ref14 = [start, end];
|
||||||
end = _ref12[0];
|
end = _ref14[0];
|
||||||
start = _ref12[1];
|
start = _ref14[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return end == null ? n >= 0 && n < start : n >= start && n < end;
|
return end == null ? n >= 0 && n < start : n >= start && n < end;
|
||||||
@ -1455,14 +1464,14 @@
|
|||||||
}, {});
|
}, {});
|
||||||
}, {});
|
}, {});
|
||||||
};
|
};
|
||||||
var midpoint = function midpoint(_ref13, _ref14) {
|
var midpoint = function midpoint(_ref15, _ref16) {
|
||||||
var _ref15 = _slicedToArray(_ref13, 2),
|
var _ref17 = _slicedToArray(_ref15, 2),
|
||||||
x1 = _ref15[0],
|
x1 = _ref17[0],
|
||||||
y1 = _ref15[1];
|
y1 = _ref17[1];
|
||||||
|
|
||||||
var _ref16 = _slicedToArray(_ref14, 2),
|
var _ref18 = _slicedToArray(_ref16, 2),
|
||||||
x2 = _ref16[0],
|
x2 = _ref18[0],
|
||||||
y2 = _ref16[1];
|
y2 = _ref18[1];
|
||||||
|
|
||||||
return [(x1 + x2) / 2, (y1 + y2) / 2];
|
return [(x1 + x2) / 2, (y1 + y2) / 2];
|
||||||
};
|
};
|
||||||
@ -1536,10 +1545,10 @@
|
|||||||
return (n === -1 ? arr.slice(n) : arr.slice(n, n + 1))[0];
|
return (n === -1 ? arr.slice(n) : arr.slice(n, n + 1))[0];
|
||||||
};
|
};
|
||||||
var objectFromPairs = function objectFromPairs(arr) {
|
var objectFromPairs = function objectFromPairs(arr) {
|
||||||
return arr.reduce(function (a, _ref17) {
|
return arr.reduce(function (a, _ref19) {
|
||||||
var _ref18 = _slicedToArray(_ref17, 2),
|
var _ref20 = _slicedToArray(_ref19, 2),
|
||||||
key = _ref18[0],
|
key = _ref20[0],
|
||||||
val = _ref18[1];
|
val = _ref20[1];
|
||||||
|
|
||||||
return a[key] = val, a;
|
return a[key] = val, a;
|
||||||
}, {});
|
}, {});
|
||||||
@ -1628,10 +1637,10 @@
|
|||||||
return _toConsumableArray(arr).sort(function (a, b) {
|
return _toConsumableArray(arr).sort(function (a, b) {
|
||||||
return props.reduce(function (acc, prop, i) {
|
return props.reduce(function (acc, prop, i) {
|
||||||
if (acc === 0) {
|
if (acc === 0) {
|
||||||
var _ref19 = orders && orders[i] === 'desc' ? [b[prop], a[prop]] : [a[prop], b[prop]],
|
var _ref21 = orders && orders[i] === 'desc' ? [b[prop], a[prop]] : [a[prop], b[prop]],
|
||||||
_ref20 = _slicedToArray(_ref19, 2),
|
_ref22 = _slicedToArray(_ref21, 2),
|
||||||
p1 = _ref20[0],
|
p1 = _ref22[0],
|
||||||
p2 = _ref20[1];
|
p2 = _ref22[1];
|
||||||
|
|
||||||
acc = p1 > p2 ? 1 : p1 < p2 ? -1 : 0;
|
acc = p1 > p2 ? 1 : p1 < p2 ? -1 : 0;
|
||||||
}
|
}
|
||||||
@ -2009,8 +2018,8 @@
|
|||||||
type: 'application/javascript; charset=utf-8'
|
type: 'application/javascript; charset=utf-8'
|
||||||
}));
|
}));
|
||||||
return new Promise(function (res, rej) {
|
return new Promise(function (res, rej) {
|
||||||
worker.onmessage = function (_ref21) {
|
worker.onmessage = function (_ref23) {
|
||||||
var data = _ref21.data;
|
var data = _ref23.data;
|
||||||
res(data), worker.terminate();
|
res(data), worker.terminate();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2027,18 +2036,18 @@
|
|||||||
var sample = function sample(arr) {
|
var sample = function sample(arr) {
|
||||||
return arr[Math.floor(Math.random() * arr.length)];
|
return arr[Math.floor(Math.random() * arr.length)];
|
||||||
};
|
};
|
||||||
var sampleSize = function sampleSize(_ref22) {
|
var sampleSize = function sampleSize(_ref24) {
|
||||||
var _ref23 = _toArray(_ref22),
|
var _ref25 = _toArray(_ref24),
|
||||||
arr = _ref23.slice(0);
|
arr = _ref25.slice(0);
|
||||||
|
|
||||||
var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
||||||
var m = arr.length;
|
var m = arr.length;
|
||||||
|
|
||||||
while (m) {
|
while (m) {
|
||||||
var i = Math.floor(Math.random() * m--);
|
var i = Math.floor(Math.random() * m--);
|
||||||
var _ref24 = [arr[i], arr[m]];
|
var _ref26 = [arr[i], arr[m]];
|
||||||
arr[m] = _ref24[0];
|
arr[m] = _ref26[0];
|
||||||
arr[i] = _ref24[1];
|
arr[i] = _ref26[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return arr.slice(0, n);
|
return arr.slice(0, n);
|
||||||
@ -2060,6 +2069,11 @@
|
|||||||
var serializeCookie = function serializeCookie(name, val) {
|
var serializeCookie = function serializeCookie(name, val) {
|
||||||
return "".concat(encodeURIComponent(name), "=").concat(encodeURIComponent(val));
|
return "".concat(encodeURIComponent(name), "=").concat(encodeURIComponent(val));
|
||||||
};
|
};
|
||||||
|
var serializeForm = function serializeForm(form) {
|
||||||
|
return Array.from(new FormData(form), function (field) {
|
||||||
|
return field.map(encodeURIComponent).join('=');
|
||||||
|
}).join('&');
|
||||||
|
};
|
||||||
var setStyle = function setStyle(el, ruleName, val) {
|
var setStyle = function setStyle(el, ruleName, val) {
|
||||||
return el.style[ruleName] = val;
|
return el.style[ruleName] = val;
|
||||||
};
|
};
|
||||||
@ -2085,17 +2099,17 @@
|
|||||||
return e.style.display = '';
|
return e.style.display = '';
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var shuffle = function shuffle(_ref25) {
|
var shuffle = function shuffle(_ref27) {
|
||||||
var _ref26 = _toArray(_ref25),
|
var _ref28 = _toArray(_ref27),
|
||||||
arr = _ref26.slice(0);
|
arr = _ref28.slice(0);
|
||||||
|
|
||||||
var m = arr.length;
|
var m = arr.length;
|
||||||
|
|
||||||
while (m) {
|
while (m) {
|
||||||
var i = Math.floor(Math.random() * m--);
|
var i = Math.floor(Math.random() * m--);
|
||||||
var _ref27 = [arr[i], arr[m]];
|
var _ref29 = [arr[i], arr[m]];
|
||||||
arr[m] = _ref27[0];
|
arr[m] = _ref29[0];
|
||||||
arr[i] = _ref27[1];
|
arr[i] = _ref29[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return arr;
|
return arr;
|
||||||
@ -2169,8 +2183,8 @@
|
|||||||
};
|
};
|
||||||
}).sort(function (a, b) {
|
}).sort(function (a, b) {
|
||||||
return compare(a.item, b.item) || a.index - b.index;
|
return compare(a.item, b.item) || a.index - b.index;
|
||||||
}).map(function (_ref28) {
|
}).map(function (_ref30) {
|
||||||
var item = _ref28.item;
|
var item = _ref30.item;
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -2721,6 +2735,7 @@
|
|||||||
exports.forEachRight = forEachRight;
|
exports.forEachRight = forEachRight;
|
||||||
exports.forOwn = forOwn;
|
exports.forOwn = forOwn;
|
||||||
exports.forOwnRight = forOwnRight;
|
exports.forOwnRight = forOwnRight;
|
||||||
|
exports.formToObject = formToObject;
|
||||||
exports.formatDuration = formatDuration;
|
exports.formatDuration = formatDuration;
|
||||||
exports.fromCamelCase = fromCamelCase;
|
exports.fromCamelCase = fromCamelCase;
|
||||||
exports.functionName = functionName;
|
exports.functionName = functionName;
|
||||||
@ -2891,6 +2906,7 @@
|
|||||||
exports.scrollToTop = scrollToTop;
|
exports.scrollToTop = scrollToTop;
|
||||||
exports.sdbm = sdbm;
|
exports.sdbm = sdbm;
|
||||||
exports.serializeCookie = serializeCookie;
|
exports.serializeCookie = serializeCookie;
|
||||||
|
exports.serializeForm = serializeForm;
|
||||||
exports.setStyle = setStyle;
|
exports.setStyle = setStyle;
|
||||||
exports.shallowClone = shallowClone;
|
exports.shallowClone = shallowClone;
|
||||||
exports.shank = shank;
|
exports.shank = shank;
|
||||||
|
|||||||
2
dist/_30s.es5.min.js
vendored
2
dist/_30s.es5.min.js
vendored
File diff suppressed because one or more lines are too long
18
dist/_30s.esm.js
vendored
18
dist/_30s.esm.js
vendored
@ -386,6 +386,14 @@ 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 formToObject = form =>
|
||||||
|
Array.from(new FormData(form)).reduce(
|
||||||
|
(acc, [key, value]) => ({
|
||||||
|
...acc,
|
||||||
|
[key]: value
|
||||||
|
}),
|
||||||
|
{}
|
||||||
|
);
|
||||||
const formatDuration = ms => {
|
const formatDuration = ms => {
|
||||||
if (ms < 0) ms = -ms;
|
if (ms < 0) ms = -ms;
|
||||||
const time = {
|
const time = {
|
||||||
@ -988,9 +996,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) =>
|
||||||
@ -1044,6 +1052,8 @@ const sdbm = str => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
const serializeCookie = (name, val) => `${encodeURIComponent(name)}=${encodeURIComponent(val)}`;
|
const serializeCookie = (name, val) => `${encodeURIComponent(name)}=${encodeURIComponent(val)}`;
|
||||||
|
const serializeForm = form =>
|
||||||
|
Array.from(new FormData(form), field => field.map(encodeURIComponent).join('=')).join('&');
|
||||||
const setStyle = (el, ruleName, val) => (el.style[ruleName] = val);
|
const setStyle = (el, ruleName, val) => (el.style[ruleName] = val);
|
||||||
const shallowClone = obj => Object.assign({}, obj);
|
const shallowClone = obj => Object.assign({}, obj);
|
||||||
const shank = (arr, index = 0, delCount = 0, ...elements) =>
|
const shank = (arr, index = 0, delCount = 0, ...elements) =>
|
||||||
@ -1353,4 +1363,4 @@ const zipWith = (...array) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export { 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, checkProp, chunk, clampNumber, cloneRegExp, coalesce, coalesceFactory, collectInto, colorize, compact, compactWhitespace, compose, composeRight, converge, copyToClipboard, countBy, countOccurrences, counter, createDirIfNotExists, createElement, createEventHub, currentURL, curry, dayOfYear, debounce, decapitalize, deepClone, deepFlatten, deepFreeze, 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, 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, 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, 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, vectorDistance, when, without, words, xProd, yesNo, zip, zipObject, zipWith };
|
export { 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, checkProp, chunk, clampNumber, cloneRegExp, coalesce, coalesceFactory, collectInto, colorize, compact, compactWhitespace, compose, composeRight, converge, copyToClipboard, countBy, countOccurrences, counter, createDirIfNotExists, createElement, createEventHub, currentURL, curry, dayOfYear, debounce, decapitalize, deepClone, deepFlatten, deepFreeze, 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, forOwn, forOwnRight, formToObject, 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, 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, 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, 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, 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, vectorDistance, when, without, words, xProd, yesNo, zip, zipObject, zipWith };
|
||||||
|
|||||||
18
dist/_30s.js
vendored
18
dist/_30s.js
vendored
@ -392,6 +392,14 @@
|
|||||||
Object.keys(obj)
|
Object.keys(obj)
|
||||||
.reverse()
|
.reverse()
|
||||||
.forEach(key => fn(obj[key], key, obj));
|
.forEach(key => fn(obj[key], key, obj));
|
||||||
|
const formToObject = form =>
|
||||||
|
Array.from(new FormData(form)).reduce(
|
||||||
|
(acc, [key, value]) => ({
|
||||||
|
...acc,
|
||||||
|
[key]: value
|
||||||
|
}),
|
||||||
|
{}
|
||||||
|
);
|
||||||
const formatDuration = ms => {
|
const formatDuration = ms => {
|
||||||
if (ms < 0) ms = -ms;
|
if (ms < 0) ms = -ms;
|
||||||
const time = {
|
const time = {
|
||||||
@ -994,9 +1002,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) =>
|
||||||
@ -1050,6 +1058,8 @@
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
const serializeCookie = (name, val) => `${encodeURIComponent(name)}=${encodeURIComponent(val)}`;
|
const serializeCookie = (name, val) => `${encodeURIComponent(name)}=${encodeURIComponent(val)}`;
|
||||||
|
const serializeForm = form =>
|
||||||
|
Array.from(new FormData(form), field => field.map(encodeURIComponent).join('=')).join('&');
|
||||||
const setStyle = (el, ruleName, val) => (el.style[ruleName] = val);
|
const setStyle = (el, ruleName, val) => (el.style[ruleName] = val);
|
||||||
const shallowClone = obj => Object.assign({}, obj);
|
const shallowClone = obj => Object.assign({}, obj);
|
||||||
const shank = (arr, index = 0, delCount = 0, ...elements) =>
|
const shank = (arr, index = 0, delCount = 0, ...elements) =>
|
||||||
@ -1459,6 +1469,7 @@
|
|||||||
exports.forEachRight = forEachRight;
|
exports.forEachRight = forEachRight;
|
||||||
exports.forOwn = forOwn;
|
exports.forOwn = forOwn;
|
||||||
exports.forOwnRight = forOwnRight;
|
exports.forOwnRight = forOwnRight;
|
||||||
|
exports.formToObject = formToObject;
|
||||||
exports.formatDuration = formatDuration;
|
exports.formatDuration = formatDuration;
|
||||||
exports.fromCamelCase = fromCamelCase;
|
exports.fromCamelCase = fromCamelCase;
|
||||||
exports.functionName = functionName;
|
exports.functionName = functionName;
|
||||||
@ -1629,6 +1640,7 @@
|
|||||||
exports.scrollToTop = scrollToTop;
|
exports.scrollToTop = scrollToTop;
|
||||||
exports.sdbm = sdbm;
|
exports.sdbm = sdbm;
|
||||||
exports.serializeCookie = serializeCookie;
|
exports.serializeCookie = serializeCookie;
|
||||||
|
exports.serializeForm = serializeForm;
|
||||||
exports.setStyle = setStyle;
|
exports.setStyle = setStyle;
|
||||||
exports.shallowClone = shallowClone;
|
exports.shallowClone = shallowClone;
|
||||||
exports.shank = shank;
|
exports.shank = shank;
|
||||||
|
|||||||
@ -386,7 +386,7 @@
|
|||||||
"archived": false
|
"archived": false
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "01f1ea63f0660c6cd189722d2bf4ee10a651649d14338ca6dca7037106faaf61"
|
"hash": "a54a645ae51358e2a652adcd19b465e5da0c39d1ebf7a3a393b92cb2c8762883"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1374,6 +1374,21 @@
|
|||||||
"hash": "72c557bd9def493e3a138705f5cb66f993228bd7e51b11fa84f85841bc035524"
|
"hash": "72c557bd9def493e3a138705f5cb66f993228bd7e51b11fa84f85841bc035524"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "formToObject",
|
||||||
|
"type": "snippetListing",
|
||||||
|
"attributes": {
|
||||||
|
"tags": [
|
||||||
|
"browser",
|
||||||
|
"object",
|
||||||
|
"intermediate"
|
||||||
|
],
|
||||||
|
"archived": false
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"hash": "2bb4becd71bb5d71e6581e9d944fb44cca6c2c6441fe169fbc1b83e8ed48b4a6"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "forOwn",
|
"id": "forOwn",
|
||||||
"type": "snippetListing",
|
"type": "snippetListing",
|
||||||
@ -3407,7 +3422,7 @@
|
|||||||
"archived": false
|
"archived": false
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "dcdf66e8d0eb4a1761c6b767b8cc350757087ae817ec371436faab0fff7c0051"
|
"hash": "4815876fd6dbb17ad34c0d8918e7a72d837104f9beee7dc51b0fa73057b9e83e"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -3779,7 +3794,7 @@
|
|||||||
"archived": false
|
"archived": false
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "2fd54c9fc1fb5b0a981df69501b518d5830ea77544d4d5290c7cc13745ca00ea"
|
"hash": "ec9cb9384817f84cf0bacd62a23b69b2304fa2cf0352b16d3950b21d48c04f11"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -3960,6 +3975,21 @@
|
|||||||
"hash": "a69e2913ccc5c7ca2100de571087a44c14b7ca475154740bace342852357b379"
|
"hash": "a69e2913ccc5c7ca2100de571087a44c14b7ca475154740bace342852357b379"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "serializeForm",
|
||||||
|
"type": "snippetListing",
|
||||||
|
"attributes": {
|
||||||
|
"tags": [
|
||||||
|
"browser",
|
||||||
|
"string",
|
||||||
|
"intermediate"
|
||||||
|
],
|
||||||
|
"archived": false
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"hash": "2667730d717644182036005fffd041cb6f44173d1dc64e8d75ccf491a66e1ebb"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "setStyle",
|
"id": "setStyle",
|
||||||
"type": "snippetListing",
|
"type": "snippetListing",
|
||||||
|
|||||||
@ -568,7 +568,7 @@
|
|||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"archived": false,
|
"archived": false,
|
||||||
"hash": "01f1ea63f0660c6cd189722d2bf4ee10a651649d14338ca6dca7037106faaf61"
|
"hash": "a54a645ae51358e2a652adcd19b465e5da0c39d1ebf7a3a393b92cb2c8762883"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -2025,6 +2025,28 @@
|
|||||||
"hash": "72c557bd9def493e3a138705f5cb66f993228bd7e51b11fa84f85841bc035524"
|
"hash": "72c557bd9def493e3a138705f5cb66f993228bd7e51b11fa84f85841bc035524"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "formToObject",
|
||||||
|
"type": "snippet",
|
||||||
|
"attributes": {
|
||||||
|
"fileName": "formToObject.md",
|
||||||
|
"text": "Encode a set of form elements as an `object`.\n\nUse the `FormData` constructor to convert the HTML `form` to `FormData`, `Array.from()` to convert to an array.\nCollect the object from the array, using `Array.prototype.reduce()`.",
|
||||||
|
"codeBlocks": {
|
||||||
|
"es6": "const formToObject = form =>\n Array.from(new FormData(form)).reduce(\n (acc, [key, value]) => ({\n ...acc,\n [key]: value\n }),\n {}\n );",
|
||||||
|
"es5": "function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nvar formToObject = function formToObject(form) {\n return Array.from(new FormData(form)).reduce(function (acc, _ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n key = _ref2[0],\n value = _ref2[1];\n\n return _objectSpread({}, acc, _defineProperty({}, key, value));\n }, {});\n};",
|
||||||
|
"example": "formToObject(document.querySelector('#form')); // { email: 'test@email.com', name: 'Test Name' }"
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"browser",
|
||||||
|
"object",
|
||||||
|
"intermediate"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"archived": false,
|
||||||
|
"hash": "2bb4becd71bb5d71e6581e9d944fb44cca6c2c6441fe169fbc1b83e8ed48b4a6"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "forOwn",
|
"id": "forOwn",
|
||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
@ -5006,7 +5028,7 @@
|
|||||||
"codeBlocks": {
|
"codeBlocks": {
|
||||||
"es6": "const pipeAsyncFunctions = (...fns) => arg => fns.reduce((p, f) => p.then(f), Promise.resolve(arg));",
|
"es6": "const pipeAsyncFunctions = (...fns) => arg => fns.reduce((p, f) => p.then(f), Promise.resolve(arg));",
|
||||||
"es5": "var pipeAsyncFunctions = function pipeAsyncFunctions() {\n for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {\n fns[_key] = arguments[_key];\n }\n\n return function (arg) {\n return fns.reduce(function (p, f) {\n return p.then(f);\n }, Promise.resolve(arg));\n };\n};",
|
"es5": "var pipeAsyncFunctions = function pipeAsyncFunctions() {\n for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {\n fns[_key] = arguments[_key];\n }\n\n return function (arg) {\n return fns.reduce(function (p, f) {\n return p.then(f);\n }, Promise.resolve(arg));\n };\n};",
|
||||||
"example": "const sum = pipeAsyncFunctions(\n x => x + 1,\n x => new Promise(resolve => setTimeout(() => resolve(x + 2), 1000)),\n x => x + 3,\n async x => (await x) + 4\n);\n(async () => {\n console.log(await sum(5)); // 15 (after one second)\n})();"
|
"example": "const sum = pipeAsyncFunctions(\n x => x + 1,\n x => new Promise(resolve => setTimeout(() => resolve(x + 2), 1000)),\n x => x + 3,\n async x => (await x) + 4\n);\n(async() => {\n console.log(await sum(5)); // 15 (after one second)\n})();"
|
||||||
},
|
},
|
||||||
"tags": [
|
"tags": [
|
||||||
"adapter",
|
"adapter",
|
||||||
@ -5017,7 +5039,7 @@
|
|||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"archived": false,
|
"archived": false,
|
||||||
"hash": "dcdf66e8d0eb4a1761c6b767b8cc350757087ae817ec371436faab0fff7c0051"
|
"hash": "4815876fd6dbb17ad34c0d8918e7a72d837104f9beee7dc51b0fa73057b9e83e"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -5553,7 +5575,7 @@
|
|||||||
"fileName": "remove.md",
|
"fileName": "remove.md",
|
||||||
"text": "Removes elements from an array for which the given function returns `false`.\n\nUse `Array.prototype.filter()` to find array elements that return truthy values and `Array.prototype.reduce()` to remove elements using `Array.prototype.splice()`.\nThe `func` is invoked with three arguments (`value, index, array`).",
|
"text": "Removes elements from an array for which the given function returns `false`.\n\nUse `Array.prototype.filter()` to find array elements that return truthy values and `Array.prototype.reduce()` to remove elements using `Array.prototype.splice()`.\nThe `func` is invoked with three arguments (`value, index, array`).",
|
||||||
"codeBlocks": {
|
"codeBlocks": {
|
||||||
"es6": "const remove = (arr, func) =>\n Array.isArray(arr)\n ? arr.filter(func).reduce((acc, val) => {\n arr.splice(arr.indexOf(val), 1);\n return acc.concat(val);\n }, [])\n : [];",
|
"es6": "const remove = (arr, func) =>\n Array.isArray(arr)\n ? arr.filter(func).reduce((acc, val) => {\n arr.splice(arr.indexOf(val), 1);\n return acc.concat(val);\n }, [])\n : [];",
|
||||||
"es5": "var remove = function remove(arr, func) {\n return Array.isArray(arr) ? arr.filter(func).reduce(function (acc, val) {\n arr.splice(arr.indexOf(val), 1);\n return acc.concat(val);\n }, []) : [];\n};",
|
"es5": "var remove = function remove(arr, func) {\n return Array.isArray(arr) ? arr.filter(func).reduce(function (acc, val) {\n arr.splice(arr.indexOf(val), 1);\n return acc.concat(val);\n }, []) : [];\n};",
|
||||||
"example": "remove([1, 2, 3, 4], n => n % 2 === 0); // [2, 4]"
|
"example": "remove([1, 2, 3, 4], n => n % 2 === 0); // [2, 4]"
|
||||||
},
|
},
|
||||||
@ -5564,7 +5586,7 @@
|
|||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"archived": false,
|
"archived": false,
|
||||||
"hash": "2fd54c9fc1fb5b0a981df69501b518d5830ea77544d4d5290c7cc13745ca00ea"
|
"hash": "ec9cb9384817f84cf0bacd62a23b69b2304fa2cf0352b16d3950b21d48c04f11"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -5829,6 +5851,28 @@
|
|||||||
"hash": "a69e2913ccc5c7ca2100de571087a44c14b7ca475154740bace342852357b379"
|
"hash": "a69e2913ccc5c7ca2100de571087a44c14b7ca475154740bace342852357b379"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "serializeForm",
|
||||||
|
"type": "snippet",
|
||||||
|
"attributes": {
|
||||||
|
"fileName": "serializeForm.md",
|
||||||
|
"text": "Encode a set of form elements as a query string.\n\nUse the `FormData` constructor to convert the HTML `form` to `FormData`, `Array.from()` to convert to an array, passing a map function as the second argument.\nUse `Array.prototype.map()` and `window.encodeURIComponent()` to encode each field's value.\nUse `Array.prototype.join()` with appropriate argumens to produce an appropriate query string.",
|
||||||
|
"codeBlocks": {
|
||||||
|
"es6": "const serializeForm = form =>\n Array.from(new FormData(form), field => field.map(encodeURIComponent).join('=')).join('&');",
|
||||||
|
"es5": "var serializeForm = function serializeForm(form) {\n return Array.from(new FormData(form), function (field) {\n return field.map(encodeURIComponent).join('=');\n }).join('&');\n};",
|
||||||
|
"example": "serializeForm(document.querySelector('#form')); // email=test%40email.com&name=Test%20Name"
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"browser",
|
||||||
|
"string",
|
||||||
|
"intermediate"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"archived": false,
|
||||||
|
"hash": "2667730d717644182036005fffd041cb6f44173d1dc64e8d75ccf491a66e1ebb"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "setStyle",
|
"id": "setStyle",
|
||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
|
|||||||
@ -922,6 +922,20 @@
|
|||||||
],
|
],
|
||||||
"description": "Returns the human readable format of the given number of milliseconds.\n\nDivide `ms` with the appropriate values to obtain the appropriate values for `day`, `hour`, `minute`, `second` and `millisecond`.\nUse `Object.entries()` with `Array.prototype.filter()` to keep only non-zero values.\nUse `Array.prototype.map()` to create the string for each value, pluralizing appropriately.\nUse `String.prototype.join(', ')` to combine the values into a string"
|
"description": "Returns the human readable format of the given number of milliseconds.\n\nDivide `ms` with the appropriate values to obtain the appropriate values for `day`, `hour`, `minute`, `second` and `millisecond`.\nUse `Object.entries()` with `Array.prototype.filter()` to keep only non-zero values.\nUse `Array.prototype.map()` to create the string for each value, pluralizing appropriately.\nUse `String.prototype.join(', ')` to combine the values into a string"
|
||||||
},
|
},
|
||||||
|
"formToObject": {
|
||||||
|
"prefix": "30s_formToObject",
|
||||||
|
"body": [
|
||||||
|
"const formToObject = form =>",
|
||||||
|
" Array.from(new FormData(form)).reduce(",
|
||||||
|
" (acc, [key, value]) => ({",
|
||||||
|
" ...acc,",
|
||||||
|
" [key]: value",
|
||||||
|
" }),",
|
||||||
|
" {}",
|
||||||
|
" );"
|
||||||
|
],
|
||||||
|
"description": "Encode a set of form elements as an `object`.\n\nUse the `FormData` constructor to convert the HTML `form` to `FormData`, `Array.from()` to convert to an array.\nCollect the object from the array, using `Array.prototype.reduce()`"
|
||||||
|
},
|
||||||
"forOwn": {
|
"forOwn": {
|
||||||
"prefix": "30s_forOwn",
|
"prefix": "30s_forOwn",
|
||||||
"body": [
|
"body": [
|
||||||
@ -2499,9 +2513,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);",
|
||||||
" }, [])",
|
" }, [])",
|
||||||
" : [];"
|
" : [];"
|
||||||
],
|
],
|
||||||
"description": "Removes elements from an array for which the given function returns `false`.\n\nUse `Array.prototype.filter()` to find array elements that return truthy values and `Array.prototype.reduce()` to remove elements using `Array.prototype.splice()`.\nThe `func` is invoked with three arguments (`value, index, array`)"
|
"description": "Removes elements from an array for which the given function returns `false`.\n\nUse `Array.prototype.filter()` to find array elements that return truthy values and `Array.prototype.reduce()` to remove elements using `Array.prototype.splice()`.\nThe `func` is invoked with three arguments (`value, index, array`)"
|
||||||
@ -2631,6 +2645,14 @@
|
|||||||
],
|
],
|
||||||
"description": "Serialize a cookie name-value pair into a Set-Cookie header string.\n\nUse template literals and `encodeURIComponent()` to create the appropriate string"
|
"description": "Serialize a cookie name-value pair into a Set-Cookie header string.\n\nUse template literals and `encodeURIComponent()` to create the appropriate string"
|
||||||
},
|
},
|
||||||
|
"serializeForm": {
|
||||||
|
"prefix": "30s_serializeForm",
|
||||||
|
"body": [
|
||||||
|
"const serializeForm = form =>",
|
||||||
|
" Array.from(new FormData(form), field => field.map(encodeURIComponent).join('=')).join('&');"
|
||||||
|
],
|
||||||
|
"description": "Encode a set of form elements as a query string.\n\nUse the `FormData` constructor to convert the HTML `form` to `FormData`, `Array.from()` to convert to an array, passing a map function as the second argument.\nUse `Array.prototype.map()` and `window.encodeURIComponent()` to encode each field's value.\nUse `Array.prototype.join()` with appropriate argumens to produce an appropriate query string"
|
||||||
|
},
|
||||||
"setStyle": {
|
"setStyle": {
|
||||||
"prefix": "30s_setStyle",
|
"prefix": "30s_setStyle",
|
||||||
"body": [
|
"body": [
|
||||||
|
|||||||
Reference in New Issue
Block a user