Sha256: 42deb480cecea63a8bed6342144786911f3fa5648cfd4d930738f3615d8a9cd8
Contents?: true
Size: 541 Bytes
Versions: 68
Compression:
Stored size: 541 Bytes
Contents
function getComponents(importObject, path = []) { let components = {}; Object.keys(importObject).forEach((key) => { if (key === "default") { components[toCamel(path.join("_"))] = importObject[key]; } else { components = { ...components, ...getComponents(importObject[key], [...path, key]), }; } }); return components; } function toCamel(s) { return s.replace(/([-_][a-z])/gi, ($1) => { return $1.toUpperCase().replace("-", "").replace("_", ""); }); } export { getComponents };
Version data entries
68 entries across 68 versions & 1 rubygems