File tree 5 files changed +16
-22
lines changed
5 files changed +16
-22
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,12 @@ Parent is
9
9
[ js-data-structures] ( https://github.com/make-github-pseudonymous-again/js-data-structures ) .
10
10
11
11
``` js
12
- for ( let value of list ) ... ;
12
+ import { DoublyLinkedList } from ' @list-abstraction/doubly-linked-list' ;
13
+
14
+ let list = new DoublyLinkedList ( ) ;
15
+ for (const value of ' abc' ) list .push (value);
16
+
17
+ for (const value of list) ... ;
13
18
```
14
19
15
20
[ ![ License] ( https://img.shields.io/github/license/list-abstraction/doubly-linked-list.svg )] ( https://raw.githubusercontent.com/list-abstraction/doubly-linked-list/main/LICENSE )
Original file line number Diff line number Diff line change 3
3
> More examples in [ the test files] ( https://github.com/list-abstraction/doubly-linked-list/tree/main/test/src ) .
4
4
5
5
``` js
6
-
7
6
import { DoublyLinkedList as List } from ' @list-abstraction/doubly-linked-list' ;
8
7
9
8
let list = new List ( ) ;
10
9
11
- let iterators = [ for ( x of [ 0 , 1 , 2 ] ) list .push ( x ) ] ;
10
+ let iterators = [ 0 , 1 , 2 ]. map ( ( x ) => list .push ( x ) ) ;
12
11
13
- [ for ( let element of list ) element ] ; // [ 0 , 1 , 2 ]
12
+ Array . from ( list ) ; // [ 0 , 1 , 2 ]
14
13
15
14
list .erase ( iterator[1 ] ) ; // removes `1` from the list
16
15
17
- [ for ( let element of list ) element ] ; // [ 0 , 2 ]
16
+ Array . from ( list ) ; // [ 0 , 2 ]
18
17
19
18
// note that other iterators remain valid
20
19
Original file line number Diff line number Diff line change 1
1
# Usage
2
2
3
- > :warning : The code needs a ES2015+ polyfill to run (` regeneratorRuntime ` ),
4
- > for instance [ regenerator-runtime/runtime] ( https://babeljs.io/docs/usage/polyfill ) .
5
-
6
- First, require the polyfill at the entry point of your application
7
- ``` js
8
- await import ( ' regenerator-runtime/runtime.js' ) ;
9
- // or
10
- import ' regenerator-runtime/runtime.js' ;
11
- ```
12
-
13
- Then, import the library where needed
3
+ Import the library where needed
14
4
``` js
15
- const dll = await import ( ' @list-abstraction/doubly-linked-list' ) ;
5
+ const { DoublyLinkedList } = await import (' @list-abstraction/doubly-linked-list' ) ;
16
6
// or
17
- import * as dll from ' @list-abstraction/doubly-linked-list' ;
7
+ import { DoublyLinkedList } from ' @list-abstraction/doubly-linked-list' ;
18
8
```
Original file line number Diff line number Diff line change @@ -7,10 +7,10 @@ const domReady = function (callback) {
7
7
}
8
8
} ;
9
9
10
- domReady ( function ( ) {
10
+ domReady ( ( ) => {
11
11
const projectname = document . createElement ( 'a' ) ;
12
12
projectname . classList . add ( 'project-name' ) ;
13
- projectname . text = 'list-abstraction/doubly-linked-list' ;
13
+ projectname . text = '@ list-abstraction/doubly-linked-list' ;
14
14
projectname . href = './index.html' ;
15
15
16
16
const header = document . querySelector ( 'header' ) ;
@@ -25,7 +25,7 @@ domReady(function () {
25
25
const input = document . querySelector ( '.search-input' ) ;
26
26
27
27
// Active search box when focus on searchBox.
28
- input . addEventListener ( 'focus' , function ( ) {
28
+ input . addEventListener ( 'focus' , ( ) => {
29
29
searchBox . classList . add ( 'active' ) ;
30
30
} ) ;
31
31
} ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @list-abstraction/doubly-linked-list" ,
3
- "description" : " Doubly linked list code bricks for JavaScript" ,
3
+ "description" : " Doubly linked list for JavaScript" ,
4
4
"version" : " 7.0.0" ,
5
5
"license" : " AGPL-3.0" ,
6
6
"author" : " make-github-pseudonymous-again" ,
You can’t perform that action at this time.
0 commit comments