functools-ts
Advanced tools
Comparing version 0.0.24 to 0.0.25
@@ -16,3 +16,4 @@ import { F1 } from "./function"; | ||
isList: <A>(maybeList: any) => maybeList is ReadonlyArray<A>; | ||
remove: <A>(list: ReadonlyArray<A>, itemToRemove: A) => ReadonlyArray<A>; | ||
}; | ||
export {}; |
@@ -38,4 +38,7 @@ var match = function (selector, item, index, list) { | ||
}, | ||
isList: function (maybeList) { return Array.isArray(maybeList); } | ||
isList: function (maybeList) { return Array.isArray(maybeList); }, | ||
remove: function (list, itemToRemove) { | ||
return list.filter(function (item) { return item !== itemToRemove; }); | ||
} | ||
}; | ||
//# sourceMappingURL=list.js.map |
@@ -10,3 +10,3 @@ { | ||
"typings": "dist/index.d.ts", | ||
"version": "0.0.24", | ||
"version": "0.0.25", | ||
"repository": "git@bitbucket.org:chaaba_j/ts-functools.git", | ||
@@ -13,0 +13,0 @@ "author": "Jalal Chaabane", |
@@ -61,3 +61,5 @@ import { F1 } from "./function" | ||
isList: <A>(maybeList: any): maybeList is List<A> => Array.isArray(maybeList) | ||
isList: <A>(maybeList: any): maybeList is List<A> => Array.isArray(maybeList), | ||
remove: <A>(list: List<A>, itemToRemove: A): List<A> => | ||
list.filter(item => item !== itemToRemove) | ||
} |
@@ -24,2 +24,11 @@ import { List } from "../src/list"; | ||
}) | ||
it("should remove an item", () => { | ||
const firstItem = items[0] | ||
expect(List.remove(items, firstItem)).to.eql(items.slice(1)) | ||
}) | ||
it("should not remove if not found", () => { | ||
expect(List.remove(items, null)).to.eql(items) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
115739
2551