@stamp/instanceof

1.0.1 • Public • Published

@stamp/instanceof

Enables obj instanceof MyStamp in ES6 environments

const InstanceOf = require('@stamp/InstanceOf');
// or
import InstanceOf from '@stamp/InstanceOf';

Example

Create a stamp:

let MyStamp = compose({
  properties: { ... },
  initializers: [function () { ... }]
});

The following doesn't work:

const obj = MyStamp();
obj instanceof MyStamp === false;

Compose the InstanceOf to your stamp:

MyStamp = MyStamp.compose(InstanceOf);

Now it works:

const myObject = MyStamp();
obj instanceof MyStamp === true;

Notes

  • We do not recommend to use instanceof in JavaScript in general.

Readme

Keywords

none

Package Sidebar

Install

npm i @stamp/instanceof

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

2.43 kB

Total Files

5

Last publish

Collaborators

  • stamp