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

Version Path
lookbook-1.0.0.beta.7 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.0.beta.6 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.0.beta.5 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.0.beta.4 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.0.beta.3 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.0.beta.2 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.0.beta.1 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.0.beta.0 app/assets/lookbook/js/helpers/build.js