@georgefaulkner1/js-type-safety

1.0.0 • Public • Published

js-types

js-types is a ES6 JavaScript library to implement types to a variable enabling type safety. Simple library that makes types easy.

Installation

Use the package manager npm to install js-types.

npm i @georgefaulkner1/js-type-safety

Usage

import Types from "@georgefaulkner1/js-type-safety";

// create type specified variable. Supported types: String, Number, Boolean, Array, Object
let name = new Types(String, "Jeff");

// returns "Jeff"
console.log(name.value);

// change the variable value
name.value = "Bob";

//Includes type safety. So if you attempt to change name.value to anything other than the defined type it will throw an error.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @georgefaulkner1/js-type-safety

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.4 kB

Total Files

3

Last publish

Collaborators

  • georgefaulkner1