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-2.0.0.beta.9 assets/js/helpers/build.js
lookbook-2.0.0.beta.8 assets/js/helpers/build.js
lookbook-2.0.0.beta.7 assets/js/helpers/build.js
lookbook-2.0.0.beta.5 app/assets/lookbook/js/helpers/build.js
lookbook-2.0.0.beta.4 app/assets/lookbook/js/helpers/build.js
lookbook-2.0.0.beta.3 app/assets/lookbook/js/helpers/build.js
lookbook-2.0.0.beta.2 app/assets/lookbook/js/helpers/build.js
lookbook-1.5.3 app/assets/lookbook/js/helpers/build.js
lookbook-2.0.0.beta.1 app/assets/lookbook/js/helpers/build.js
lookbook-1.5.2 app/assets/lookbook/js/helpers/build.js
lookbook-2.0.0.beta.0 app/assets/lookbook/js/helpers/build.js
lookbook-1.5.1 app/assets/lookbook/js/helpers/build.js
lookbook-1.5.0 app/assets/lookbook/js/helpers/build.js
lookbook-1.4.5 app/assets/lookbook/js/helpers/build.js
lookbook-1.4.4 app/assets/lookbook/js/helpers/build.js
lookbook-1.4.3 app/assets/lookbook/js/helpers/build.js
lookbook-1.4.2 app/assets/lookbook/js/helpers/build.js
lookbook-1.4.1 app/assets/lookbook/js/helpers/build.js
lookbook-1.4.0 app/assets/lookbook/js/helpers/build.js
lookbook-1.3.4 app/assets/lookbook/js/helpers/build.js