@liquicode/lib-resource-path

0.0.14 • Public • Published

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

Package Sidebar

Install

npm i @liquicode/lib-resource-path

Weekly Downloads

0

Version

0.0.14

License

MIT

Unpacked Size

162 kB

Total Files

42

Last publish

Collaborators

  • agbowlin