Ember.literal helper for disambiguating between property keys and string literals in computed properties
MIT License
This README outlines the details of collaborating on this Ember addon.
literal
is a way of disambiguating between literals and property keys when using computed properties.
import l from 'ember-literal/macros/literal';
import among from 'ember-cpm/macros/among'; // from the wonderful ember-cpm library
var and = Ember.computed.and;
var MyOtherType = Ember.Object.extend({
isServerReady: false,
userInput: 'ready',
ready: and('isUserReady', 'isServerReady'),
isUserReady: among( // NOTE: among doesn't have composed macro support, but it soon will!
'userInput' // property key
l('ready'), // literal (this would otherwise be ambiguious without using "literal")
l('good'), // literal
l('fine'), // literal
l('satisfactory'), // literal
l('rad') // literal
)
});
You can use literal
in your project two ways
Ember
namespaceEmber.literal
import literal from 'ember-literal/macros/literal';
Tagged releases are automatically uploaded to a CDN for light development use. Do not rely on these for production
Examples:
git clone
this repositorynpm install
bower install
ember server
ember test
ember test --server
ember build