Comparing version 1.2.0 to 1.3.0
# Changelog | ||
## 1.3.0 | ||
+ firstTruethy | ||
## 1.2.0 | ||
Start a changelog, publish with license. |
14
fp.js
@@ -1,2 +0,2 @@ | ||
export { map, curry }; | ||
export { map, curry, firstTruethy }; | ||
@@ -29,2 +29,14 @@ | ||
/*array.some and array.find both stop when 1 iteration returns true | ||
in that case .some returns true and find returns the element for which it was true | ||
firstTruethy is the same as find, except it returns the first truethy value instead of the value */ | ||
const firstTruethy = (mapper, x) => { | ||
let truethyValue; | ||
x.some(value => { | ||
truethyValue = mapper(value); | ||
return truethyValue; | ||
}) | ||
return truethyValue || undefined; | ||
}; | ||
/* | ||
@@ -31,0 +43,0 @@ curries 1 or more |
{ | ||
"name": "fp-sac", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "functional primitives and helpers", | ||
@@ -13,3 +13,3 @@ "license": "CC0-1.0", | ||
"eslint": "^7.0.0", | ||
"eslint-config-red": "^1.7.0" | ||
"eslint-config-red": "^1.8.1" | ||
}, | ||
@@ -21,3 +21,3 @@ "eslintConfig": { | ||
"parserOptions": { | ||
"ecmaVersion": 2020, | ||
"ecmaVersion": 2021, | ||
"sourceType": "module", | ||
@@ -27,3 +27,3 @@ "ecmaFeatures": {} | ||
"env": { | ||
"es2020": true | ||
"es2021": true | ||
} | ||
@@ -30,0 +30,0 @@ }, |
# fp-sac | ||
Read the source code. It is the documentation. | ||
## fp.js | ||
```js | ||
import {map, curry} from "fp-sac"; | ||
import {map, curry, firstTruethy} from "fp-sac"; | ||
``` | ||
@@ -8,0 +11,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10623
76
21