|
1 |
| -[js-collections](http://aureooms.github.io/js-collections) |
| 1 | +[js-collections-deque](http://aureooms.github.io/js-collections-deque) |
2 | 2 | ==
|
3 | 3 |
|
4 |
| -Collections library for JavaScript. Parent is |
| 4 | +Python's deque data structure for JavaScript. Parent is |
5 | 5 | [js-data-structures](https://github.com/aureooms/js-data-structures).
|
6 | 6 |
|
7 |
| -JavaScript version of |
8 |
| -[Python's collections library](https://docs.python.org/3.6/library/collections.html) |
9 |
| -together with |
10 |
| -[Python's heapq library](https://docs.python.org/3.6/library/heapq.html) |
11 |
| -and |
12 |
| -[Python's bisect library](https://docs.python.org/3.6/library/bisect.html). |
13 |
| - |
14 |
| -```js |
15 |
| -let { |
16 |
| - heapq , bisect , |
17 |
| - namedtuple , |
18 |
| - deque , |
19 |
| - set , |
20 |
| - dict , defaultdict , ordereddict , counter , chainmap |
21 |
| -} = collections ; |
22 |
| -``` |
23 |
| - |
24 |
| -[](https://raw.githubusercontent.com/aureooms/js-collections/master/LICENSE) |
25 |
| -[](https://www.npmjs.org/package/aureooms-js-collections) |
26 |
| -[](https://travis-ci.org/aureooms/js-collections) |
27 |
| -[](https://coveralls.io/r/aureooms/js-collections) |
28 |
| -[](https://david-dm.org/aureooms/js-collections#info=dependencies) |
29 |
| -[](https://david-dm.org/aureooms/js-collections#info=devDependencies) |
30 |
| -[](https://codeclimate.com/github/aureooms/js-collections) |
31 |
| -[](https://www.npmjs.org/package/aureooms-js-collections) |
32 |
| -[](https://github.com/aureooms/js-collections/issues) |
33 |
| -[](https://aureooms.github.io/js-collections/source.html) |
34 |
| - |
35 |
| -### Some changes w.r.t. Python's API |
36 |
| - |
37 |
| -#### `heapq` |
38 |
| - |
39 | 7 | ```js
|
40 |
| -let array = [ 2 , 1 , 3 ] ; |
41 |
| -let heap = heapq.heapify( compare.increasing , array ) ; |
42 |
| -array[0] ; // 1 |
43 |
| -heapq.heappop( heap ) ; // 1 |
44 |
| -heapq.heappop( heap ) ; // 2 |
45 |
| -heapq.heappop( heap ) ; // 3 |
46 |
| -array.length ; // 0 |
| 8 | +deque( 'abcde' , 3 ) ; // 'cde' |
47 | 9 | ```
|
48 |
| -#### `set` |
49 | 10 |
|
50 |
| -##### `set( iterable = null ) -> this` |
51 |
| -##### `set.inclusion( A , B ) -> {-1,0,1}` |
52 |
| -##### `set.prototype[Symbol.iterator]( ) -> iterable` |
53 |
| -##### `set.prototype.keys( ) -> iterable` |
54 |
| -##### `set.prototype.len( ) -> integer` |
55 |
| -##### `set.prototype.has( key ) -> boolean` |
56 |
| -##### `set.prototype.isdisjoint( other ) -> boolean` |
57 |
| -##### `set.prototype.isequal( other ) -> boolean` |
58 |
| -##### `set.prototype.issubset( other ) -> boolean` |
59 |
| -##### `set.prototype.ispropersubset( other ) -> boolean` |
60 |
| -##### `set.prototype.issuperset( other ) -> boolean` |
61 |
| -##### `set.prototype.ispropersuperset( other ) -> boolean` |
62 |
| -##### `set.prototype.union( ...others ) -> set` |
63 |
| -##### `set.prototype.intersection( ...others ) -> set` |
64 |
| -##### `set.prototype.difference( ...others ) -> set` |
65 |
| -##### `set.prototype.symmetric_difference( other ) -> set` |
66 |
| -##### `set.prototype.copy( ) -> set` |
67 |
| -##### `set.prototype.update( ...others ) -> this` |
68 |
| -##### `set.prototype.intersection_update( ...others ) -> this` |
69 |
| -##### `set.prototype.difference_update( ...others ) -> this` |
70 |
| -##### `set.prototype.symmetric_difference_update( other ) -> this` |
71 |
| -##### `set.prototype.add( key ) -> this` |
72 |
| -##### `set.prototype.remove( key ) -> this` |
73 |
| -##### `set.prototype.discard( key ) -> this` |
74 |
| -##### `set.prototype.pop( ) -> key` |
75 |
| -##### `set.prototype.clear( ) -> this` |
| 11 | +[](https://raw.githubusercontent.com/aureooms/js-collections-deque/master/LICENSE) |
| 12 | +[](https://www.npmjs.org/package/aureooms-js-collections-deque) |
| 13 | +[](https://travis-ci.org/aureooms/js-collections-deque) |
| 14 | +[](https://coveralls.io/r/aureooms/js-collections-deque) |
| 15 | +[](https://david-dm.org/aureooms/js-collections-deque#info=dependencies) |
| 16 | +[](https://david-dm.org/aureooms/js-collections-deque#info=devDependencies) |
| 17 | +[](https://codeclimate.com/github/aureooms/js-collections-deque) |
| 18 | +[](https://www.npmjs.org/package/aureooms-js-collections-deque) |
| 19 | +[](https://github.com/aureooms/js-collections-deque/issues) |
| 20 | +[](https://aureooms.github.io/js-collections-deque/source.html) |
0 commit comments