0.1.1 • Published 6 years ago

@ganuz/is-enumerable v0.1.1

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

@ganuz/is-enumerable

Source Code Version MIT License Bundle Size TypeScript

Is Enumerable is package from Ganuz library

Install

$ yarn add @ganuz/is-enumerable

Or

$ npm install --save @ganuz/is-enumerable

Use

Module

import {
  default as isEnumerable
} from '@ganuz/is-enumerable';

Browser

<script src="https://unpkg.com/@ganuz/is-enumerable/bundle.umd.min.js"></script>
let {
  isEnumerable
} = G;

Examples

 isEnumerable(null, 'foo'); // throw TypeError
 isEnumerable({foo: 'bar'}, 'foo'); // => true
 isEnumerable({[Symbol.for('foo')]: 'bar'}, Symbol.for('foo')); // => true
 isEnumerable({}, 'foo'); // => false
 isEnumerable(class {static method(){}}, 'method'); // => false
 isEnumerable(Object.create({foo: 'bar'})); // => false
 isEnumerable(Object.create({}, {foo: {value: 'bar'}})); // => false

@ganuz/is-enumerable/assert

Module

import {
  default as assertEnumerable
} from '@ganuz/is-enumerable/assert';

Browser

<script src="https://unpkg.com/@ganuz/is-enumerable/assert/bundle.umd.min.js"></script>
let {
  assertEnumerable
} = G;

Examples

 assertEnumerable({}, 'foo'); // => {}
 assertEnumerable({foo: 'bar'}, 'foo'); // => {foo: 'bar'}
 assertEnumerable(Object.create({foo: 'bar'}), 'foo'); // throw TypeError
 assertEnumerable(Object.create(null, {foo: {value: 'bar'}}), 'foo'); // throw TypeError
 assertEnumerable(Object, 'constructor'); // throw TypeError

License

Copyright © Yisrael Eliev, Licensed under the MIT license.