Repository: ViacomInc/data-point
Pull request #50 (2017-12-17 20:28:56)

style: Replace the name ComposeModifier with ComposeReducer
#49


Patch:
diff --git a/packages/data-point/README.md b/packages/data-point/README.md
index a767c65..1890e73 100644
--- a/packages/data-point/README.md
+++ b/packages/data-point/README.md
@@ -1516,7 +1516,7 @@ dataPoint.addEntities({
     pickKeys: String[],
     addKeys: TransformMap,
     addValues: Object,
-    compose: ComposeModifier[],
+    compose: ComposeReducer[],
     
     after: TransformExpression,
     error: TransformExpression,
@@ -1905,7 +1905,7 @@ dataPoint.addEntities({
     filter: TransformExpression,
     map: TransformExpression,
     find: TransformExpression,
-    compose: ComposeModifier[],
+    compose: ComposeReducer[],
     
     after: TransformExpression,
     error: TransformExpression,
diff --git a/packages/data-point/lib/entity-types/entity-collection/reducer.js b/packages/data-point/lib/entity-types/entity-collection/reducer.js
index 188c754..4a5ce11 100644
--- a/packages/data-point/lib/entity-types/entity-collection/reducer.js
+++ b/packages/data-point/lib/entity-types/entity-collection/reducer.js
@@ -70,13 +70,13 @@ const modifierFunctionMap = {
   filter: resolveFilterTransform
 }
 
-function resolveCompose (accumulator, composeModifiers, resolveTransform) {
-  if (composeModifiers.length === 0) {
+function resolveCompose (accumulator, composeReducers, resolveTransform) {
+  if (composeReducers.length === 0) {
     return Promise.resolve(accumulator)
   }
 
   return Promise.reduce(
-    composeModifiers,
+    composeReducers,
     (resultContext, modifierSpec) => {
       const modifierFunction = modifierFunctionMap[modifierSpec.type]
       return modifierFunction(
diff --git a/packages/data-point/lib/entity-types/entity-hash/reducer.js b/packages/data-point/lib/entity-types/entity-hash/reducer.js
index 22019f0..a976e53 100644
--- a/packages/data-point/lib/entity-types/entity-hash/reducer.js
+++ b/packages/data-point/lib/entity-types/entity-hash/reducer.js
@@ -111,13 +111,13 @@ const modifierFunctionMap = {
   pickKeys: resolvePickKeys
 }
 
-function resolveCompose (accumulator, composeModifiers, resolveTransform) {
-  if (composeModifiers.length === 0) {
+function resolveCompose (accumulator, composeReducers, resolveTransform) {
+  if (composeReducers.length === 0) {
     return Promise.resolve(accumulator)
   }
 
   return Promise.reduce(
-    composeModifiers,
+    composeReducers,
     (resultContext, modifierSpec) => {
       const modifierFunction = modifierFunctionMap[modifierSpec.type]
       return modifierFunction(
diff --git a/packages/data-point/lib/entity-types/parse-compose/parse-compose.js b/packages/data-point/lib/entity-types/parse-compose/parse-compose.js
index f328ad2..66db290 100644
--- a/packages/data-point/lib/entity-types/parse-compose/parse-compose.js
+++ b/packages/data-point/lib/entity-types/parse-compose/parse-compose.js
@@ -1,13 +1,13 @@
 'use strict'
 
-function createComposeModifier (type, spec) {
+function createComposeReducer (type, spec) {
   return {
     type,
     spec
   }
 }
 
-module.exports.createComposeModifier = createComposeModifier
+module.exports.createComposeReducer = createComposeReducer
 
 function parseModifierSpec (modifierSpec) {
   const keys = Object.keys(modifierSpec)
@@ -19,7 +19,7 @@ function parseModifierSpec (modifierSpec) {
     )
   }
   const type = keys[0]
-  return createComposeModifier(keys[0], modifierSpec[type])
+  return createComposeReducer(keys[0], modifierSpec[type])
 }
 
 module.exports.parseModifierSpec = parseModifierSpec
@@ -35,7 +35,7 @@ function parseComposeFromEntitySpec (entitySpec, modifierKeys) {
     if (typeof entitySpec[modifierKey] === 'undefined') {
       return acc
     }
-    const modifier = createComposeModifier(modifierKey, entitySpec[modifierKey])
+    const modifier = createComposeReducer(modifierKey, entitySpec[modifierKey])
     acc.push(modifier)
     return acc
   }, [])


Test patch:
diff --git a/packages/data-point/lib/entity-types/parse-compose/parse-compose.test.js b/packages/data-point/lib/entity-types/parse-compose/parse-compose.test.js
index 6264f31..db569d3 100644
--- a/packages/data-point/lib/entity-types/parse-compose/parse-compose.test.js
+++ b/packages/data-point/lib/entity-types/parse-compose/parse-compose.test.js
@@ -7,9 +7,9 @@ function expectModifier (result) {
   expect(result).toHaveProperty('spec')
 }
 
-describe('createComposeModifier', () => {
+describe('createComposeReducer', () => {
   test('creates ModifierObject', () => {
-    const result = parseCompose.createComposeModifier('map', '$a')
+    const result = parseCompose.createComposeReducer('map', '$a')
     expectModifier(result)
   })
 })