0.1.1 • Published 6 years ago

@ganuz/append-prototype-of v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

@ganuz/append-prototype-of

Source Code Version MIT License Bundle Size TypeScript

Append Prototype Of is package from Ganuz library

Install

$ yarn add @ganuz/append-prototype-of

Or

$ npm install --save @ganuz/append-prototype-of

Use

Module

import {
  default as appendPrototypeOf
} from '@ganuz/append-prototype-of';

Browser

<script src="https://unpkg.com/@ganuz/append-prototype-of/bundle.umd.min.js"></script>
let {
  appendPrototypeOf
} = G;

Examples

 appendPrototypeOf(null, {}); // throw TypeError
 appendPrototypeOf({}, undefined); // => throw TypeError
 appendPrototypeOf({}, null); // => true
 appendPrototypeOf(class Foo{}, class Some{}); // => true
 appendPrototypeOf(Object.preventExtensions({foo: 'bar'}), null); // => false
 appendPrototypeOf(Object, function(){}); // => false
 appendPrototypeOf(Object.prototype, {}); // => false
 appendPrototypeOf(String.prototype, {}); // => false
 appendPrototypeOf(Object('foo'), {}); // => true

Note: it will append proto to target on the last proto of prototype chain that is not native.

License

Copyright © Yisrael Eliev, Licensed under the MIT license.