Ember.makeArray()

makeArray (obj) Arrayprivate

Defined in packages/ember-metal/lib/utils.js:370

Forces the passed object to be part of an array. If the object is already an array, it will return the object. Otherwise, it will add the object to an array. If obj is null or undefined, it will return an empty array.

Ember.makeArray();            // []
Ember.makeArray(null);        // []
Ember.makeArray(undefined);   // []
Ember.makeArray('lindsay');   // ['lindsay']
Ember.makeArray([1, 2, 42]);  // [1, 2, 42]

let controller = Ember.ArrayProxy.create({ content: [] });

Ember.makeArray(controller) === controller;  // true

Parameters:

obj Object
the object

Returns:

Array
doc_EmberJs
2016-11-30 16:51:34
Comments
Leave a Comment

Please login to continue.