Skip to content

Commit

Permalink
build cdn
Browse files Browse the repository at this point in the history
  • Loading branch information
Ray Epps authored and Ray Epps committed Feb 21, 2024
1 parent ecfc6dd commit b267046
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 18 deletions.
27 changes: 18 additions & 9 deletions cdn/radash.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,9 @@ const boil = (array, compareFunc) => {
return null;
return array.reduce(compareFunc);
};
const sum = (array, fn) => {
return (array || []).reduce(
(acc, item) => acc + (fn ? fn(item) : item),
0
);
};
function sum(array, fn) {
return (array || []).reduce((acc, item) => acc + (fn ? fn(item) : item), 0);
}
const first = (array, defaultValue = void 0) => {
return array?.length > 0 ? array[0] : defaultValue;
};
Expand Down Expand Up @@ -590,6 +587,17 @@ const callable = (obj, fn) => {
});
};

function inRange(number, start, end) {
const isTypeSafe = typeof number === "number" && typeof start === "number" && (typeof end === "undefined" || typeof end === "number");
if (!isTypeSafe) {
return false;
}
if (typeof end === "undefined") {
end = start;
start = 0;
}
return number >= Math.min(start, end) && number < Math.max(start, end);
}
const toFloat = (value, defaultValue) => {
const def = defaultValue === void 0 ? 0 : defaultValue;
if (value === null || value === void 0) {
Expand Down Expand Up @@ -708,9 +716,10 @@ const get = (value, path, defaultValue) => {
return defaultValue;
if (current === void 0)
return defaultValue;
if (key.trim() === "")
const dequoted = key.replace(/['"]/g, "");
if (dequoted.trim() === "")
continue;
current = current[key];
current = current[dequoted];
}
if (current === void 0)
return defaultValue;
Expand Down Expand Up @@ -928,4 +937,4 @@ const trim = (str, charsToTrim = " ") => {
return str.replace(regex, "");
};

export { all, alphabetical, assign, boil, callable, camel, capitalize, chain, clone, cluster, compose, construct, counting, crush, dash, debounce, defer, diff, draw, first, flat, fork, get, group, guard, intersects, invert, isArray, isDate, isEmpty, isEqual, isFloat, isFunction, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, lowerize, map, mapEntries, mapKeys, mapValues, max, memo, merge, min, objectify, omit, parallel, partial, partob, pascal, pick, proxied, random, range, reduce, replace, replaceOrAppend, retry, select, series, set, shake, shift, shuffle, sift, sleep, snake, sort, sum, template, throttle, title, toFloat, toInt, toggle, trim, tryit as try, tryit, uid, unique, upperize, zip, zipToObject };
export { all, alphabetical, assign, boil, callable, camel, capitalize, chain, clone, cluster, compose, construct, counting, crush, dash, debounce, defer, diff, draw, first, flat, fork, get, group, guard, inRange, intersects, invert, isArray, isDate, isEmpty, isEqual, isFloat, isFunction, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, lowerize, map, mapEntries, mapKeys, mapValues, max, memo, merge, min, objectify, omit, parallel, partial, partob, pascal, pick, proxied, random, range, reduce, replace, replaceOrAppend, retry, select, series, set, shake, shift, shuffle, sift, sleep, snake, sort, sum, template, throttle, title, toFloat, toInt, toggle, trim, tryit as try, tryit, uid, unique, upperize, zip, zipToObject };
26 changes: 18 additions & 8 deletions cdn/radash.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,9 @@ var radash = (function (exports) {
return null;
return array.reduce(compareFunc);
};
const sum = (array, fn) => {
return (array || []).reduce(
(acc, item) => acc + (fn ? fn(item) : item),
0
);
};
function sum(array, fn) {
return (array || []).reduce((acc, item) => acc + (fn ? fn(item) : item), 0);
}
const first = (array, defaultValue = void 0) => {
return array?.length > 0 ? array[0] : defaultValue;
};
Expand Down Expand Up @@ -593,6 +590,17 @@ var radash = (function (exports) {
});
};

function inRange(number, start, end) {
const isTypeSafe = typeof number === "number" && typeof start === "number" && (typeof end === "undefined" || typeof end === "number");
if (!isTypeSafe) {
return false;
}
if (typeof end === "undefined") {
end = start;
start = 0;
}
return number >= Math.min(start, end) && number < Math.max(start, end);
}
const toFloat = (value, defaultValue) => {
const def = defaultValue === void 0 ? 0 : defaultValue;
if (value === null || value === void 0) {
Expand Down Expand Up @@ -711,9 +719,10 @@ var radash = (function (exports) {
return defaultValue;
if (current === void 0)
return defaultValue;
if (key.trim() === "")
const dequoted = key.replace(/['"]/g, "");
if (dequoted.trim() === "")
continue;
current = current[key];
current = current[dequoted];
}
if (current === void 0)
return defaultValue;
Expand Down Expand Up @@ -956,6 +965,7 @@ var radash = (function (exports) {
exports.get = get;
exports.group = group;
exports.guard = guard;
exports.inRange = inRange;
exports.intersects = intersects;
exports.invert = invert;
exports.isArray = isArray;
Expand Down
Loading

0 comments on commit b267046

Please sign in to comment.