oolong
Advanced tools
Comparing version 1.8.0 to 1.9.0
@@ -0,1 +1,6 @@ | ||
## 1.9.0 (Jun 1, 2015) | ||
- Adds [`Oolong.wrap`][wrap]. | ||
[wrap]: https://github.com/moll/js-oolong/blob/master/doc/API.md#Oolong.wrap | ||
## 1.8.0 (May 29, 2015) | ||
@@ -2,0 +7,0 @@ - Adds [`Oolong.defineGetter`][defineGetter]. |
@@ -30,2 +30,3 @@ Oolong.js API Documentation | ||
- [values](#Oolong.values)(object) | ||
- [wrap](#Oolong.wrap)(value, key) | ||
@@ -372,1 +373,11 @@ | ||
``` | ||
<a name="Oolong.wrap" /> | ||
### Oolong.wrap(value, key) | ||
Wraps a given value in an object under the specified key. | ||
Works also with [ECMAScript 6 Symbol](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Symbol). | ||
**Examples**: | ||
```javascript | ||
Oolong.wrap("John", "name") // => {name: "John"} | ||
``` |
18
index.js
@@ -551,2 +551,20 @@ var hasOwn = Function.call.bind(Object.hasOwnProperty) | ||
/** | ||
* Wraps a given value in an object under the specified key. | ||
* Works also with [ECMAScript 6 Symbol](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Symbol). | ||
* | ||
* @example | ||
* Oolong.wrap("John", "name") // => {name: "John"} | ||
* | ||
* @static | ||
* @method wrap | ||
* @param value | ||
* @param key | ||
*/ | ||
exports.wrap = function(value, key) { | ||
var obj = {} | ||
obj[key] = value | ||
return obj | ||
} | ||
function not(fn) { return function() { return !fn.apply(this, arguments) }} |
{ | ||
"name": "oolong", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"description": "Utilities for objects. Simple, tasteful and plentiful. Supports inherited properties.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -67,2 +67,3 @@ Oolong.js | ||
- [values](https://github.com/moll/js-oolong/blob/master/doc/API.md#Oolong.values)(object) | ||
- [wrap](https://github.com/moll/js-oolong/blob/master/doc/API.md#Oolong.wrap)(value, key) | ||
@@ -69,0 +70,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
65472
36
1317
96
0