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

typ

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typ - npm Package Compare versions

Comparing version 0.6.0 to 0.6.1

29

lib/typ.js

@@ -48,2 +48,5 @@ // Copyright 2012 The Obvious Corporation.

/** extended type name */
var NULLISH = "null or undefined";
/** type name */

@@ -215,3 +218,3 @@ var NUMBER = "number";

(Object.getPrototypeOf(x) === DATE_PROTOTYPE) &&
(baseToString(x) === '[object Date]');
(baseToString(x) === '[object Date]');
}

@@ -278,2 +281,10 @@

function isNull(x) {
return (x === null);
}
function isNullish(x) {
return (x === null) || isUndefined(x);
}
function isNumber(x) {

@@ -362,2 +373,14 @@ return (typeof x) === NUMBER;

function assertNull(x) {
if (!isNull(x)) {
failType(x, NULL);
}
}
function assertNullish(x) {
if (!isNullish(x)) {
failType(x, NULLISH);
}
}
function assertNumber(x) {

@@ -426,2 +449,4 @@ if (!isNumber(x)) {

assertMap: assertMap,
assertNull: assertNull,
assertNullish: assertNullish,
assertNumber: assertNumber,

@@ -446,2 +471,4 @@ assertObject: assertObject,

isMap: isMap,
isNull: isNull,
isNullish: isNullish,
isNumber: isNumber,

@@ -448,0 +475,0 @@ isObject: isObject,

2

package.json
{
"name": "typ",
"version": "0.6.0",
"version": "0.6.1",
"keywords":

@@ -5,0 +5,0 @@ ["type", "assert", "predicate"],

@@ -177,2 +177,11 @@ typ: Type predicates and assertions for Node

### null: isNull(value), assertNull(value)
The only value that is null is `null` per se.
### nullish: isNullish(value), assertNullish(value)
The only two values that are considered to be "nullish" are `null`
and `undefined`.
### number: isNumber(value), assertNumber(value)

@@ -179,0 +188,0 @@

@@ -38,2 +38,4 @@ // Copyright 2012 The Obvious Corporation.

{ assert: typ.assertMap, predicate: typ.isMap },
{ assert: typ.assertNull, predicate: typ.isNull },
{ assert: typ.assertNullish, predicate: typ.isNullish },
{ assert: typ.assertNumber, predicate: typ.isNumber },

@@ -101,4 +103,4 @@ { assert: typ.assertObject, predicate: typ.isObject },

// other
{ v: null, p: [typ.isDefined] },
{ v: undefined, p: [typ.isUndefined] }
{ v: null, p: [typ.isNull, typ.isNullish, typ.isDefined] },
{ v: undefined, p: [typ.isNullish, typ.isUndefined] }
];

@@ -105,0 +107,0 @@

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