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.3.4 assets/js/helpers/build.js
lookbook-2.3.3 assets/js/helpers/build.js
lookbook-2.3.2 assets/js/helpers/build.js
lookbook-2.3.0 assets/js/helpers/build.js
lookbook-2.2.2 assets/js/helpers/build.js
lookbook-2.2.1 assets/js/helpers/build.js
lookbook-2.2.0 assets/js/helpers/build.js
lookbook-2.1.1 assets/js/helpers/build.js
lookbook-2.1.0 assets/js/helpers/build.js
lookbook-2.0.5 assets/js/helpers/build.js
lookbook-2.0.4 assets/js/helpers/build.js
lookbook-2.0.3 assets/js/helpers/build.js
lookbook-2.0.2 assets/js/helpers/build.js
lookbook-2.0.1 assets/js/helpers/build.js
lookbook-2.0.0 assets/js/helpers/build.js
lookbook-2.0.0.rc.3 assets/js/helpers/build.js
lookbook-1.5.5 app/assets/lookbook/js/helpers/build.js
lookbook-1.5.4 app/assets/lookbook/js/helpers/build.js
lookbook-2.0.0.rc.2 assets/js/helpers/build.js
lookbook-2.0.0.rc.1 assets/js/helpers/build.js