1.0.0 • Published 8 years ago

fdz-type v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

FDZ Type

A simple way to add hooks in any javascript aplication - Vanilla JS

Browser Support

ChromeFirefoxOperaSafariIE
49+ ✔54+ ✔47+ ✔10.1+ ✔11 ✔

Dependencies

A tiny tool to become type check validation easy pizzy - Vanilla JS

Installation

$ npm install fdz-type --save

How to use

ES6

// to import a specific method
import Type from 'fdz-took';

// using  method
Type.is('string', someValue);

CommonJS

const Type = require('fdz-type');

const boolValue = Type.is('string', "foo");

UMD in Browser

<!-- to import non-minified version -->
<script src="fdz-type.umd.js"></script>

<!-- to import minified version -->
<script src="fdz-type.umd.min.js"></script>

After that the library will be available to the Global as Type. Follow an example:

Type.is('object', {});

or

Type.is('object')({});

Methods

Follow the methods that the library provides.

Type.is(type, value)

Verify if value is equal type of the first argument

Arguments

ArgumentTypeOptions
typestring'inform a type name'
valueany'any value'

Example

Type.is('object', {}); // true
Type.is('string', {}); // false

Type.of(value)

Verify what is the value type

Arguments

ArgumentTypeOptions
nameany'inform any value'

Example

Type.of({}); // object

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

Daniel Simão
Daniel Simão

See also the list of colaborators who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details