@ganuz/is-configurable
Is Configurable is package from Ganuz library
Install
$ yarn add @ganuz/is-configurable
Or
$ npm install --save @ganuz/is-configurable
Use
Module
import {
default as isConfigurable
} from '@ganuz/is-configurable';
Browser
<script src="https://unpkg.com/@ganuz/is-configurable/bundle.umd.min.js"></script>
let {
isConfigurable
} = G;
Examples
isConfigurable(null, 'foo'); // throw TypeError
isConfigurable({ foo: 'bar'}, 'foo'); // => true
isConfigurable({}, 'foo'); // => true
isConfigurable(class { static foo = 'bar'; }, 'foo'); // => true
isConfigurable(Object.create(Object.create({}, {foo: {value: 'bar'}})), 'foo'); // => true
isConfigurable(Object.create({}, {foo: {value: 'bar'}}), 'foo'); // => false
isConfigurable([], 'length'); // => false
isConfigurable(Object.freeze({foo: 'bar'}), 'foo'); // => false
@ganuz/is-configurable/assert
Module
import {
default as assertConfigurable
} from '@ganuz/is-configurable/assert';
Browser
<script src="https://unpkg.com/@ganuz/is-configurable/assert/bundle.umd.min.js"></script>
let {
assertConfigurable
} = G;
Examples
assertConfigurable({}, 'foo'); // => {}
assertConfigurable({foo: 'bar'}, 'foo'); // => {foo: 'bar'}
assertConfigurable(Object.create({}, {foo: {value: 'bar'}}), 'foo'); // throw TypeError
assertConfigurable(Object.freeze({foo: 'bar'}), 'foo'); // throw TypeError
License
Copyright © Yisrael Eliev, Licensed under the MIT license.