Sha256: 38fcfda9026a69a28200eeb2f114cacd8229d492759f913f6c646f1a9ae28262
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
import { get } from './property_get'; /** @module @ember/object */ /** To get multiple properties at once, call `getProperties` with an object followed by a list of strings or an array: ```javascript import { getProperties } from '@ember/object'; getProperties(record, 'firstName', 'lastName', 'zipCode'); // { firstName: 'John', lastName: 'Doe', zipCode: '10011' } ``` is equivalent to: ```javascript import { getProperties } from '@ember/object'; getProperties(record, ['firstName', 'lastName', 'zipCode']); // { firstName: 'John', lastName: 'Doe', zipCode: '10011' } ``` @method getProperties @static @for @ember/object @param {Object} obj @param {String...|Array} list of keys to get @return {Object} @public */ export default function getProperties(obj) { let ret = {}; let propertyNames = arguments; let i = 1; if (arguments.length === 2 && Array.isArray(arguments[1])) { i = 0; propertyNames = arguments[1]; } for (; i < propertyNames.length; i++) { ret[propertyNames[i]] = get(obj, propertyNames[i]); } return ret; }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
discourse-ember-source-3.5.1.1 | dist/es/ember-metal/lib/get_properties.js |
discourse-ember-source-3.5.1.0 | dist/dist/es/ember-metal/lib/get_properties.js |