@casret/dedupe
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -15,3 +15,5 @@ const Strategies = { | ||
function dedupe(items, opts) { | ||
const strategy = opts.strategy || Strategies.SortedItems | ||
// If the strategy passed in null (which is easy if use a bad key on Strategies) | ||
// then we should raise instead of defaulting | ||
const strategy = ('strategy' in opts) ? opts.strategy : Strategies.SortedItems | ||
if (strategy !== Strategies.SortedItems && | ||
@@ -18,0 +20,0 @@ strategy !== Strategies.SortedKeys && |
@@ -65,1 +65,5 @@ const {Strategies, dedupe} = require("./index") | ||
}) | ||
test("Should throw an exception if you use a bad strategy", () => { | ||
expect(() => dedupe([], {strategy: Strategies.NoSuchStrategy})).toThrow() | ||
}) |
{ | ||
"name": "@casret/dedupe", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Dedupe utilities for pipedream", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
10699
173