New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.1-alpha.2 to 0.1.1-alpha.4

4

package.json
{
"name": "data-footstone",
"version": "0.1.1-alpha.2",
"version": "0.1.1-alpha.4",
"description": "data structure",

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

},
"gitHead": "c9936a8ec2cd0eeae10975ef255f26dee324e5e9"
"gitHead": "cb8ba3f79ae67c1fe760393faf5b91499c1188e7"
}

@@ -5,3 +5,3 @@ # data-footstone

> 使用ts编写基本的数据结构。
> 使用 ts 编写基本的数据结构。

@@ -23,16 +23,17 @@ ### feature

```js
import {Stack} from 'data-footstone'
import { Stack } from 'data-footstone'
let s = new Stack()
s.push(1,2,3,4)
s.toArray() // [1,2,3,4]
s.pop() // 4
s.pop() // 3
s.peek() // 2
s.isEmpty() // false
s.clear() // 清空栈
s.push(1, 2, 3, 4)
s.toArray() // [1,2,3,4]
s.pop() // 4
s.pop() // 3
s.peek() // 2
s.isEmpty() // false
s.clear() // 清空栈
```
## api
详见[官网](https://lixiaodan.netlify.app/jspackages/data-footstone)
详见[官网](https://lixiaodan.netlify.app/jspackages/data-footstone)
<!-- prettier-ignore-start -->

@@ -39,0 +40,0 @@ |key|description|type|default|enum|demo|||

class FortifiedMap {
constructor() {
this.box = new Map();
}
set(k, v) {
this.box.set(k, v);
}
delete(k) {
return this.box.delete(k);
}
has(k) {
return this.box.has(k);
}
get(k) {
return this.box.get(k);
}
clear() {
return this.box = new Map();
}
size() {
return this.box.size;
}
keys() {
return this.box.keys();
}
values() {
return this.box.values();
}
getMap() {
return this.box;
}
constructor() {
this.box = new Map()
}
set(k, v) {
this.box.set(k, v)
}
delete(k) {
return this.box.delete(k)
}
has(k) {
return this.box.has(k)
}
get(k) {
return this.box.get(k)
}
clear() {
return (this.box = new Map())
}
size() {
return this.box.size
}
keys() {
return this.box.keys()
}
values() {
return this.box.values()
}
getMap() {
return this.box
}
}
export { FortifiedMap };
export { FortifiedMap }
class FortifiedSet {
constructor() {
this.box = new Set();
// this[Symbol.iterator]: a[Symbol.iterator].bind(a),
this[Symbol.iterator] = this.values();
}
// box: Set<T>
// add: (v: T) => {}
add(v) {
this.box.add(v);
}
delete(v) {
return this.box.delete(v);
}
has(v) {
return this.box.has(v);
}
clear() {
return this.box = new Set();
}
size() {
return this.box.size;
}
values() {
return this.box.values();
}
getSet() {
return this.box;
}
// // 并集
concat(...v) {
v.forEach(item => {
item.forEach(subItem => {
this.add(subItem);
});
});
return this;
}
// // 交集
intersect(...v) {
v.forEach(item => {
item.forEach(subItem => {
if (!this.has(subItem)) {
this.delete(subItem);
}
});
});
return this;
}
// // 差集
diffSet(...v) {
v.forEach(item => {
item.forEach(subItem => {
if (this.has(subItem)) {
this.delete(subItem);
}
});
});
}
// // 子集
subSetOf(v) {
return v.every(item => {
return this.has(item);
});
}
constructor() {
this.box = new Set()
// this[Symbol.iterator]: a[Symbol.iterator].bind(a),
this[Symbol.iterator] = this.values()
}
// box: Set<T>
// add: (v: T) => {}
add(v) {
this.box.add(v)
}
delete(v) {
return this.box.delete(v)
}
has(v) {
return this.box.has(v)
}
clear() {
return (this.box = new Set())
}
size() {
return this.box.size
}
values() {
return this.box.values()
}
getSet() {
return this.box
}
// // 并集
concat(...v) {
v.forEach((item) => {
item.forEach((subItem) => {
this.add(subItem)
})
})
return this
}
// // 交集
intersect(...v) {
v.forEach((item) => {
item.forEach((subItem) => {
if (!this.has(subItem)) {
this.delete(subItem)
}
})
})
return this
}
// // 差集
diffSet(...v) {
v.forEach((item) => {
item.forEach((subItem) => {
if (this.has(subItem)) {
this.delete(subItem)
}
})
})
}
// // 子集
subSetOf(v) {
return v.every((item) => {
return this.has(item)
})
}
}
export { FortifiedSet };
export { FortifiedSet }

@@ -33,3 +33,3 @@ import { Queue } from './queue';

let neibors = this.adjList.get(u);
neibors.forEach(item => {
neibors.forEach((item) => {
if (color.get(item) === 'white') {

@@ -74,3 +74,3 @@ queue.enqueue(item);

// init
this.vertices.forEach(item => {
this.vertices.forEach((item) => {
distance.set(item, 0);

@@ -82,3 +82,3 @@ predecessors.set(item, null);

let neibors = this.adjList.get(u);
neibors.forEach(item => {
neibors.forEach((item) => {
if (color.get(item) === 'white') {

@@ -96,3 +96,3 @@ queue.enqueue(item);

distance,
predecessors
predecessors,
};

@@ -99,0 +99,0 @@ }

// import * as order from './order'
import { Stack } from './stack';
import { Queue, PriorityQueue } from './queue';
import { SingleChain, DoublyChain, SingleCircleChain, DoublyCircleChain } from './chain';
import { SingleChain, DoublyChain, SingleCircleChain, DoublyCircleChain, } from './chain';
import { PSet } from './pSet';

@@ -11,2 +11,2 @@ import { PMap } from './pMap';

// ...order,
Stack, Queue, PriorityQueue, SingleChain, DoublyChain, SingleCircleChain, DoublyCircleChain, PSet, PMap, HashMap, BaseTree, BinarySearchTree, AVLTree, RedBackTree };
Stack, Queue, PriorityQueue, SingleChain, DoublyChain, SingleCircleChain, DoublyCircleChain, PSet, PMap, HashMap, BaseTree, BinarySearchTree, AVLTree, RedBackTree, };

@@ -9,2 +9,3 @@ // n^2

if (arr[j] > arr[j + 1]) {
;
[arr[j], arr[j + 1]] = [arr[j + 1], arr[j]];

@@ -15,2 +16,3 @@ }

if (arr[j] > arr[j + 1]) {
;
[arr[j], arr[j + 1]] = [arr[j + 1], arr[j]];

@@ -32,2 +34,3 @@ }

if (minIndex !== i) {
;
[arr[i], arr[minIndex]] = [arr[minIndex], arr[i]];

@@ -80,3 +83,3 @@ }

let right;
arr.forEach(item => {
arr.forEach((item) => {
if (item > p) {

@@ -89,6 +92,6 @@ right.push(item);

});
return [...(quickSort(left)), ...(quickSort(right))];
return [...quickSort(left), ...quickSort(right)];
};
let heapSort = () => { };
let binarySearch = () => { };
export { bubbleSort, selectSort, insertSort, quickSort, heapSort, binarySearch, };
export { bubbleSort, selectSort, insertSort, quickSort, heapSort, binarySearch };
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