property-resolver
TypeScript icon, indicating that this package has built-in type declarations

0.0.11 • Public • Published

PropertyResolver

Build Status

A simple class for allowing string based property resolving on models, like so:

var PropertyResolver = require("property-resolver").PropertyResolver;
 
var someObject = {
    someArray: [
        { someObject: [
                { value: 1 }
            ]}
    ]
};
 
var propertyResolver = new PropertyResolver();
var value = propertyResolver.resolveProperty(someObject, "someArray[0].someObject[0].value");
// value is 1

Usage

It is exported using UMD for browsers (dist/browser) and CommonJS for node/modules so if you want it that way just do a normal require:

var PropertyResolver = require("property-resolver").PropertyResolver;

or if you want to use it in the browser it will self register the PropertyResolver global.

Either way you will need to new up an instance of it to use it.

/property-resolver/

    Package Sidebar

    Install

    npm i property-resolver

    Weekly Downloads

    367

    Version

    0.0.11

    License

    none

    Last publish

    Collaborators

    • grofit