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

check-types

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-types - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

component.json

2

package.json
{
"name": "check-types",
"version": "0.2.1",
"version": "0.2.2",
"author": "Phil Booth <pmbooth@gmail.com>",

@@ -5,0 +5,0 @@ "description": "A small library for checking types and throwing exceptions.",

@@ -43,6 +43,9 @@ # check-types.js

Tests whether an object 'quacks like a duck'. Returns `true`
if the first argument has all of the properties of the second,
archetypal argument (the 'duck'). Returns `false` otherwise.
If either argument is not an object, an exception is thrown.
Tests whether an object 'quacks like a duck'.
Returns `true`
if the first argument has all of the properties
of the second, archetypal argument (the 'duck').
Returns `false` otherwise.
If either argument is not an object,
an exception is thrown.

@@ -56,4 +59,3 @@ #### check.isInstance (thing, prototype)

Throws an exception if an object is not an instance of a
prototype.
Throws an exception if an object is not an instance of a prototype.

@@ -67,8 +69,8 @@ #### check.isObject (thing)

Throws an exception unless something is a non-null, non-array
object.
Throws an exception unless something is a non-null, non-array object.
#### check.isArray (thing)
Returns `true` something is an array, `false` otherwise.
Returns `true` something is an array,
`false` otherwise.

@@ -81,3 +83,4 @@ #### check.verifyArray (thing, message)

Returns `true` if something is function, `false` otherwise.
Returns `true` if something is function,
`false` otherwise.

@@ -90,4 +93,4 @@ #### check.verifyFunction (thing, message)

Returns `true` if something is a non-empty string, `false`
otherwise.
Returns `true` if something is a non-empty string,
`false` otherwise.

@@ -100,3 +103,4 @@ #### check.verifyUnemptyString (thing, message)

Returns `true` if something is a string, `false` otherwise.
Returns `true` if something is a string,
`false` otherwise.

@@ -109,9 +113,10 @@ #### check.verifyString (thing, message)

Returns `true` if something is a number, `false` otherwise. In
this instance, `NaN` is not considered a number.
Returns `true` if something is a number,
`false` otherwise.
In this instance, `NaN` is not considered a number.
#### check.verifyNumber (thing, message)
Throws an exception unless something is a number. In this
instance, `NaN` is not considered a number.
Throws an exception unless something is a number.
In this instance, `NaN` is not considered a number.

@@ -122,12 +127,18 @@ ## Development

The build environment relies on [Node.js][node], [NPM], [Jake],
[JSHint], [Mocha] and [Chai]. Assuming that
you already have Node.js and NPM set up, you just need to run
`npm install` to install all of the dependencies as listed in
`package.json`.
The build environment relies on
[Node.js][node],
[NPM],
[Jake],
[JSHint],
[Mocha],
[Chai] and
[UglifyJS].
Assuming that you already have Node.js and NPM set up,
you just need to run `npm install` to
install all of the dependencies as listed in `package.json`.
### Unit tests
The unit tests are in `test/check-types.coffee`. You can run them
with the command `npm test` or `jake jstest`.
The unit tests are in `test/check-types.coffee`.
You can run them with the command `npm test` or `jake jstest`.

@@ -134,0 +145,0 @@ [ci-image]: https://secure.travis-ci.org/philbooth/check-types.js.png?branch=master

@@ -1,1 +0,1 @@

(function(){"use strict";function t(e,t){var n;i(e),i(t);for(n in t){if(e.hasOwnProperty(n)===!1)return!1;if(typeof e[n]!=typeof t[n])return!1}return!0}function n(e,t,n){if(r(e,t)===!1)throw new Error(n||"Invalid type")}function r(e,t){return typeof e=="undefined"||e===null?!1:f(t)&&e instanceof t?!0:!1}function i(e,t){if(s(e)===!1)throw new Error(t||"Invalid object")}function s(e){return typeof e=="object"&&e!==null&&u(e)===!1?!0:!1}function o(e,t){if(u(e)===!1)throw new Error(t||"Invalid array")}function u(e){return Object.prototype.toString.call(e)==="[object Array]"?!0:!1}function a(e,t){if(f(e)===!1)throw new Error(t||"Invalid function")}function f(e){return typeof e=="function"?!0:!1}function l(e,t){if(c(e)===!1)throw new Error(t||"Invalid string")}function c(e){return p(e)&&e!==""?!0:!1}function h(e,t){if(p(e)===!1)throw new Error(t||"Invalid string")}function p(e){return typeof e=="string"?!0:!1}function d(e,t){if(v(e)===!1)throw new Error(t||"Invalid number")}function v(e){return isNaN(e)===!0?!1:typeof e=="number"?!0:!1}var e={quacksLike:t,verifyInstance:n,isInstance:r,verifyObject:i,isObject:s,verifyArray:o,isArray:u,verifyFunction:a,isFunction:f,verifyUnemptyString:l,isUnemptyString:c,verifyString:h,isString:p,verifyNumber:d,isNumber:v};module.exports=e})();
(function(){"use strict";function t(e,t){var n;i(e),i(t);for(n in t)if(t.hasOwnProperty(n)){if(e.hasOwnProperty(n)===!1)return!1;if(typeof e[n]!=typeof t[n])return!1}return!0}function n(e,t,n){if(r(e,t)===!1)throw new Error(n||"Invalid type")}function r(e,t){return typeof e=="undefined"||e===null?!1:f(t)&&e instanceof t?!0:!1}function i(e,t){if(s(e)===!1)throw new Error(t||"Invalid object")}function s(e){return typeof e=="object"&&e!==null&&u(e)===!1?!0:!1}function o(e,t){if(u(e)===!1)throw new Error(t||"Invalid array")}function u(e){return Object.prototype.toString.call(e)==="[object Array]"?!0:!1}function a(e,t){if(f(e)===!1)throw new Error(t||"Invalid function")}function f(e){return typeof e=="function"?!0:!1}function l(e,t){if(c(e)===!1)throw new Error(t||"Invalid string")}function c(e){return p(e)&&e!==""?!0:!1}function h(e,t){if(p(e)===!1)throw new Error(t||"Invalid string")}function p(e){return typeof e=="string"?!0:!1}function d(e,t){if(v(e)===!1)throw new Error(t||"Invalid number")}function v(e){return isNaN(e)===!0?!1:typeof e=="number"?!0:!1}var e={quacksLike:t,verifyInstance:n,isInstance:r,verifyObject:i,isObject:s,verifyArray:o,isArray:u,verifyFunction:a,isFunction:f,verifyUnemptyString:l,isUnemptyString:c,verifyString:h,isString:p,verifyNumber:d,isNumber:v};typeof window=="undefined"?module.exports=e:window.check=e})();

@@ -478,3 +478,3 @@ /*globals require */

assert.throws(function () {
types.verifyNumber('');
types.verifyNumber(' x');
});

@@ -481,0 +481,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