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

data-footstone

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-footstone - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

dist_cjs/store.js

5

dist_cjs/chain.js

@@ -106,2 +106,4 @@ 'use strict';

}
this.length++;
return this.length;
}

@@ -263,2 +265,3 @@ // 不允许插入到最后一个

this.length++;
return this.length;
}

@@ -421,2 +424,3 @@ insert(v, p) {

this.length++;
return this.length;
}

@@ -521,2 +525,3 @@ // 允许的范围 [0, length)

this.length++;
return this.length;
}

@@ -523,0 +528,0 @@ insert(v, p) {

3

dist_cjs/index.js

@@ -11,2 +11,3 @@ 'use strict';

var order = require('./order.js');
var store = require('./store.js');

@@ -32,2 +33,4 @@

exports.order = order;
exports.Fifo = store.Fifo;
exports.Lru = store.Lru;
//# sourceMappingURL=index.js.map

@@ -104,2 +104,4 @@ class BaseChain {

}
this.length++;
return this.length;
}

@@ -261,2 +263,3 @@ // 不允许插入到最后一个

this.length++;
return this.length;
}

@@ -419,2 +422,3 @@ insert(v, p) {

this.length++;
return this.length;
}

@@ -519,2 +523,3 @@ // 允许的范围 [0, length)

this.length++;
return this.length;
}

@@ -521,0 +526,0 @@ insert(v, p) {

@@ -10,2 +10,3 @@ export { Stack } from './stack.js';

export { order };
export { Fifo, Lru } from './store.js';
//# sourceMappingURL=index.js.map

4

package.json
{
"name": "data-footstone",
"version": "0.1.4",
"version": "0.1.5",
"description": "data structure",

@@ -75,3 +75,3 @@ "author": "feigebaobei <18515195415@163.com>",

},
"gitHead": "7172a7b54aee94be2bde392cf11b2c3defeb730f"
"gitHead": "cadedc5eac625073a17f9e6809da2f2789ec75bb"
}

@@ -104,2 +104,4 @@ class BaseChain {

}
this.length++;
return this.length;
}

@@ -261,2 +263,3 @@ // 不允许插入到最后一个

this.length++;
return this.length;
}

@@ -419,2 +422,3 @@ insert(v, p) {

this.length++;
return this.length;
}

@@ -519,2 +523,3 @@ // 允许的范围 [0, length)

this.length++;
return this.length;
}

@@ -521,0 +526,0 @@ insert(v, p) {

@@ -9,2 +9,3 @@ import { Stack } from './stack';

import * as order from './order';
export { order, Stack, Queue, PriorityQueue, SingleChain, DoublyChain, SingleCircleChain, DoublyCircleChain, PSet, PMap, HashMap, djb2HashFn, loseloseHashFn, BaseTree, BinarySearchTree, AVLTree, RedBackTree, };
import { Lru, Fifo } from './store';
export { Stack, Queue, PriorityQueue, SingleChain, DoublyChain, SingleCircleChain, DoublyCircleChain, PSet, PMap, HashMap, djb2HashFn, loseloseHashFn, BaseTree, BinarySearchTree, AVLTree, RedBackTree, order, Lru, Fifo, };
// 存储
import { DoublyChain } from './chain';
import { SingleChain, DoublyChain } from './chain';
// import { Queue } from './queue'
// 未测试完

@@ -44,4 +45,58 @@ class Cache {

}
// fifo 不开发,请使用队列。
// 日后可再扩展
// fifo
// 先进先出
// 这个写法可以证明链与队列是一样的。
class Fifo {
// 参数可以考虑兼容 number / {capacity: number}
constructor(capacity) {
this.capacity = capacity;
this.chain = new SingleChain();
}
_createNode(k, v) {
return {
key: k,
value: v,
};
}
get(k) {
let cur = this.chain.head;
let res = undefined;
while (cur) {
if (cur.value.key === k) {
res = cur.value.value;
break;
}
cur = cur.next;
}
return res;
}
put(k, v) {
this.chain.append(this._createNode(k, v));
while (this.chain.length > this.capacity) {
this.chain.removeAt(0);
}
return this.chain.length;
}
size() {
return this.chain.length;
}
keys() {
let res = [];
let cur = this.chain.head;
while (cur) {
res.push(cur.value.key);
cur = cur.next;
}
return res;
}
values() {
let res = [];
let cur = this.chain.head;
while (cur) {
res.push(cur.value.value);
cur = cur.next;
}
return res;
}
}
// 最近最少使用算法

@@ -104,4 +159,4 @@ // 如果数据最近被访问过,那么将来被访问的几率也更高

// Cache,
Lru,
Fifo, Lru,
// Lfu
};

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