UNPKG

@nfq/react-grid

Version:

An fork of react-awesome-styled-grid with more screen classes and some features.

33 lines (31 loc) 1.1 kB
const isObject = item => Boolean(item && typeof item === 'object' && !Array.isArray(item)); const isNotNullOrUndefined = input => input !== null && typeof input !== 'undefined'; const fillObject = (breakpoints, defaultValue) => breakpoints.reduce((acc, curr) => ({ ...acc, [curr]: defaultValue }), {}); const mergeDeep = (target, source) => { if (!source) { return target; } if (isObject(target) && isObject(source)) { Object.keys(source).forEach(key => { if (isObject(source[key])) { if (!target[key]) { Object.assign(target, { [key]: {} }); } mergeDeep(target[key], source[key]); } else { Object.assign(target, { [key]: source[key] }); } }); } return target; }; const remapWithPrefix = (obj, prefix) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, typeof value === 'string' ? value === 'fluid' ? '100%' : value : `${value}${prefix}`])); export { fillObject, isNotNullOrUndefined, isObject, mergeDeep, remapWithPrefix }; //# sourceMappingURL=utils.js.map