aboutsummaryrefslogtreecommitdiff
path: root/node_modules/only/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/only/index.js')
-rw-r--r--node_modules/only/index.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/node_modules/only/index.js b/node_modules/only/index.js
new file mode 100644
index 00000000..1cbeda95
--- /dev/null
+++ b/node_modules/only/index.js
@@ -0,0 +1,10 @@
+
+module.exports = function(obj, keys){
+ obj = obj || {};
+ if ('string' == typeof keys) keys = keys.split(/ +/);
+ return keys.reduce(function(ret, key){
+ if (null == obj[key]) return ret;
+ ret[key] = obj[key];
+ return ret;
+ }, {});
+};