Skip to content

Commit

Permalink
feat: remove pipeP usage
Browse files Browse the repository at this point in the history
  • Loading branch information
crash7 committed Oct 20, 2022
1 parent c81a0a4 commit 010863e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 20 deletions.
5 changes: 2 additions & 3 deletions src/count.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/get-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions src/remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions src/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
const {
adjust,
apply,
applyTo,
bind,
compose,
Expand All @@ -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');
Expand All @@ -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
Expand Down

0 comments on commit 010863e

Please sign in to comment.