immutable-ext
Advanced tools
Comparing version 1.1.2 to 1.1.3
11
index.js
@@ -28,3 +28,3 @@ const Immutable = require('immutable') | ||
return this.reduce((ys, x) => | ||
f(x).map(x => y => y.concat([x])).ap(ys), point(this.empty)) | ||
ys.map(x => y => x.concat([y])).ap(f(x)), point(this.empty)) | ||
} | ||
@@ -46,2 +46,6 @@ | ||
// comonad#extend - extract needs list to be non empty | ||
List.prototype.extend = function(f) { | ||
return this.map((x, i) => f(this.slice(0, i+1))) | ||
} | ||
@@ -77,2 +81,7 @@ | ||
// comonad#extend - extract needs to be paired with a key | ||
Map.prototype.extend = function(f) { | ||
return this.map(_value => f(this)) | ||
} | ||
module.exports = Immutable |
{ | ||
"name": "immutable-ext", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "fantasyland compatible extensions", | ||
"main": "index.js", | ||
"main": "dist/index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/npm/npm.git" | ||
}, | ||
"engines": { | ||
@@ -16,9 +20,13 @@ "node": ">=6.2.0" | ||
"devDependencies": { | ||
"immutable": "*", | ||
"babel-cli": "^6.24.1", | ||
"babel-preset-es2015": "^6.24.1", | ||
"daggy": "^0.0.1", | ||
"fantasy-identities": "^0.0.1", | ||
"immutable": "*", | ||
"mocha": "^2.4.5" | ||
}, | ||
"scripts": { | ||
"test": "mocha --watch test/**.js" | ||
"test": "mocha --watch test/**.js", | ||
"compile": "babel --presets es2015 -d dist/ ./index.js", | ||
"prepublish": "npm run compile" | ||
}, | ||
@@ -25,0 +33,0 @@ "keywords": [ |
@@ -58,2 +58,6 @@ const assert = require("assert") | ||
Identity.of(Map({a: 2, b: 3})))) | ||
it('extends the map', () =>{ | ||
assert.deepEqual(Map({a: 1, b: 2}).extend(m => m.get('a') + m.get('b')), Map({a: 3, b: 3})) | ||
}) | ||
}) | ||
@@ -90,3 +94,7 @@ | ||
assert.deepEqual(List.of(1,2,3).foldMap(x => Sum(x), Sum.empty), Sum(6))) | ||
it('extends the list', () => | ||
assert.deepEqual(List.of(1,2,3).extend(xs => xs.foldMap(x => Sum(x), Sum.empty).val), List.of(1, 3, 6)) | ||
) | ||
}) | ||
Sorry, the diff of this file is not supported yet
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
158303
8
4535
2
6