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

check-more-types

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-more-types - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

2

bower.json
{
"name": "check-more-types",
"main": "check-more-types.js",
"version": "0.1.2",
"version": "0.1.3",
"homepage": "https://github.com/kensho/check-more-types",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -27,2 +27,13 @@ # API

### check.bool
check.bool(true); // true
check.bool(false); // true
check.bool(0); // false
check.bool(1); // false
check.bool('1'); // false
check.bool(2); // false
---
### check.unemptyArray

@@ -64,6 +75,8 @@

check.lowerCase('fooBar'); // false
// non-strings return false
check.lowerCase(10); // false
---
### check.has
### check.has(obj, property)

@@ -77,2 +90,5 @@ var obj = {

check.has(obj, 'baz'); // false
// non-object returns false
check.has(5, 'foo'); // false
check.has('foo', 'length'); // true

@@ -96,2 +112,24 @@ ---

---
### check.raises(fn, validator)
function foo() {
throw new Error('foo');
}
function bar() {}
function isValidError(err) {
return err.message === 'foo';
}
function isInvalid(err) {
return false;
}
check.raises(foo); // true
check.raises(bar); // false
check.raises(foo, isValidError); // true
check.raises(foo, isInvalid); // false
---
{
"name": "check-more-types",
"description": "Additional type checks for https://github.com/philbooth/check-types.js",
"version": "0.1.2",
"version": "0.1.3",
"author": "Gleb Bahmutov <gleb.bahmutov@gmail.com>",

@@ -6,0 +6,0 @@ "bugs": {

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

# check-more-types v0.1.2
# check-more-types v0.1.3

@@ -61,2 +61,13 @@ > Additional type checks for [check-types.js](https://github.com/philbooth/check-types.js)

#### check.bool
check.bool(true); // true
check.bool(false); // true
check.bool(0); // false
check.bool(1); // false
check.bool('1'); // false
check.bool(2); // false
---
#### check.unemptyArray

@@ -98,6 +109,8 @@

check.lowerCase('fooBar'); // false
// non-strings return false
check.lowerCase(10); // false
---
#### check.has
#### check.has(obj, property)

@@ -111,2 +124,5 @@ var obj = {

check.has(obj, 'baz'); // false
// non-object returns false
check.has(5, 'foo'); // false
check.has('foo', 'length'); // true

@@ -132,3 +148,25 @@ ---

#### check.raises(fn, validator)
function foo() {
throw new Error('foo');
}
function bar() {}
function isValidError(err) {
return err.message === 'foo';
}
function isInvalid(err) {
return false;
}
check.raises(foo); // true
check.raises(bar); // false
check.raises(foo, isValidError); // true
check.raises(foo, isInvalid); // false
---
### Small print

@@ -135,0 +173,0 @@

@@ -48,2 +48,25 @@ require('lazy-ass');

describe('check.raises example', function () {
it('check.raises(fn, validator)', function () {
function foo() {
throw new Error('foo');
}
function bar() {}
function isValidError(err) {
return err.message === 'foo';
}
function isInvalid(err) {
return false;
}
la(check.raises(foo));
la(!check.raises(bar));
la(check.raises(foo, isValidError));
la(!check.raises(foo, isInvalid));
});
});
describe('check.defined', function () {

@@ -78,2 +101,15 @@ la(check.fn(check.bit));

describe('check.bool', function () {
la(check.fn(check.bool));
it('check.bool', function () {
la(check.bool(true));
la(check.bool(false));
la(!check.bool(0));
la(!check.bool(1));
la(!check.bool('1'));
la(!check.bool(2));
});
});
describe('check.bit', function () {

@@ -356,2 +392,4 @@ la(check.fn(check.bit));

la(!check.lowerCase('fooBar'));
// non-strings return false
la(!check.lowerCase(10));
});

@@ -403,3 +441,3 @@

describe('has', function () {
it('check.has', function () {
it('check.has(obj, property)', function () {
var obj = {

@@ -412,2 +450,5 @@ foo: 'foo',

la(!check.has(obj, 'baz'));
// non-object returns false
la(!check.has(5, 'foo'));
la(check.has('foo', 'length'));
});

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