From 6ff1a720355079a9ec792a31e7cd7189c49f6606 Mon Sep 17 00:00:00 2001 From: Ben Hormann Date: Sat, 3 Oct 2020 14:12:33 +0100 Subject: [PATCH 1/2] Update docs referencing deprecated functions --- docs/src/pages/docs/functions/combinators.md | 6 +++--- docs/src/pages/docs/functions/helpers.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/src/pages/docs/functions/combinators.md b/docs/src/pages/docs/functions/combinators.md index 3e1ae7814..b2e82ee3e 100644 --- a/docs/src/pages/docs/functions/combinators.md +++ b/docs/src/pages/docs/functions/combinators.md @@ -127,7 +127,7 @@ import hasProp from 'crocks/predicates/hasProp' import isNumber from 'crocks/predicates/isNumber' import liftA2 from 'crocks/helpers/liftA2' import map from 'crocks/pointfree/map' -import prop from 'crocks/Maybe/prop' +import getProp from 'crocks/Maybe/getProp' import safe from 'crocks/Maybe/safe' import safeLift from 'crocks/Maybe/safeLift' @@ -172,7 +172,7 @@ const items = // pluck :: String -> Array Object -> Maybe a const pluck = - compose2(applyTo, prop, flip(map)) + compose2(applyTo, getProp, flip(map)) pluck('id', items) //=> [ Just 2, Just 1 ] @@ -190,7 +190,7 @@ const getLength = safeLift( // createSummary :: Person -> Array Item -> String const createSummary = compose2( liftA2(summarize), - prop('name'), + getProp('name'), getLength ) diff --git a/docs/src/pages/docs/functions/helpers.md b/docs/src/pages/docs/functions/helpers.md index 4dd86e75f..69eba1b5b 100644 --- a/docs/src/pages/docs/functions/helpers.md +++ b/docs/src/pages/docs/functions/helpers.md @@ -312,7 +312,7 @@ number of parameters. import compose from 'crocks/helpers/compose' import curry from 'crocks/helpers/curry' import map from 'crocks/pointfree/map' -import prop from 'crocks/maybe/prop' +import getProp from 'crocks/maybe/getProp' // add :: (Number, Number, Number) -> Number const add = (a, b, c) => @@ -342,7 +342,7 @@ crocksCurriedAdd(1, 2, 3) // strictCurriedPluck :: String -> [ a ] -> Maybe b const strictCurriedPluck = - compose(map, prop) + compose(map, getProp) const crockCurriedPluck = curry(strictCurriedPluck) @@ -836,7 +836,7 @@ just want to combine the two into an `Object`, then it sounds like `objOf` is the function for you. Just pass it a `String` for the key and any type of value, and you'll get back an `Object` that is composed of those two. If you find yourself constantly concatenating the result of this function into -another `Object`, you may want to use [`assoc`](#assoc) instead. +another `Object`, you may want to use [`setProp`](#setprop) instead. #### omit From 182cdfd798a2b6ce454960cb5dd109d62a20ceb4 Mon Sep 17 00:00:00 2001 From: Ben Hormann Date: Sat, 3 Oct 2020 14:26:12 +0100 Subject: [PATCH 2/2] Fix incorrect reference to deprecated function dissoc --- docs/src/pages/docs/functions/helpers.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/src/pages/docs/functions/helpers.md b/docs/src/pages/docs/functions/helpers.md index 69eba1b5b..467e1e81f 100644 --- a/docs/src/pages/docs/functions/helpers.md +++ b/docs/src/pages/docs/functions/helpers.md @@ -1300,8 +1300,7 @@ unsetPath :: [ (String | Integer) ] -> a -> a ``` Used to remove a property or index on a deeply nested `Object`/`Array`. -`unsetPath`, previously called `dissoc`, will return a new instance with the -property or index removed. +`unsetPath` will return a new instance with the property or index removed. The provided path can be a mixture of either Positive `Integer`s or `String`s to allow for traversing through both `Array`s and `Object`s. When an `Integer` is @@ -1337,11 +1336,11 @@ unsetPath([ 'a', 'b' ], { a: { c: false } }) unsetProp :: (String | Integer) -> a -> a ``` -`unsetProp` is a binary function that takes either a property name or an index -as its first argument. Which specifies what should be removed, or "unset", from -the `Object` or `Array` provided as the second argument. If the value provided -for the second argument is not an `Object` or `Array`, then the value provided -is echoed back as the result. +`unsetProp`, previously called `dissoc`, is a binary function that takes either +a property name or an index as its first argument. Which specifies what should be +removed, or "unset", from the `Object` or `Array` provided as the second argument. +If the value provided for the second argument is not an `Object` or `Array`, then +the value provided is echoed back as the result. The first argument must be either a non-empty `String` or positive `Integer`. A `String` should be provided when working with