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

@effect/data

Package Overview
Dependencies
Maintainers
3
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effect/data - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

10

MutableList.d.ts

@@ -104,3 +104,13 @@ declare const TypeId: unique symbol;

export declare const pop: <A>(self: MutableList<A>) => A | undefined;
/**
* Prepends the specified value to the beginning of the list.
*
* @since 1.0.0
* @category mutations
*/
export declare const prepend: {
<A>(value: A): (self: MutableList<A>) => MutableList<A>;
<A>(self: MutableList<A>, value: A): MutableList<A>;
};
export {};
//# sourceMappingURL=MutableList.d.ts.map

55

MutableList.js

@@ -6,3 +6,3 @@ "use strict";

});
exports.tail = exports.shift = exports.reset = exports.pop = exports.make = exports.length = exports.isEmpty = exports.head = exports.from = exports.forEach = exports.empty = exports.append = void 0;
exports.tail = exports.shift = exports.reset = exports.prepend = exports.pop = exports.make = exports.length = exports.isEmpty = exports.head = exports.from = exports.forEach = exports.empty = exports.append = void 0;
var Dual = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fp-ts/core/Function"));

@@ -37,3 +37,3 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

const value = head.value;
head = head.right;
head = head.next;
return {

@@ -73,4 +73,4 @@ done,

this.removed = false;
this.left = undefined;
this.right = undefined;
this.prev = undefined;
this.next = undefined;
}

@@ -150,3 +150,3 @@ }

f(current.value);
current = current.right;
current = current.next;
}

@@ -177,3 +177,3 @@ });

const node = new LinkedListNode(value);
if (self._length === 0) {
if (self.head === undefined) {
self.head = node;

@@ -184,4 +184,4 @@ }

} else {
self.tail.right = node;
node.left = self.tail;
self.tail.next = node;
node.prev = self.tail;
self.tail = node;

@@ -223,3 +223,24 @@ }

};
/**
* Prepends the specified value to the beginning of the list.
*
* @since 1.0.0
* @category mutations
*/
exports.pop = pop;
const prepend = /*#__PURE__*/Dual.dual(2, (self, value) => {
const node = new LinkedListNode(value);
node.next = self.head;
if (self.head !== undefined) {
self.head.prev = node;
}
self.head = node;
if (self.tail === undefined) {
self.tail = node;
}
;
self._length += 1;
return self;
});
exports.prepend = prepend;
const remove = (self, node) => {

@@ -230,11 +251,11 @@ if (node.removed) {

node.removed = true;
if (node.left !== undefined && node.right !== undefined) {
node.left.right = node.right;
node.right.left = node.left;
} else if (node.left !== undefined) {
self.tail = node.left;
node.left.right = undefined;
} else if (node.right !== undefined) {
self.head = node.right;
node.right.left = undefined;
if (node.prev !== undefined && node.next !== undefined) {
node.prev.next = node.next;
node.next.prev = node.prev;
} else if (node.prev !== undefined) {
self.tail = node.prev;
node.prev.next = undefined;
} else if (node.next !== undefined) {
self.head = node.next;
node.next.prev = undefined;
} else {

@@ -241,0 +262,0 @@ self.tail = undefined;

{
"name": "@effect/data",
"version": "0.1.0",
"version": "0.1.1",
"license": "MIT",

@@ -10,3 +10,3 @@ "repository": {

"dependencies": {
"@fp-ts/core": "~0.2.0"
"@fp-ts/core": "~0.2.1"
},

@@ -13,0 +13,0 @@ "main": "./index.js",

@@ -48,3 +48,3 @@ /**

const value = head.value
head = head.right
head = head.next
return { done, value }

@@ -80,4 +80,4 @@ },

removed = false
left: LinkedListNode<T> | undefined = undefined
right: LinkedListNode<T> | undefined = undefined
prev: LinkedListNode<T> | undefined = undefined
next: LinkedListNode<T> | undefined = undefined
constructor(readonly value: T) {}

@@ -164,3 +164,3 @@ }

f(current.value)
current = current.right
current = current.next
}

@@ -196,3 +196,3 @@ })

const node = new LinkedListNode(value)
if ((self as MutableListImpl<A>)._length === 0) {
if (self.head === undefined) {
self.head = node

@@ -203,4 +203,4 @@ }

} else {
self.tail.right = node
node.left = self.tail
self.tail.next = node
node.prev = self.tail
self.tail = node

@@ -242,2 +242,28 @@ }

/**
* Prepends the specified value to the beginning of the list.
*
* @since 1.0.0
* @category mutations
*/
export const prepend: {
<A>(value: A): (self: MutableList<A>) => MutableList<A>
<A>(self: MutableList<A>, value: A): MutableList<A>
} = Dual.dual<
<A>(value: A) => (self: MutableList<A>) => MutableList<A>,
<A>(self: MutableList<A>, value: A) => MutableList<A>
>(2, <A>(self: MutableList<A>, value: A) => {
const node = new LinkedListNode(value)
node.next = self.head
if (self.head !== undefined) {
self.head.prev = node
}
self.head = node
if (self.tail === undefined) {
self.tail = node
}
;(self as MutableListImpl<A>)._length += 1
return self
})
const remove = <A>(self: MutableList<A>, node: LinkedListNode<A>): void => {

@@ -248,11 +274,11 @@ if (node.removed) {

node.removed = true
if (node.left !== undefined && node.right !== undefined) {
node.left.right = node.right
node.right.left = node.left
} else if (node.left !== undefined) {
self.tail = node.left
node.left.right = undefined
} else if (node.right !== undefined) {
self.head = node.right
node.right.left = undefined
if (node.prev !== undefined && node.next !== undefined) {
node.prev.next = node.next
node.next.prev = node.prev
} else if (node.prev !== undefined) {
self.tail = node.prev
node.prev.next = undefined
} else if (node.next !== undefined) {
self.head = node.next
node.next.prev = undefined
} else {

@@ -259,0 +285,0 @@ self.tail = undefined

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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