Ember.expandProperties()

expandProperties (pattern, callback) private

Defined in packages/ember-metal/lib/expand_properties.js:11

Expands pattern, invoking callback for each expansion.

The only pattern supported is brace-expansion, anything else will be passed once to callback directly.

Example

function echo(arg){ console.log(arg); }

Ember.expandProperties('foo.bar', echo);              //=> 'foo.bar'
Ember.expandProperties('{foo,bar}', echo);            //=> 'foo', 'bar'
Ember.expandProperties('foo.{bar,baz}', echo);        //=> 'foo.bar', 'foo.baz'
Ember.expandProperties('{foo,bar}.baz', echo);        //=> 'foo.baz', 'bar.baz'
Ember.expandProperties('foo.{bar,baz}.[]', echo)      //=> 'foo.bar.[]', 'foo.baz.[]'
Ember.expandProperties('{foo,bar}.{spam,eggs}', echo) //=> 'foo.spam', 'foo.eggs', 'bar.spam', 'bar.eggs'
Ember.expandProperties('{foo}.bar.{baz}')             //=> 'foo.bar.baz'

Parameters:

pattern String
The property pattern to expand.
callback Function
The callback to invoke. It is invoked once per expansion, and is passed the expansion.
doc_EmberJs
2016-11-30 16:51:25
Comments
Leave a Comment

Please login to continue.