Skip to content

Commit

Permalink
chore: replace util functions values and contains with using nati…
Browse files Browse the repository at this point in the history
…ve JS functions (see #3194)
  • Loading branch information
josdejong committed Apr 25, 2024
1 parent a9fbb35 commit e37bacd
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions tools/entryGenerator.js
Expand Up @@ -266,7 +266,7 @@ function generateDependenciesFiles ({ suffix, factories, entryFolder }) {
function generateFunctionsFiles ({ suffix, factories, entryFolder }) {
const braceOpen = '{' // a hack to be able to create a single brace open character in handlebars

const sortedFactories = sortFactories(values(factories))
const sortedFactories = sortFactories(Object.values(factories))

// sort the factories, and split them in three groups:
// - transform: the transform functions
Expand All @@ -281,9 +281,9 @@ function generateFunctionsFiles ({ suffix, factories, entryFolder }) {
if (isTransform(factory)) {
transformFactories.push(factory)
} else if (
contains(factory.dependencies, 'math') ||
contains(factory.dependencies, 'mathWithTransform') ||
contains(factory.dependencies, 'classes') ||
factory.dependencies.includes('math') ||
factory.dependencies.includes( 'mathWithTransform') ||
factory.dependencies.includes( 'classes') ||
isTransform(factory) ||
factory.dependencies.some(dependency => {
return impureFactories.find(f => f.fn === stripOptionalNotation(dependency))
Expand Down Expand Up @@ -533,14 +533,6 @@ function sortFactories (factories) {
return sortedFactories
}

function values (object) {
return Object.keys(object).map(key => object[key])
}

function contains (array, item) {
return array.indexOf(item) !== -1
}

function isTransform (factory) {
return (factory && factory.meta && factory.meta.isTransformFunction === true) || false
}
Expand Down

0 comments on commit e37bacd

Please sign in to comment.