New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

reverse-iterable-map

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reverse-iterable-map - npm Package Compare versions

Comparing version

to
4.0.1

51

dist/cjs/reverse-iterable-map.js

@@ -93,7 +93,6 @@ "use strict";

* @returns the `ReverseIterableMapNode` object.
* @private
*/
_add(key, value) {
let node = this._map.get(key);
if (node) {
if (node !== undefined) {
node.value = value;

@@ -118,4 +117,4 @@ }

if (this._lastNode !== null) {
node.prev = this._lastNode;
this._lastNode.next = node;
node.prevNode = this._lastNode;
this._lastNode.nextNode = node;
}

@@ -139,4 +138,4 @@ this._lastNode = node;

if (this._firstNode !== null) {
node.next = this._firstNode;
this._firstNode.prev = node;
node.nextNode = this._firstNode;
this._firstNode.prevNode = node;
}

@@ -165,13 +164,13 @@ this._firstNode = node;

}
if (node.prev !== null && node.next !== null) {
node.prev.next = node.next;
node.next.prev = node.prev;
if (node.prevNode !== null && node.nextNode !== null) {
node.prevNode.nextNode = node.nextNode;
node.nextNode.prevNode = node.prevNode;
}
else if (node.prev !== null) {
node.prev.next = null;
this._lastNode = node.prev;
else if (node.prevNode !== null) {
node.prevNode.nextNode = null;
this._lastNode = node.prevNode;
}
else if (node.next !== null) {
node.next.prev = null;
this._firstNode = node.next;
else if (node.nextNode !== null) {
node.nextNode.prevNode = null;
this._firstNode = node.nextNode;
}

@@ -241,3 +240,3 @@ else {

entries() {
const getIteratorValue = node => [node.key, node.value];
const getIteratorValue = (node) => [node.key, node.value];
return this._iterableIterator(getIteratorValue);

@@ -252,3 +251,3 @@ }

keys() {
const getIteratorValue = node => node.key;
const getIteratorValue = (node) => node.key;
return this._iterableIterator(getIteratorValue);

@@ -263,3 +262,3 @@ }

values() {
const getIteratorValue = node => node.value;
const getIteratorValue = (node) => node.value;
return this._iterableIterator(getIteratorValue);

@@ -278,3 +277,3 @@ }

let startNode = this._map.get(key);
const getIteratorValue = node => [node.key, node.value];
const getIteratorValue = (node) => [node.key, node.value];
return this._iterableIterator(getIteratorValue, startNode);

@@ -305,8 +304,8 @@ }

const lastNode = this._lastNode;
let currentNode = startNode ? startNode : this._firstNode;
let nextProp = 'next';
let currentNode = startNode !== undefined ? startNode : this._firstNode;
let forwards = true;
return {
reverseIterator() {
currentNode = startNode ? startNode : lastNode;
nextProp = 'prev';
currentNode = startNode !== undefined ? startNode : lastNode;
forwards = false;
return this;

@@ -322,3 +321,3 @@ },

value = getIteratorValue(currentNode);
currentNode = currentNode[nextProp];
currentNode = forwards ? currentNode.nextNode : currentNode.prevNode;
}

@@ -344,4 +343,4 @@ return iteratorResult(value);

this.value = value;
this.prev = null;
this.next = null;
this.prevNode = null;
this.nextNode = null;
}

@@ -348,0 +347,0 @@ }

{
"name": "reverse-iterable-map",
"description": "A reverse-iterable map implementation based on the built-in Map object",
"version": "4.0.0",
"version": "4.0.1",
"repository": "kleinfreund/reverse-iterable-map",

@@ -19,2 +19,3 @@ "author": {

"scripts": {
"prepare": "npm run build",
"build": "npm run build:esm && npm run build:cjs",

@@ -21,0 +22,0 @@ "build:esm": "tsc --module es2015 --outDir dist/esm && npm run rename-to-mjs",

@@ -85,3 +85,3 @@ # reverse-iterable-map

```js
import ReverseIterableMap from 'reverse-iterable-map/dist/esm/reverse-iterable-map.mjs';
import ReverseIterableMap from 'reverse-iterable-map/dist/esm/reverse-iterable-map';

@@ -117,3 +117,3 @@ const map = new ReverseIterableMap();

```shell
```sh
npm test

@@ -654,8 +654,6 @@ ```

Let’s assume a *minor* update was made. First of all, the working directory needs to cleaned up; all changes need to be comitted and pushed.
Let’s assume a *minor* update was made. First of all, the working directory needs to cleaned up; all changes need to be comitted.
```shell
git add .
git commit -m "Implemented extremely nice feature"
git push
```sh
git commit -am "Implemented extremely nice feature"
```

@@ -665,3 +663,3 @@

```shell
```sh
npm whoami

@@ -672,3 +670,3 @@ ```

```shell
```sh
npm version minor # See `npm version --help` for more options

@@ -679,4 +677,4 @@ ```

```shell
git push --tags
```sh
git push && git push --tags
npm publish

@@ -683,0 +681,0 @@ ```

Sorry, the diff of this file is not supported yet