Comparing version 0.0.1 to 0.0.2
@@ -90,3 +90,3 @@ 'use strict'; | ||
}, | ||
deepFreeze: function deepFreeze(obj) { | ||
freeze: function freeze(obj) { | ||
var _this = this; | ||
@@ -103,3 +103,3 @@ | ||
}, | ||
deepCopy: function deepCopy(data) { | ||
copy: function copy(data) { | ||
var copyOne = null; | ||
@@ -106,0 +106,0 @@ if (this.isObject(data)) { |
{ | ||
"name": "hey-utils", | ||
"version": "0.0.1", | ||
"description": "公用方法", | ||
"version": "0.0.2", | ||
"description": "js-utils, js, util", | ||
"main": "build/utils.js", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -22,4 +22,7 @@ # hey-utils | ||
否则的话,副本会与原对象共享结构。 未定义的属性将不会被复制,然而从对象的原型继承的属性将会被复制。 | ||
例:<code>Utils.extend({},{a:1},{b:2});</code> | ||
```js | ||
Utils.extend({},{a:1},{b:2}); | ||
//结果 | ||
{ | ||
@@ -31,3 +34,3 @@ a:1, | ||
### deepFreeze | ||
### freeze | ||
深度冻结对象 | ||
@@ -37,6 +40,6 @@ Object.freeze的深度实现 | ||
### deepCopy | ||
### copy | ||
深度拷贝对象 | ||
Object.assign的深度实现 | ||
例:<code>Utils.assign({a:1});</code> | ||
例:<code>Utils.copy({a:1});</code> | ||
@@ -55,4 +58,4 @@ ### valueForKeypath | ||
### toArray | ||
将object转换成array. | ||
<code>toArray(object,keyName,valueName)</code> | ||
将object转换成array. | ||
<code>toArray(object,keyName,valueName)</code> | ||
例: | ||
@@ -72,11 +75,11 @@ ```js | ||
Utils.toArray({a:{b:2,d:4},b:{c:2,e:5}},'key'); | ||
Utils.toArray({a:{b:2,d:4},b:{c:2,e:5}},'id'); | ||
//结果 | ||
[{ | ||
key:'a', | ||
id:'a', | ||
b:2, | ||
d:4 | ||
},{ | ||
key:'b', | ||
id:'b', | ||
c:2, | ||
@@ -83,0 +86,0 @@ e:5 |
@@ -82,3 +82,3 @@ (function(global, factory) { | ||
}, | ||
deepFreeze(obj) { | ||
freeze(obj) { | ||
const that = this; | ||
@@ -93,3 +93,3 @@ Object.freeze(obj); | ||
}, | ||
deepCopy(data) { | ||
copy(data) { | ||
let copyOne = null; | ||
@@ -96,0 +96,0 @@ if (this.isObject(data)) { |
123
27253