You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

dtypecheck

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dtypecheck

Dynamic typecheck helper

1.0.1
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

dtypecheck - dynamic typecheck helper

Note: It works with env NODE_ENV=development

Examples:

Simple

const t = require("dtypecheck");
const {expect} = require("chai");

const fn = t(
  number => `${number}`,
  number => expect(number).a(`number`),
  string => expect(string).a(`string`)
);

fn(1) // Good
fn([1, 2]) // Bad

Async

const t = require("dtypecheck");
const {expect} = require("chai");

const fn = t(
  async (number) => `${number}`,
  async (number) => expect(number).a(`number`),
  async (string) => expect(string).a(`string`)
);

(async () {
  await fn(1) // Good
  await fn([1, 2]) // Bad
})();

Keywords

dynamic

FAQs

Package last updated on 09 Nov 2017

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