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

typely

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typely

Lightweight (meaning relatively fast) type-checking in CoffeeScript.

  • 0.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
60
decreased by-68.42%
Maintainers
1
Weekly downloads
 
Created
Source

typely

A lightweight (read: relatively fast) type-checking library in CoffeeScript.

{overload} = require "typely"

class Multiplier 

  total: 1

  multiply: overload (match) ->
    match "array", (array) -> @multiply element for element in array
    match "number", (number) -> @total *= number

multiplier = new Multiplier

multiplier.multiply 2
multiplier.multiply [ 3, 4, 5 ]

console.log multiplier.total

Typely is limited to checking for types, [as per Douglas Crockford's typeOf function][0]. That is: null, undefined, boolean, number, string, date, regexp, array, object, and function. This limitation allows it to run relatively fast, by simply using as an index a string based on the types of the given arguments and seeing whether it returns a function.

Installation

npm install typely

Keywords

FAQs

Package last updated on 01 Jun 2013

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