expressionjs-path v0.1.0
Path
Handles watching a scope for simple and complex paths.
For example, here are some simple expressions:
title
count > 10
isLoggedIn ? "Log out" : "Log in"
user.nameThese create a simple list of "edges":
[ 'title' ]
[ 'count' ]
[ 'isLoggedIn' ]
[ 'user', 'user.name' ]Those edges can then be used as keys to point to an accessor. You can then attach event listeners to the accessors. What's important is that, a scope has a bunch of accessors, which are stored by the edge/key above (so like { 'user.name': accessor }).
You can swap out data without having to recreate anything or modify any event listeners. This is ideal for performance. This means that a scope + accessor is a shell for data.
Here are some complex expressions where the path dynamically changes based on something inside of the [] square brackets:
user[attr.name]For these ones, if attr or attr.name changes, user[attr.name] might evaluate to a totally new property. So this Path module helps abstract this all away for you.
Install
node:
$ npm install expressionjs-pathbrowser:
$ component install expressionjs/pathLicence
MIT
11 years ago