trie-search
Advanced tools
Comparing version 1.3.5 to 1.3.6
@@ -6,3 +6,3 @@ { | ||
"description": "A trie implementation that maps keys to objects for rapid retrieval by phrases. Most common use will be for typeahead searches.", | ||
"version": "1.3.5", | ||
"version": "1.3.6", | ||
"main": "index.js", | ||
@@ -24,6 +24,3 @@ "url": "https://github.com/joshjung/trie-search", | ||
"src", | ||
"test", | ||
"index.js", | ||
"performance.js", | ||
"dictionary.json" | ||
"index.js" | ||
], | ||
@@ -30,0 +27,0 @@ "keywords": [ |
@@ -38,3 +38,3 @@ ![](https://nodei.co/npm/trie-search.png?downloads=True&stars=True) | ||
trie.map('hello', 'world'); // Map 'hello' to the String 'world' | ||
trie.map('here', 'is a trie search'); // Map 'hello' to the String 'world' | ||
trie.map('here', 'is a trie search'); // Map 'here' to the String 'is a trie search' | ||
@@ -54,3 +54,3 @@ trie.search('he'); // ['world', 'is a trie search] | ||
trie.map('hello', 'world'); // Map 'hello' to the String 'world' | ||
trie.map('here', 'is a trie search'); // Map 'hello' to the String 'world' | ||
trie.map('here', 'is a trie search'); // Map 'here' to the String 'is a trie search' | ||
@@ -111,4 +111,3 @@ trie.search('he'); // ['world', 'is a trie search] | ||
Essentially, the Trie is like a single hashmap of *keys* to one or more *value objects*. You can add any number of | ||
keys mapping to any number of objects. A key can map to many objects (for example the word 'Josh' might map to many user objects) and many keys can map to the same object (for example 'Josh' and 'Jung' might map to the same user object). When retrieving (`get('hello')`) by an input string, the Trie returns an Array of all objects that have keys that begin with the entered key (e.g. `'hello'`). | ||
Essentially, the Trie is like a single hashmap of *keys* to one or more *value objects*. You can add any number of keys mapping to any number of objects. A key can map to many objects (for example the word 'Josh' might map to many user objects) and many keys can map to the same object (for example 'Josh' and 'Jung' might map to the same user object). When retrieving (`get('hello')`) by an input string, the Trie returns an Array of all objects that have keys that begin with the entered key (e.g. `'hello'`). | ||
@@ -177,4 +176,4 @@ Internally the Trie creates a tree of hashmaps for efficiency. Each hashmap is either a map between a single character in the added keys and an array of matching objects (for a leaf node) or another hashmap that is the next character in all available keys or the hash does not contain the character (no keys exist that match the requested string). This complexity is managed for you. | ||
trie.search('and'); // Returns all 3 items above that begin with 'and' | ||
trie.search('andr'); // Returns all 2 items above that begin with 'andr' | ||
trie.search('andre'); // Returns all 2 items above that begin with 'andr' | ||
trie.search('andr'); // Returns the 2 items above that begin with 'andr' | ||
trie.search('andre'); // Returns the 2 items above that begin with 'andr' | ||
trie.search('andrew'); // Returns only andrew. | ||
@@ -281,7 +280,7 @@ ``` | ||
trie.search('a'); // Returns empty array, too short of search | ||
trie.search('an'); // Returns empty array, too short of search | ||
trie.search('a'); // Returns empty array, too short a search (< 3 minimum chars) | ||
trie.search('an'); // Returns empty array, too short a search | ||
trie.search('and'); // Returns all 3 items above that begin with 'and' | ||
trie.search('andr'); // Returns all 2 items above that begin with 'andr' | ||
trie.search('andre'); // Returns all 2 items above that begin with 'andr' | ||
trie.search('andr'); // Returns the 2 items above that begin with 'andr' | ||
trie.search('andre'); // Returns the 2 items above that begin with 'andr' | ||
trie.search('andrew'); // Returns only andrew. | ||
@@ -314,3 +313,3 @@ ``` | ||
trie.search('andrew'); // Returns all items | ||
trie.search('andrew sweden'); // Returns only andrew in sweden, and only once, even though it matches both 'andrew' and 'sweden'. | ||
trie.search('andrew sweden'); // Returns only the andrew who is in sweden, and only once, even though it matches both 'andrew' and 'sweden'. | ||
``` | ||
@@ -317,0 +316,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
27292
4
317
397
1