source: node_modules/ramda-adjunct/lib/isPrototypeOf.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = void 0;
5var _ramda = require("ramda");
6var _invokeArgs = _interopRequireDefault(require("./invokeArgs"));
7function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
8/**
9 * Checks if an object exists in another object's prototype chain.
10 *
11 * @func isPrototypeOf
12 * @category Object
13 * @memberOf RA
14 * @since {@link https://char0n.github.io/ramda-adjunct/2.31.0|v2.31.0}
15 * @sig * -> Boolean
16 * @param {Object} type The prototype that we're searching for
17 * @param {Object} object The object whose prototype chain will be searched
18 * @return {boolean}
19 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf|Object.prorotype.isPrototypeOf}
20 * @example
21 * function Foo() {}
22 * function Bar() {}
23 * function Baz() {}
24 *
25 * Bar.prototype = Object.create(Foo.prototype);
26 * Baz.prototype = Object.create(Bar.prototype);
27 *
28 * const baz = new Baz();
29 *
30 * RA.isPrototypeOf(Baz, baz); // => true
31 * RA.isPrototypeOf(Bar, baz); // => true
32 * RA.isPrototypeOf(Foo, baz); // => true
33 * RA.isPrototypeOf(Object, baz); // => true
34 */
35var isPrototypeOf = (0, _ramda.curry)(function (type, object) {
36 return Boolean((0, _invokeArgs["default"])(['prototype', 'isPrototypeOf'], [object], type));
37});
38var _default = isPrototypeOf;
39exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.