prelude.ts
Advanced tools
Comparing version 0.7.11 to 0.7.12
@@ -735,2 +735,5 @@ "use strict"; | ||
Vector.prototype.map = function (fun) { | ||
if (this._length === 0) { | ||
return Vector.empty(); | ||
} | ||
var leafNodes = this.getLeafNodes(this._length); | ||
@@ -737,0 +740,0 @@ var newLeafNodes = []; |
@@ -30,2 +30,3 @@ "use strict"; | ||
}); | ||
it("map works on the empty vector", function () { return assert.ok(Vector_1.Vector.empty().equals(Vector_1.Vector.empty().map(function (x) { return x + 1; }))); }); | ||
it("handles init correctly on a non-empty vector", function () { return assert.deepEqual([1, 2, 3], Vector_1.Vector.of(1, 2, 3, 4).init().toArray()); }); | ||
@@ -32,0 +33,0 @@ it("handles init correctly on an empty vector", function () { return assert.deepEqual([], Vector_1.Vector.empty().init().toArray()); }); |
{ | ||
"name": "prelude.ts", | ||
"version": "0.7.11", | ||
"version": "0.7.12", | ||
"description": "A typescript functional programming library", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
@@ -821,2 +821,6 @@ import { Option } from "./Option"; | ||
map<U>(fun:(x:T)=>U): Vector<U> { | ||
if (this._length === 0) { | ||
return Vector.empty<U>(); | ||
} | ||
const leafNodes = this.getLeafNodes(this._length); | ||
@@ -823,0 +827,0 @@ const newLeafNodes: U[][] = []; |
@@ -46,2 +46,4 @@ import { Vector } from "../src/Vector"; | ||
}); | ||
it("map works on the empty vector", () => assert.ok( | ||
Vector.empty<number>().equals(Vector.empty<number>().map(x=>x+1)))); | ||
it("handles init correctly on a non-empty vector", () => assert.deepEqual( | ||
@@ -48,0 +50,0 @@ [1,2,3], Vector.of(1,2,3,4).init().toArray())); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
5722438
48449