Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deployable/node-domain-tree
Domain tree data structure
https://github.com/deployable/node-domain-tree
domains nodejs tree-structure
Last synced: 19 days ago
JSON representation
Domain tree data structure
- Host: GitHub
- URL: https://github.com/deployable/node-domain-tree
- Owner: deployable
- License: mit
- Created: 2016-11-17T02:54:13.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-07T09:15:46.000Z (almost 7 years ago)
- Last Synced: 2024-12-09T02:45:11.773Z (27 days ago)
- Topics: domains, nodejs, tree-structure
- Language: JavaScript
- Size: 88.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
## domain-tree
Store domain data in a tree structure that maintains links to parent and sub domains.
The intention is sub domains can query data for their parents and use it, if required.
### Install
npm install domain-tree
### Usage
const {DomainNames} = require('domain-tree')
let tree = new DomainNames()
tree.addDomain('me.whatever.com', { dev: true })
tree.addDomain('them.whatever.com', { dev: false })
tree.addDomain('other.com', { other: true })
console.log( tree )
console.log( JSON.stringify(tree, undefined, 2) )Results in a structure:
com:
domain: 'com'
subdomain:
whatever:
domain: 'whatever.com'
subdomain:
test:
domain: 'test.whatever.com'
_data: test: true
two:
domain: 'two.whatever.com'
_data: two: true
other:
domain: 'other.com'
_data: other: true### About
Matt Hoyle - code tata deployable.co