File tree Expand file tree Collapse file tree 5 files changed +16
-22
lines changed
Expand file tree Collapse file tree 5 files changed +16
-22
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,12 @@ Parent is
99[ js-data-structures] ( https://github.com/make-github-pseudonymous-again/js-data-structures ) .
1010
1111``` 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) ... ;
1318```
1419
1520[ ![ 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 33> More examples in [ the test files] ( https://github.com/list-abstraction/doubly-linked-list/tree/main/test/src ) .
44
55``` js
6-
76import { DoublyLinkedList as List } from ' @list-abstraction/doubly-linked-list' ;
87
98let list = new List ( ) ;
109
11- let iterators = [ for ( x of [ 0 , 1 , 2 ] ) list .push ( x ) ] ;
10+ let iterators = [ 0 , 1 , 2 ]. map ( ( x ) => list .push ( x ) ) ;
1211
13- [ for ( let element of list ) element ] ; // [ 0 , 1 , 2 ]
12+ Array . from ( list ) ; // [ 0 , 1 , 2 ]
1413
1514list .erase ( iterator[1 ] ) ; // removes `1` from the list
1615
17- [ for ( let element of list ) element ] ; // [ 0 , 2 ]
16+ Array . from ( list ) ; // [ 0 , 2 ]
1817
1918// note that other iterators remain valid
2019
Original file line number Diff line number Diff line change 11# Usage
22
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
144``` js
15- const dll = await import ( ' @list-abstraction/doubly-linked-list' ) ;
5+ const { DoublyLinkedList } = await import (' @list-abstraction/doubly-linked-list' ) ;
166// or
17- import * as dll from ' @list-abstraction/doubly-linked-list' ;
7+ import { DoublyLinkedList } from ' @list-abstraction/doubly-linked-list' ;
188```
Original file line number Diff line number Diff line change @@ -7,10 +7,10 @@ const domReady = function (callback) {
77 }
88} ;
99
10- domReady ( function ( ) {
10+ domReady ( ( ) => {
1111 const projectname = document . createElement ( 'a' ) ;
1212 projectname . classList . add ( 'project-name' ) ;
13- projectname . text = 'list-abstraction/doubly-linked-list' ;
13+ projectname . text = '@ list-abstraction/doubly-linked-list' ;
1414 projectname . href = './index.html' ;
1515
1616 const header = document . querySelector ( 'header' ) ;
@@ -25,7 +25,7 @@ domReady(function () {
2525 const input = document . querySelector ( '.search-input' ) ;
2626
2727 // Active search box when focus on searchBox.
28- input . addEventListener ( 'focus' , function ( ) {
28+ input . addEventListener ( 'focus' , ( ) => {
2929 searchBox . classList . add ( 'active' ) ;
3030 } ) ;
3131} ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @list-abstraction/doubly-linked-list" ,
3- "description" : " Doubly linked list code bricks for JavaScript" ,
3+ "description" : " Doubly linked list for JavaScript" ,
44 "version" : " 7.0.0" ,
55 "license" : " AGPL-3.0" ,
66 "author" : " make-github-pseudonymous-again" ,
You can’t perform that action at this time.
0 commit comments