Socket
Socket
Sign inDemoInstall

oolong

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oolong - npm Package Compare versions

Comparing version 1.11.1 to 1.12.0

test/oolong/set_prototype_of_test.js

5

CHANGELOG.md

@@ -0,1 +1,6 @@

## 1.12.0 (Jun 26, 2015)
- Adds [`Oolong.setPrototypeOf`][setPrototypeOf].
[setPrototypeOf]: https://github.com/moll/js-oolong/blob/master/doc/API.md#Oolong.setPrototypeOf
## 1.11.1 (Jun 24, 2015)

@@ -2,0 +7,0 @@ - Fixes [`Oolong.isPlainObject`][isPlainObject] to return `false` for

@@ -32,2 +32,3 @@ Oolong.js API Documentation

- [reject](#Oolong.reject)(object, callback, [thisArg])
- [setPrototypeOf](#Oolong.setPrototypeOf)(object, prototype)
- [values](#Oolong.values)(object)

@@ -426,2 +427,18 @@ - [wrap](#Oolong.wrap)(value, key)

<a name="Oolong.setPrototypeOf" />
### Oolong.setPrototypeOf(object, prototype)
Set the prototype of the given object to the given prototype.
Pass `null` or another object for the prototype.
Returns `object`.
Uses `Object.setPrototypeOf` if it exists. Otherwise uses a polyfill.
**Examples**:
```javascript
var person = {name: "Unnamed", age: 42}
var mike = Oolong.setPrototypeOf({name: "Mike"}, person)
mike.name // => "Mike
mike.age // => 42
```
<a name="Oolong.values" />

@@ -428,0 +445,0 @@ ### Oolong.values(object)

@@ -6,2 +6,3 @@ var hasOwn = Function.call.bind(Object.hasOwnProperty)

var lookupSetter = Object.prototype.__lookupSetter__
var SET_PROTO_OF_NULL = "Oolong.setPrototypeOf called on null or undefined"

@@ -620,2 +621,27 @@ /**

/**
* Set the prototype of the given object to the given prototype.
* Pass `null` or another object for the prototype.
* Returns `object`.
*
* Uses `Object.setPrototypeOf` if it exists. Otherwise uses a polyfill.
*
* @example
* var person = {name: "Unnamed", age: 42}
* var mike = Oolong.setPrototypeOf({name: "Mike"}, person)
* mike.name // => "Mike
* mike.age // => 42
*
* @static
* @method setPrototypeOf
* @param object
* @param prototype
*/
exports.setPrototypeOf = Object.setPrototypeOf || function(obj, prototype) {
/* eslint no-proto: 0 */
if (obj == null) throw new TypeError(SET_PROTO_OF_NULL)
if (typeof obj == "object") obj.__proto__ = prototype
return obj
}
/**
* Returns all enumerable property values as an array.

@@ -622,0 +648,0 @@ *

2

package.json
{
"name": "oolong",
"version": "1.11.1",
"version": "1.12.0",
"description": "Utilities for objects. Simple, tasteful and plentiful. Supports inherited properties.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -69,2 +69,3 @@ Oolong.js

- [reject](https://github.com/moll/js-oolong/blob/master/doc/API.md#Oolong.reject)(object, callback, [thisArg])
- [setPrototypeOf](https://github.com/moll/js-oolong/blob/master/doc/API.md#Oolong.setPrototypeOf)(object, prototype)
- [values](https://github.com/moll/js-oolong/blob/master/doc/API.md#Oolong.values)(object)

@@ -71,0 +72,0 @@ - [wrap](https://github.com/moll/js-oolong/blob/master/doc/API.md#Oolong.wrap)(value, key)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc