Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typical

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typical

For type-checking Javascript values.

  • 2.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.5M
decreased by-5.19%
Maintainers
1
Weekly downloads
 
Created
Source

view on npm npm module downloads per month Build Status Dependency Status

typical

For type-checking Javascript values.

Example

var t = require("typical");

t.isNumber(n) ⇒ boolean

Returns true if input is a number

Kind: static method of typical

ParamTypeDescription
n*the input to test

Example

> t.isNumber(0)
true
> t.isNumber(1)
true
> t.isNumber(1.1)
true
> t.isNumber(0xff)
true
> t.isNumber(0644)
true
> t.isNumber(6.2e5)
true
> t.isNumber(NaN)
false
> t.isNumber(Infinity)
false

t.isPlainObject(input) ⇒ boolean

A plain object is a simple object literal, it is not an instance of a class. Returns true if the input typeof is object and directly decends from Object.

Kind: static method of typical

ParamTypeDescription
input*the input to test

Example

> t.isPlainObject({ clive: "hater" })
true
> t.isPlainObject(new Date())
false
> t.isPlainObject([ 0, 1 ])
false
> t.isPlainObject(1)
false
> t.isPlainObject(/test/)
false

t.isArrayLike(input) ⇒ boolean

An array-like value has all the properties of an array, but is not an array instance. Examples in the arguments object. Returns true if the input value is an object, not null and has a length property with a numeric value.

Kind: static method of typical

ParamTypeDescription
input*the input to test

Example

function sum(x, y){
    console.log(t.isArrayLike(arguments));
    // prints `true`
}

t.isObject(input) ⇒ boolean

returns true if the typeof input is "object", but not null!

Kind: static method of typical

ParamTypeDescription
input*the input to test

t.isDefined(input) ⇒ boolean

Returns true if the input value is defined

Kind: static method of typical

ParamTypeDescription
input*the input to test

© 2015 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.

Keywords

FAQs

Package last updated on 02 Jul 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc