benchmarks/scenarios/ember.js
function expandProperties(pattern, callback) {
    _emberMetalDebug.assert('A computed property key must be a string', typeof pattern === 'string');
    _emberMetalDebug.assert('Brace expanded properties cannot contain spaces, e.g. "user.{firstName, lastName}" should be "user.{firstName,lastName}"', pattern.indexOf(' ') === -1);

    var parts = pattern.split(SPLIT_REGEX);
    var properties = [parts];

    for (var i = 0; i < parts.length; i++) {
      var part = parts[i];
      if (part.indexOf(',') >= 0) {
        properties = duplicateAndReplace(properties, part.split(','), i);
      }
    }

    for (var i = 0; i < properties.length; i++) {
      callback(properties[i].join('').replace(END_WITH_EACH_REGEX, '.[]'));
    }
  }
function expandProperties(pattern, callback) {
    _emberMetalDebug.assert('A computed property key must be a string', typeof pattern === 'string');
    _emberMetalDebug.assert('Brace expanded properties cannot contain spaces, e.g. "user.{firstName, lastName}" should be "user.{firstName,lastName}"', pattern.indexOf(' ') === -1);

    var parts = pattern.split(SPLIT_REGEX);
    var properties = [parts];

    for (var i = 0; i < parts.length; i++) {
      var part = parts[i];
      if (part.indexOf(',') >= 0) {
        properties = duplicateAndReplace(properties, part.split(','), i);
      }
    }

    for (var i = 0; i < properties.length; i++) {
      callback(properties[i].join('').replace(END_WITH_EACH_REGEX, '.[]'));
    }
  }
function expandProperties ( pattern , callback ) { _emberMetalDebug . assert ( 'A computed property key must be a string' , typeof pattern === 'string' ) ; _emberMetalDebug . assert ( 'Brace expanded properties cannot contain spaces, e.g. "user.{firstName, lastName}" should be "user.{firstName,lastName}"' , pattern . indexOf ( ' ' ) === - 1 ) ; var parts = pattern . split ( SPLIT_REGEX ) ; var properties = [ parts ] ; for ( var i = 0 ; i < parts . length ; i ++ ) { var part = parts [ i ] ; if ( part . indexOf ( ',' ) >= 0 ) { properties = duplicateAndReplace ( properties , part . split ( ',' ) , i ) ; } } for ( var i = 0 ; i < properties . length ; i ++ ) { callback ( properties [ i ] . join ( '' ) . replace ( END_WITH_EACH_REGEX , '.[]' ) ) ; } }
Expands `pattern`, invoking `callback` for each expansion.

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

Example

```js
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'
```

@method expandProperties
@for Ember
@private
@param {String} pattern The property pattern to expand.
@param {Function} callback The callback to invoke.  It is invoked once per
expansion, and is passed the expansion.
Expands pattern invoking callback for each expansion .