yallist
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Yallist is a doubly-linked list implementation in JavaScript. It is used whenever an array would be too large, and a Map needs to be iterated in reverse order. Essentially, Yallist is a data structure that allows you to store and manage data in a more dynamic way than typical arrays.
Using Yallist is straightforward. After installing the package with npm, you can import it using require('yallist')
. To create a list, you use the yallist.create()
method with an array or set of arguments. Then, you can utilize a host of methods to manipulate and interact with your list, such as push()
, unshift()
, map()
, reduce()
, and many more.
Here's a quick example that shows some basic operations:
var yallist = require('yallist')
var myList = yallist.create([1, 2, 3])
myList.push('foo')
myList.unshift('bar')
console.log(myList.toArray()) // Output: ['bar', 1, 2, 3, 'foo']
Note: The toArray()
method is used to convert the list back to an array.
The detailed and comprehensive documentation for Yallist is made available through the README file in its GitHub repository. The documentation provides information about all the methods supported by Yallist, along with usage examples and descriptions of their functionalities. This readme file acts as the official yallist documentation and provides the best and most reliable reference for using this package. You can access it at https://github.com/isaacs/yallist.