v5.0.0 update

This commit is contained in:
Mohit Panjwani
2021-11-30 18:58:19 +05:30
parent d332712c22
commit 082d5cacf2
1253 changed files with 88309 additions and 71741 deletions

View File

@ -0,0 +1,30 @@
export function classList(...classes) {
return classes
.map(c => Array.isArray(c) ? c : [c])
.reduce((classes, c) => classes.concat(c), []);
}
export function get(object, path) {
if (!path) {
return object;
}
if (object === null || typeof object !== 'object') {
return object;
}
const [pathHead, pathTail] = path.split(/\.(.+)/);
return get(object[pathHead], pathTail);
}
export function pick(object, properties) {
return properties.reduce((pickedObject, property) => {
pickedObject[property] = object[property];
return pickedObject;
}, {});
}
export function range(from, to) {
return [...Array(to - from)].map((_, i) => i + from);
}