Comparing version 0.1.11 to 0.1.12
0.1.12 / 2014-04-03 | ||
================== | ||
* support var map = util.map({a: 1}) | ||
0.1.11 / 2014-03-15 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -472,1 +472,18 @@ /*! | ||
}; | ||
/** | ||
* generate a real map object, no constructor, no __proto__ | ||
* @param {Object} [obj], init object, optional | ||
* @return {Object} | ||
*/ | ||
exports.map = function (obj) { | ||
var map = Object.create(null); | ||
if (!obj) { | ||
return map; | ||
} | ||
for (var key in obj) { | ||
map[key] = obj[key]; | ||
} | ||
return map; | ||
}; |
This software is licensed under the MIT License. | ||
Copyright (C) 2012 - 2013 fengmk2 <fengmk2@gmail.com> | ||
Copyright (C) 2012 - 2014 fengmk2 <fengmk2@gmail.com> and other contributors | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "utility", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"description": "A collection of useful utilities.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -117,2 +117,17 @@ utility [![Build Status](https://secure.travis-ci.org/fengmk2/utility.png)](http://travis-ci.org/fengmk2/utility) [![Coverage Status](https://coveralls.io/repos/fengmk2/utility/badge.png)](https://coveralls.io/r/fengmk2/utility) | ||
### map | ||
Create a `real` map in javascript. | ||
```js | ||
var map = utils.map({a: 1}); | ||
// should.not.exist(map.constractor); | ||
// should.not.exist(map.__proto__); | ||
// should.not.exist(map.toString); | ||
// should not exist any property | ||
console.log(map); // {a: 1} | ||
``` | ||
## benchmark | ||
@@ -179,3 +194,3 @@ | ||
Copyright (c) 2012 - 2013 fengmk2 <fengmk2@gmail.com> | ||
Copyright (c) 2012 - 2014 fengmk2 <fengmk2@gmail.com> and other contributors | ||
@@ -182,0 +197,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29288
644
213