Comparing version 2.1.0 to 2.2.0
# Changelog | ||
## 2.2.0 | ||
* +partition | ||
## 2.1.0 | ||
@@ -4,0 +8,0 @@ |
@@ -50,7 +50,7 @@ export { | ||
const sequentialalizePromiseCreator = (promiseCreator) => { | ||
let callStack = []; | ||
const callStack = []; | ||
let current; | ||
const callLater = () => { | ||
return promiseCreator(...callStack.shift()); | ||
} | ||
}; | ||
return (...x) => { | ||
@@ -57,0 +57,0 @@ if (!current) { |
17
fp.js
@@ -1,2 +0,2 @@ | ||
export { map, curry, firstTruethy }; | ||
export { map, curry, firstTruethy, partition }; | ||
@@ -48,1 +48,16 @@ | ||
/* similar to filter but returns 2 arrays: | ||
The one you would have with filter and another array with rest */ | ||
const partition = (mapper, array) => { | ||
const inside = []; | ||
const out = []; | ||
array.forEach(element => { | ||
if (mapper(element)) { | ||
inside.push(element); | ||
} else { | ||
out.push(element); | ||
} | ||
}); | ||
return [inside, out]; | ||
}; | ||
{ | ||
"name": "fp-sac", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "functional primitives and helpers", | ||
@@ -14,4 +14,4 @@ "license": "CC0-1.0", | ||
"devDependencies": { | ||
"eslint": "^7.32.0", | ||
"eslint-config-red": "^1.8.2" | ||
"eslint": "^8.19.0", | ||
"eslint-config-red": "^1.9.1" | ||
}, | ||
@@ -18,0 +18,0 @@ "eslintConfig": { |
@@ -9,3 +9,3 @@ # fp-sac | ||
```js | ||
import {map, curry, firstTruethy} from "fp-sac"; | ||
import {map, curry, firstTruethy, partition} from "fp-sac"; | ||
``` | ||
@@ -12,0 +12,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
12446
115