
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
A javascript library which allows to check javascript value types at runtime
A javascript micro library which allows you to check javascript data types.
npm install typeco
typeco
supports following functions and returns boolean value by checking the corresponding data type.
var typeco = require('typeco');
var arr = [1, 2];
var noArr = '';
typeco.isArray(arr); // true
typeco.isArray(noArr); // false
var typeco = require('typeco');
var obj = { name: 'typeco' };
var noObj = '';
typeco.isObject(obj); // true
typeco.isObject(notObj); // false
var typeco = require('typeco');
var str = 'typeco-string';
var noStr = [];
typeco.isString(str); // true
typeco.isString(noStr); // false
var typeco = require('typeco');
var date = new Date();
var noDate = '';
typeco.isDate(date); // true
typeco.isDate(noDate); // false
var typeco = require('typeco');
var reg = new RegExp('ab+c');
var noReg = '';
typeco.isRegExp(reg); // true
typeco.isRegExp(noReg); // false
var typeco = require('typeco');
var func = function() {
// this is a function
};
var noFunc = '';
typeco.isFunction(func); // true
typeco.isFunction(noFunc); // false
var typeco = require('typeco');
var bool = true;
var boolString = 'true';
var noBool = '';
typeco.isBoolean(bool); // true
typeco.isBoolean(boolString); // true
typeco.isBoolean(noBool); // false
var typeco = require('typeco');
var num = 1;
var noNum = '';
typeco.isNumber(num); // true
typeco.isNumber(noNum); // false
This function return true if an object has no keys or an array has no items or a string is empty or the data is either null or undefined.
var typeco = require('typeco');
var str = '';
var arr = [];
var obj = {};
var empty1 = null;
var empty2 = undefined;
typeco.isEmpty(str); // true
typeco.isEmpty(arr); // true
typeco.isEmpty(obj); // true
typeco.isEmpty(empty1); // true
typeco.isEmpty(empty2); // true
This functions works exactly same as isEmpty()
but also returns true if the data is number and value is 0.
var typeco = require('typeco');
var num = 0;
typeco.isEmptyOrZero(num); // true
MIT Licensed. Copyright (c) Farhad Yasir 2018.
FAQs
A javascript library which allows to check javascript value types at runtime
The npm package typeco receives a total of 479 weekly downloads. As such, typeco popularity was classified as not popular.
We found that typeco demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.