Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@casret/dedupe

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@casret/dedupe - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

index.js

@@ -47,3 +47,3 @@ const SortedItems = Symbol("SortedItems")

const index = current_keys.findIndex(key => key == key_cache[0])
if (index) items = items.slice(0, index)
if (index > -1) items = items.slice(0, index)
key_cache = current_keys

@@ -50,0 +50,0 @@ } else {

const {SortedItems, SortedKeys, Unsorted, dedupe} = require("./index")
describe("SortedItems strategy", () => {
test("should drop any key to the right of the pivot", () => {
test("should drop any key to the right of the pivot and update key_cache", () => {
const { items, key_cache } = dedupe(SortedItems, [{id: "a"}, {id: "b"}, {id:"c"}], ["b"])

@@ -9,2 +9,13 @@ expect(items).toEqual([{id: "a"}])

})
test("should drop all keys if pivot is the key_cache", () => {
const { items, key_cache } = dedupe(SortedItems, [{id: "a"}, {id: "b"}, {id:"c"}], ["a"])
expect(items).toEqual([])
expect(key_cache).toEqual(["a"])
})
test("should keep all keys and update key_cache if pivot doesn't match", () => {
const { items, key_cache } = dedupe(SortedItems, [{id: "a"}, {id: "b"}, {id:"c"}], ["d"])
expect(items).toEqual([{id: "a"}, {id: "b"}, {id: "c"}])
expect(key_cache).toEqual(["a"])
})
})

@@ -11,0 +22,0 @@

{
"name": "@casret/dedupe",
"version": "0.0.2",
"version": "0.0.3",
"description": "Dedupe utilities for pipedream",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc