ifont
Version:
An isomorphic icon font generator with support for ligatures.
24 lines (23 loc) • 621 B
JavaScript
/* MAIN */
const castArray = (value) => {
return Array.isArray(value) ? value : [value];
};
const memoize = (fn) => {
const cache = new Map();
return (arg) => {
const cached = cache.get(arg);
if (cached || cache.has(arg))
return cached;
const result = fn(arg);
cache.set(arg, result);
return result;
};
};
const round = (value, precision) => {
return Math.round(value / precision) * precision;
};
const without = (values, value) => {
return values.filter(other => other !== value);
};
/* EXPORT */
export { castArray, memoize, round, without };