Socket
Socket
Sign inDemoInstall

pessimism

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pessimism - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

27

dist/pessimism.es.js

@@ -120,12 +120,12 @@ function __(e, r) {

for (;;) {
var n = t, c = r, o = e, u = mask(i, c);
var n = t, c = r, o = e, u = mask(i, n);
if (!o) {
return n;
return c;
}
var v = o[1], s = o[0];
if (0 !== n[0]) {
var f = copyIndex(s, a);
f[1][indexBit(f[0], u)] = __(0, [ n ]), t = f, r = c - 1 | 0, e = v;
if (0 !== c[0]) {
var f = copyIndex(s, a), d = indexBit(f[0], u);
f[1][d] = __(0, [ c ]), t = n - 1 | 0, r = f, e = v;
} else {
t = removeFromIndex(s, u, a), r = c - 1 | 0, e = v;
t = n - 1 | 0, r = removeFromIndex(s, u, a), e = v;
}

@@ -240,4 +240,3 @@ }

case 0:
var k = m[0];
c = o + 1 | 0, n = k, a = [ k, v ];
c = o + 1 | 0, n = m[0], a = [ u, v ];
continue;

@@ -255,8 +254,8 @@

if (m[1] === i) {
var p = removeFromBucket(m[0], r);
if (0 === p.length) {
return rebuildWithStack(v, o - 1 | 0, removeFromIndex(u, d, t), i, t);
var k = removeFromBucket(m[0], r);
if (0 === k.length) {
return rebuildWithStack(v, removeFromIndex(u, d, t), o - 1 | 0, i, t);
}
var x = copyIndex(u, t);
return x[1][_] = __(3, [ p, i ]), rebuildWithStack(v, o - 1 | 0, x, i, t);
var p = copyIndex(u, t);
return p[1][_] = __(3, [ k, i ]), rebuildWithStack(v, p, o - 1 | 0, i, t);
}

@@ -269,3 +268,3 @@ return e;

if (1 === h) {
return l === r ? rebuildWithStack(v, o - 1 | 0, removeFromIndex(u, d, t), i, t) : e;
return l === r ? rebuildWithStack(v, removeFromIndex(u, d, t), o - 1 | 0, i, t) : e;
}

@@ -272,0 +271,0 @@ }

@@ -122,12 +122,12 @@ "use strict";

for (;;) {
var n = t, o = r, c = e, s = mask(i, o);
var n = t, o = r, c = e, s = mask(i, n);
if (!c) {
return n;
return o;
}
var u = c[1], v = c[0];
if (0 !== n[0]) {
var f = copyIndex(v, a);
f[1][indexBit(f[0], s)] = __(0, [ n ]), t = f, r = o - 1 | 0, e = u;
if (0 !== o[0]) {
var f = copyIndex(v, a), d = indexBit(f[0], s);
f[1][d] = __(0, [ o ]), t = n - 1 | 0, r = f, e = u;
} else {
t = removeFromIndex(v, s, a), r = o - 1 | 0, e = u;
t = n - 1 | 0, r = removeFromIndex(v, s, a), e = u;
}

@@ -251,4 +251,3 @@ }

case 0:
var x = m[0];
o = c + 1 | 0, n = x, a = [ x, u ];
o = c + 1 | 0, n = m[0], a = [ s, u ];
continue;

@@ -266,8 +265,8 @@

if (m[1] === i) {
var h = removeFromBucket(m[0], r);
if (0 === h.length) {
return rebuildWithStack(u, c - 1 | 0, removeFromIndex(s, d, t), i, t);
var x = removeFromBucket(m[0], r);
if (0 === x.length) {
return rebuildWithStack(u, removeFromIndex(s, d, t), c - 1 | 0, i, t);
}
var k = copyIndex(s, t);
return k[1][_] = __(3, [ h, i ]), rebuildWithStack(u, c - 1 | 0, k, i, t);
var h = copyIndex(s, t);
return h[1][_] = __(3, [ x, i ]), rebuildWithStack(u, h, c - 1 | 0, i, t);
}

@@ -280,3 +279,3 @@ return e;

if (1 === p) {
return l === r ? rebuildWithStack(u, c - 1 | 0, removeFromIndex(s, d, t), i, t) : e;
return l === r ? rebuildWithStack(u, removeFromIndex(s, d, t), c - 1 | 0, i, t) : e;
}

@@ -283,0 +282,0 @@ }

@@ -9,2 +9,6 @@ 'use strict';

var ca = "coest";
var cb = "01pcj";
Jest.test("works for values on a single Index node", (function (param) {

@@ -25,2 +29,15 @@ var words = /* array */[

Jest.test("works for values on nested Index nodes", (function (param) {
var map = Pessimism.set(Pessimism.set(Pessimism.make(/* () */0), ca, ca), cb, cb);
var expected = /* array */[
ca,
cb
];
var actual = /* array */[
Pessimism.get(map, ca),
Pessimism.get(map, cb)
];
return Curry._2(Jest.Expect[/* Operators */25][/* = */5], Jest.Expect[/* expect */0](actual), expected);
}));
Jest.test("works for values that are colliding", (function (param) {

@@ -84,2 +101,15 @@ var words = /* array */[

Jest.test("deleted values correctly on nested Index nodes", (function (param) {
var map = Pessimism.remove(Pessimism.set(Pessimism.set(Pessimism.make(/* () */0), ca, ca), cb, cb), ca);
var expected = /* array */[
undefined,
cb
];
var actual = /* array */[
Pessimism.get(map, ca),
Pessimism.get(map, cb)
];
return Curry._2(Jest.Expect[/* Operators */25][/* = */5], Jest.Expect[/* expect */0](actual), expected);
}));
Jest.test("sets optimistic values and clears them", (function (param) {

@@ -135,2 +165,4 @@ var map = Pessimism.setOptimistic(Pessimism.set(Pessimism.make(/* () */0), "key", "permanent"), "key", "temporary", 1);

exports.it = it;
exports.ca = ca;
exports.cb = cb;
/* Not a pure module */

@@ -241,6 +241,6 @@ 'use strict';

function rebuildWithStack(_stack, _depth, _innerIndex, code, owner) {
function rebuildWithStack(_stack, _innerIndex, _depth, code, owner) {
while(true) {
var depth = _depth;
var innerIndex = _innerIndex;
var depth = _depth;
var stack = _stack;

@@ -253,4 +253,4 @@ var pos = mask(code, depth);

var index$1 = removeFromIndex(index, pos, owner);
_depth = depth - 1 | 0;
_innerIndex = index$1;
_depth = depth - 1 | 0;
_stack = rest;

@@ -260,5 +260,6 @@ continue ;

var index$2 = copyIndex(index, owner);
index$2[/* contents */1][indexBit(index$2[/* bitmap */0], pos)] = /* Index */Block.__(0, [innerIndex]);
var i = indexBit(index$2[/* bitmap */0], pos);
index$2[/* contents */1][i] = /* Index */Block.__(0, [innerIndex]);
_depth = depth - 1 | 0;
_innerIndex = index$2;
_depth = depth - 1 | 0;
_stack = rest;

@@ -566,7 +567,6 @@ continue ;

case 0 :
var index$1 = child[0];
_depth = depth + 1 | 0;
_index = index$1;
_index = child[0];
_stack = /* :: */[
index$1,
index,
stack

@@ -587,11 +587,11 @@ ];

if (bucket.length === 0) {
var index$2 = removeFromIndex(index, pos, owner);
return rebuildWithStack(stack, depth - 1 | 0, index$2, code, owner);
var index$1 = removeFromIndex(index, pos, owner);
return rebuildWithStack(stack, index$1, depth - 1 | 0, code, owner);
} else {
var index$3 = copyIndex(index, owner);
index$3[/* contents */1][i] = /* Collision */Block.__(3, [
var index$2 = copyIndex(index, owner);
index$2[/* contents */1][i] = /* Collision */Block.__(3, [
bucket,
code
]);
return rebuildWithStack(stack, depth - 1 | 0, index$3, code, owner);
return rebuildWithStack(stack, index$2, depth - 1 | 0, code, owner);
}

@@ -607,4 +607,4 @@ } else {

if (k === key) {
var index$4 = removeFromIndex(index, pos, owner);
return rebuildWithStack(stack, depth - 1 | 0, index$4, code, owner);
var index$3 = removeFromIndex(index, pos, owner);
return rebuildWithStack(stack, index$3, depth - 1 | 0, code, owner);
} else {

@@ -611,0 +611,0 @@ return map;

{
"name": "pessimism",
"description": "A fast HAMT Map intended for KV caching and optimistic updates",
"version": "1.1.3",
"version": "1.1.4",
"author": "Phil Pluckthun <phil@kitten.sh>",

@@ -6,0 +6,0 @@ "source": "./src/index.js",

@@ -241,6 +241,6 @@

function rebuildWithStack(_stack, _depth, _innerIndex, code, owner) {
function rebuildWithStack(_stack, _innerIndex, _depth, code, owner) {
while(true) {
var depth = _depth;
var innerIndex = _innerIndex;
var depth = _depth;
var stack = _stack;

@@ -253,4 +253,4 @@ var pos = mask(code, depth);

var index$1 = removeFromIndex(index, pos, owner);
_depth = depth - 1 | 0;
_innerIndex = index$1;
_depth = depth - 1 | 0;
_stack = rest;

@@ -260,5 +260,6 @@ continue ;

var index$2 = copyIndex(index, owner);
index$2[/* contents */1][indexBit(index$2[/* bitmap */0], pos)] = /* Index */Block.__(0, [innerIndex]);
var i = indexBit(index$2[/* bitmap */0], pos);
index$2[/* contents */1][i] = /* Index */Block.__(0, [innerIndex]);
_depth = depth - 1 | 0;
_innerIndex = index$2;
_depth = depth - 1 | 0;
_stack = rest;

@@ -566,7 +567,6 @@ continue ;

case 0 :
var index$1 = child[0];
_depth = depth + 1 | 0;
_index = index$1;
_index = child[0];
_stack = /* :: */[
index$1,
index,
stack

@@ -587,11 +587,11 @@ ];

if (bucket.length === 0) {
var index$2 = removeFromIndex(index, pos, owner);
return rebuildWithStack(stack, depth - 1 | 0, index$2, code, owner);
var index$1 = removeFromIndex(index, pos, owner);
return rebuildWithStack(stack, index$1, depth - 1 | 0, code, owner);
} else {
var index$3 = copyIndex(index, owner);
index$3[/* contents */1][i] = /* Collision */Block.__(3, [
var index$2 = copyIndex(index, owner);
index$2[/* contents */1][i] = /* Collision */Block.__(3, [
bucket,
code
]);
return rebuildWithStack(stack, depth - 1 | 0, index$3, code, owner);
return rebuildWithStack(stack, index$2, depth - 1 | 0, code, owner);
}

@@ -607,4 +607,4 @@ } else {

if (k === key) {
var index$4 = removeFromIndex(index, pos, owner);
return rebuildWithStack(stack, depth - 1 | 0, index$4, code, owner);
var index$3 = removeFromIndex(index, pos, owner);
return rebuildWithStack(stack, index$3, depth - 1 | 0, code, owner);
} else {

@@ -611,0 +611,0 @@ return map;

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