Browse Source

Bumped version to 1.0.2

Jannick Knudsen 5 năm trước cách đây
mục cha
commit
7008391a00
4 tập tin đã thay đổi với 14 bổ sung4 xóa
  1. 1 1
      VERSION
  2. 1 0
      VERSIONLOG
  3. 11 2
      index.js
  4. 1 1
      package.json

+ 1 - 1
VERSION

@@ -1 +1 @@
-v1.0.1
+v1.0.2

+ 1 - 0
VERSIONLOG

@@ -1,3 +1,4 @@
 v0.0.0
 v0.0.1 | Tue Nov 13 00:05:43 CET 2018 | init
 v1.0.1
+v1.0.2

+ 11 - 2
index.js

@@ -89,7 +89,7 @@
                 if (typeof(obj[i]) === "object") {
                     r = r.concat(flatten(obj[i], (pre.length > 0 ? pre + delimiter : "") + i));
                 } else {
-                    r.push([(pre.length > 0 ? pre + delimiter : "") + i, "" + obj[i]]);
+                    r.push([(pre.length > 0 ? pre + delimiter : "") + i, ["boolean", "number"].indexOf(typeof(obj[i])) > -1 ? obj[i] : ("" + obj[i])]);
 
                 }
 
@@ -100,12 +100,21 @@
 
         }
 
+        function populate(arr) {
+            var obj = {}
+            arr.map(function(a) {
+                setpath(obj, a[0], a[1]);
+            })
+            return obj
+        }
+
 
         return {
             get: getpath,
             set: setpath,
             flatten: flatten,
-            query: query
+            query: query,
+            populate: populate
         }
 
     }

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "opath",
-  "version": "1.0.1",
+  "version": "1.0.2",
   "description": "",
   "main": "index.js",
   "scripts": {