typeis / Typeis
Typeis. it's the smart and simple javaScript type checker
Stars: ✭ 100
Programming Languages
javascript
184084 projects - #8 most used programming language
Labels
Projects that are alternatives of or similar to Typeis
Elixir Type check
TypeCheck: Fast and flexible runtime type-checking for your Elixir projects.
Stars: ✭ 80 (-20%)
Mutual labels: type-checking
Vuex Simple Structure
📈 A repository showcasing a simple Vuex store inside a Vue.js application based on Large-scale Vuex application structures @3yourmind
Stars: ✭ 87 (-13%)
Mutual labels: simple
Tensorflow Cifar 10
Cifar-10 CNN implementation using TensorFlow library with 20% error.
Stars: ✭ 85 (-15%)
Mutual labels: simple
Sharedchamber
Android Secure SharedPreferences Using Facebook Conceal Encryption
Stars: ✭ 96 (-4%)
Mutual labels: simple
Bmenu
A general purpose terminal menu that focuses on ease of configuration and use.
Stars: ✭ 94 (-6%)
Mutual labels: simple
React Native Animated Emoji
Animated Floating Reactions like Facebook 👍
Stars: ✭ 82 (-18%)
Mutual labels: simple
Simpleupload
Simple upload system in PHP, compatible with AWS S3, Dropbox, Azure and others.
Stars: ✭ 85 (-15%)
Mutual labels: simple
Predicates
Predicates for type checking, assertions, filtering etc
Stars: ✭ 89 (-11%)
Mutual labels: type-checking
Dilate
Nearly zero runtime object allocation powered by scalameta. Value class and Unboxed Tagged Type generation at compile-time.
Stars: ✭ 80 (-20%)
Mutual labels: type-checking
Kevin
A simple-stupid self-hostable continuous integration service. 🙈
Stars: ✭ 95 (-5%)
Mutual labels: simple
Rsget
A simple command line utility to download a remote file, similar to wget. This is not intended to be a full feature wget replacement but a simple tool to test few Rust crates.
Stars: ✭ 98 (-2%)
Mutual labels: simple
Stopwatch
⏱️ Single-header C++11 RDTSCP clock and timing utilities released into the public domain.
Stars: ✭ 96 (-4%)
Mutual labels: simple
In Javascript, "Everything is (or acts like) an Object" We need to write "typeis.js" due to a problem (type check) arised other than except the conveniences it is a providing to us.
typeis.js
Typeis. it's the smart and simple javascript type check and validation library ~226 Bytes;
Value | Native | Typeis.js |
---|---|---|
Undeclared variables | undefined | --- |
undefined | undefined | --- |
null | object | --- |
Booleans | boolean | Boolean |
Numbers | number | Number |
String | string | String |
Functions | function | Function |
Array | object | Array |
Object | object | Object |
Date | object | Date |
RegExp | object | RegExp |
Be careful!
Everything in JavaScript acts like an object, with the only two exceptions being null and undefined. *JavaScript Garden Typeis.js acts like an property; doesn't work null and undefined types because they doesn't have properties.
Download
Installation
npm install typeis
bower install typeis
Usage
In Node.js:
require('typeis');
In a browser:
<script src="typeis.js"></script>
Property usage will not available after ^2.0 anymore, please use function typeis(variable, [type]) Basic type checking Examples
variable.typeis();
// return Array, Object, RegExp, Date etc.
Multi type validation
typeis(variable, ['array', 'object']);
// if variable is Array or Object return true otherwise false
Type valition with regex
typeis(variable, 'array|object');
// if variable is Array or object return true otherwise false
typeis(variable, '.+[yep]$');
// if variable type end of "y", "e" and "p" like Array, Date, RegExp return true otherwise false
typeis(variable, '(^(?!array|object).+)[^n]$');
// if variable is Array, Object or ending "n" like Function and Boolean return false otherwise true
Real world Usage
function realWorld( options ){
if(typeis(options, 'object')){
//do something
} else {
//do another something
}
}
Browser Support
IE9 and below also support all modern browser.
Changelog
1.1.2
Property usage warning
1.1.1
Update readme
1.1.0
Multi type validation support
variable.typeis(['array', 'object']);
// if variable is Array or Object return true otherwise false
type validation with regex support
variable.typeis('array|object');
// if variable is Array or object return true otherwise false
1.0
Typeis.js Released
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].