Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/junosuarez/path-trie
data structure for path-addressable resources
https://github.com/junosuarez/path-trie
Last synced: 8 days ago
JSON representation
data structure for path-addressable resources
- Host: GitHub
- URL: https://github.com/junosuarez/path-trie
- Owner: junosuarez
- License: mit
- Created: 2013-04-24T06:59:38.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-04-24T18:53:18.000Z (over 11 years ago)
- Last Synced: 2024-04-24T20:03:07.471Z (7 months ago)
- Language: JavaScript
- Size: 117 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# path-trie
data structure for path-addressable resources## usage
```javascript
var pathTrie = require('path-trie')var dictionary = {
'a/b/c': 123
}
var trie = pathTrie(dictionary)
// => {
// a: {
// b: {
// c: {
// '@': 123
// }
// }
// }
// }dictionary = pathTrie.flatten(trie)
// => {
// 'a/b/c': 123
// }```
## api
### `pathTrie: (dictionary: Dictionary) => Trie`
### `pathTrie.flatten: (trie: Trie, from: Array = []) => Dictionary`
`from` is an optional path to flatten just a particular subtrie.
### `pathTrie.put: (this: Trie, path: Path, val: Value) => Trie`
### `pathTrie.get: (this: Trie, path: Path) => Value?`
### `pathTrie.del: (this: Trie, path: Path) => void`
## installation
$ npm install path-trie
## running the tests
from project root:
$ npm install
$ npm test## contributors
- jden
## license
MIT. (c) 2013 jden . See LICENSE.md