0.0.14 • Published 4 years ago

@liquicode/lib-resource-path v0.0.14

Weekly downloads
286
License
MIT
Repository
github
Last release
4 years ago

lib-resource-path (v0.0.14)


Getting Started

Install via NPM:

npm install @liquicode/lib-resource-path

Include the library in your source code:

const LibResourcePath = require( '@liquicode/lib-resource-path' );

Simple Usage

const LibResourcePath = require( '@liquicode/lib-resource-path' );

// An array defining three resource nodes.
let Resources =
[
	// Resource Path  :  Resource Value
	".hello"          : { label: 'hello', test: true },
	".hello.world"    : { label: 'world' },
	".koo.bar"        : { label: 'koo bar' },
];

// Get information about a particular resource node.
item = LibResourcePath.Select( Resources, '.hello.world' );
/*
item === {
	path: '.hello.world',
	parent: '.hello',
	name: '.world',
	info: { label: 'world' },
	exists: true,
	resource: { label: 'world', test: true },
	children: [],
}
*/

// Get information about all resources, including implied ones ('.koo') that are not defined.
items = LibResourcePath.Getall( Resources, { item_type: 'info', list_type: 'full', return_type: 'array'} );
/*
items ===
[
	{ path: '.hello', parent: '', name: '.hello', info: { label: 'hello', test: true } },
	{ path: '.hello.world', parent: '.hello', name: '.world', info: { label: 'world' } },
	{ path: '.koo', parent: '', name: '.koo', info: null },
	{ path: '.koo.bar', parent: '.koo', name: '.bar', info: { label: 'koo bar' } },
]
*/

More Links

0.0.13

4 years ago

0.0.14

4 years ago

0.0.12

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago