From 010863e6cb7bc5e9f33fb03011b05592fafa198f Mon Sep 17 00:00:00 2001 From: Christian Musa Date: Thu, 20 Oct 2022 23:44:54 +0200 Subject: [PATCH] feat: remove pipeP usage --- src/count.js | 5 ++--- src/get-all.js | 5 ++--- src/get.js | 5 ++--- src/remove.js | 7 +++---- src/update.js | 10 +++------- 5 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/count.js b/src/count.js index f454a28..af127f0 100644 --- a/src/count.js +++ b/src/count.js @@ -4,14 +4,13 @@ * @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html * @module Count */ -const { curry, compose, andThen, bind, prop, pipeWith } = require('ramda'); -const pipeP = pipeWith(andThen); +const { curry, compose, bind, prop } = require('ramda'); const addTableName = require('./table-name'); /** * @private */ -const createCount = scan => pipeP([scan, prop('Count')]); +const createCount = scan => params => scan(params).then(prop('Count')); /** * @private diff --git a/src/get-all.js b/src/get-all.js index 9af35a1..eb0f09c 100644 --- a/src/get-all.js +++ b/src/get-all.js @@ -4,15 +4,14 @@ * @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html * @module Scan */ -const { curry, bind, pipeWith, andThen, compose } = require('ramda'); +const { curry, bind, compose } = require('ramda'); const { unwrapAll } = require('./wrapper'); const addTableName = require('./table-name'); -const pipeP = pipeWith(andThen); /** * @private */ -const createGetAll = scan => pipeP([scan, unwrapAll('Items')]); +const createGetAll = scan => params => scan(params).then(unwrapAll('Items')); /** * @private diff --git a/src/get.js b/src/get.js index 488c219..3f54378 100644 --- a/src/get.js +++ b/src/get.js @@ -4,17 +4,16 @@ * @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html * @module GetItem */ -const { curry, bind, pipeWith, andThen, compose, apply } = require('ramda'); +const { curry, bind, compose } = require('ramda'); const { unwrapProp } = require('./wrapper'); const { mapMergeFirstPairOfArgs } = require('./map-merge-args'); const generateKey = require('./generate-key'); const addTableName = require('./table-name'); -const pipeP = pipeWith(andThen); /** * @private */ -const getUnwrappedItem = getItem => pipeP([apply(getItem), unwrapProp('Item')]); +const getUnwrappedItem = getItem => params => getItem(...params).then(unwrapProp('Item')); /** * @private diff --git a/src/remove.js b/src/remove.js index cbfa1d8..3724597 100644 --- a/src/remove.js +++ b/src/remove.js @@ -7,19 +7,18 @@ * @module DeleteItem * @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteItem.html */ -const { apply, bind, compose, curry, pipeWith, andThen } = require('ramda'); +const { bind, compose, curry } = require('ramda'); const { unwrapProp } = require('./wrapper'); const addTableName = require('./table-name'); const { mapMergeFirstPairOfArgs } = require('./map-merge-args'); const generateKey = require('./generate-key'); const addReturnValues = require('./return-values'); -const pipeP = pipeWith(andThen); /** * @private */ -const removeAndUnwrapAttributes = deleteItem => - pipeP([apply(deleteItem), unwrapProp('Attributes')]); +const removeAndUnwrapAttributes = deleteItem => params => + deleteItem(...params).then(unwrapProp('Attributes')); /** * @private diff --git a/src/update.js b/src/update.js index 3e62d68..5005036 100644 --- a/src/update.js +++ b/src/update.js @@ -7,7 +7,6 @@ */ const { adjust, - apply, applyTo, bind, compose, @@ -20,13 +19,11 @@ const { is, keys, map, - pipeWith, toPairs, unless, zipObj, reject, - equals, - andThen + equals } = require('ramda'); const { getUpdateExpression } = require('dynamodb-update-expression'); const { unwrapProp, wrapOver } = require('./wrapper'); @@ -35,13 +32,12 @@ const addTableName = require('./table-name'); const addReturnValues = require('./return-values'); const generateKey = require('./generate-key'); const camelCase = require('lodash.camelcase'); -const pipeP = pipeWith(andThen); /** * @private */ -const updateAndUnwrapAttributes = updateItem => - pipeP([apply(updateItem), unwrapProp('Attributes')]); +const updateAndUnwrapAttributes = updateItem => params => + updateItem(...params).then(unwrapProp('Attributes')); /** * @private