pick.js 461 B

12345678910111213141516
  1. import each from './each';
  2. import isPlainObject from './is-plain-object';
  3. var hasOwnProperty = Object.prototype.hasOwnProperty;
  4. export default (function (object, keys) {
  5. if (object === null || !isPlainObject(object)) {
  6. return {};
  7. }
  8. var result = {};
  9. each(keys, function (key) {
  10. if (hasOwnProperty.call(object, key)) {
  11. result[key] = object[key];
  12. }
  13. });
  14. return result;
  15. });
  16. //# sourceMappingURL=pick.js.map