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

0.1.1 • Public • Published

@ganuz/is-writable

Source Code Version MIT License Bundle Size TypeScript

Is Writable is package from Ganuz library

Install

$ yarn add @ganuz/is-writable

Or

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

Use

Module

import {
  default as isWritable
} from '@ganuz/is-writable';

Browser

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

Examples

 isWritable('foo', null); // throw TypeError
 isWritable(null, 'key'); // => throw TypeError
 isWritable({}, 'foo'); // => true
 isWritable({foo: 'bar'}, 'foo'); // => true
 isWritable([0, 1, 2]], 1); // => true
 isWritable(Object.freeze({color: 'red'}), 'foo') => false
 isWritable(Object.create(null, {a: {value: 1}}), 'a'); // => false
 isWritable(Object.create(Object.create(null, {a: {value: 1}})), 'a'); // => true

@ganuz/is-writable/assert

Module

import {
  default as assertWritable
} from '@ganuz/is-writable/assert';

Browser

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

Examples

 assertWritable({}, 'foo'); // => {}
 assertWritable({foo: 'bar'}, 'foo'); // => {foo: 'bar'}
 assertWritable(Object.create({}, {foo: {value: 'bar'}}), 'foo'); // throw TypeError
 assertWritable(Object.freeze({foo: 'bar'}), 'foo'); // throw TypeError

License

Copyright © Yisrael Eliev, Licensed under the MIT license.

Package Sidebar

Install

npm i @ganuz/is-writable

Weekly Downloads

3

Version

0.1.1

License

MIT

Unpacked Size

109 kB

Total Files

27

Last publish

Collaborators

  • yisraelx