@ganuz/is-definable
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

@ganuz/is-definable

Source Code Version MIT License Bundle Size TypeScript

Is Definable is package from Ganuz library

Install

$ yarn add @ganuz/is-definable

Or

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

Use

Module

import {
  default as isDefinable
} from '@ganuz/is-definable';

Browser

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

Examples

 isDefinable(null, 'prop'); // throw TypeError
 isDefinable({}, 'foo'); // => true
 isDefinable({foo: 'bar'}, 'foo'); // => true
 isDefinable({get some(){}}, 'some'); // => true
 isDefinable(Object.create({}, {color: {value: 'red', writable: false, configurable: true}}), 'foo'); // => true
 isDefinable(Object.create({}, {foo: {value: 'bar', writable: true, configurable: false}}), 'foo'); // => false
 isDefinable(Object.preventExtensions({num: 88}), 'num'); // => false
 isDefinable(Object.seal({}), 'car'); // => false

@ganuz/is-definable/assert

Module

import {
  default as assertDefinable
} from '@ganuz/is-definable/assert';

Browser

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

Examples

 assertDefinable({color: 'red'}, 'color'); // => {color: 'red'};
 assertDefinable([1], 1); // => [1];
 assertDefinable(Object.freeze({foo: 'bar'}), 'foo'); // throw TypeError
 assertDefinable(Object.create(null, {foo: {value: 'bar'}}), foo); // throw TypeError

License

Copyright © Yisrael Eliev, Licensed under the MIT license.

Package Sidebar

Install

npm i @ganuz/is-definable

Weekly Downloads

3

Version

0.1.1

License

MIT

Unpacked Size

124 kB

Total Files

27

Last publish

Collaborators

  • yisraelx