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.3.3 app/assets/lookbook/js/helpers/build.js
lookbook-1.3.1 app/assets/lookbook/js/helpers/build.js
lookbook-1.3.0 app/assets/lookbook/js/helpers/build.js
lookbook-1.2.1 app/assets/lookbook/js/helpers/build.js
lookbook-1.2.0 app/assets/lookbook/js/helpers/build.js
lookbook-1.1.1 app/assets/lookbook/js/helpers/build.js
lookbook-1.1.0 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.8 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.7 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.6 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.5 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.4 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.3 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.2 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.1 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.0 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.0.rc.3 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.0.rc.2 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.0.rc.1 app/assets/lookbook/js/helpers/build.js
lookbook-1.0.0.beta.8 app/assets/lookbook/js/helpers/build.js