source: trip-planner-front/node_modules/object.pick/index.js@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 630 bytes
Line 
1/*!
2 * object.pick <https://github.com/jonschlinkert/object.pick>
3 *
4 * Copyright (c) 2014-2015 Jon Schlinkert, contributors.
5 * Licensed under the MIT License
6 */
7
8'use strict';
9
10var isObject = require('isobject');
11
12module.exports = function pick(obj, keys) {
13 if (!isObject(obj) && typeof obj !== 'function') {
14 return {};
15 }
16
17 var res = {};
18 if (typeof keys === 'string') {
19 if (keys in obj) {
20 res[keys] = obj[keys];
21 }
22 return res;
23 }
24
25 var len = keys.length;
26 var idx = -1;
27
28 while (++idx < len) {
29 var key = keys[idx];
30 if (key in obj) {
31 res[key] = obj[key];
32 }
33 }
34 return res;
35};
Note: See TracBrowser for help on using the repository browser.