Comparing version 2.0.0 to 2.0.1
19
index.js
@@ -12,11 +12,10 @@ /** | ||
*/ | ||
'use strict'; | ||
var owns = {}.hasOwnProperty; | ||
var toString = {}.toString; | ||
var is = exports; | ||
var deepIs = require('deep-is'); | ||
const owns = {}.hasOwnProperty; | ||
const toString = {}.toString; | ||
const is = exports; | ||
const deepIs = require('deep-is'); | ||
const ipRegEx = require('ip-regex'); | ||
is.version = require('./package.json').version; | ||
is.version = '0.0.12'; | ||
//////////////////////////////////////////////////////////////////////////////// | ||
@@ -542,2 +541,3 @@ // Environment | ||
}; | ||
is.oddNumber = is.oddNum = is.odd; | ||
@@ -807,6 +807,5 @@ //////////////////////////////////////////////////////////////////////////////// | ||
if (!is.nonEmptyStr(value)) return false; | ||
return ipv6RegExp.test(value); | ||
return ipRegEx.v6({extract: true}).test(value); | ||
}; | ||
is.ipv6 = is.ipv6Addr = is.ipv6Address; | ||
var ipv6RegExp = /^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/; | ||
@@ -820,3 +819,3 @@ /** | ||
if (!is.nonEmptyStr(value)) return false; | ||
return is.ipv4(value) || is.ipv6(value); | ||
return is.ipv4Address(value) || is.ipv6Address(value) | ||
}; | ||
@@ -823,0 +822,0 @@ is.ip = is.ipAddr = is.ipAddress; |
{ | ||
"name": "is2", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "A type checking library where each exported function returns either true or false and does not throw. Also added tests.", | ||
@@ -49,2 +49,3 @@ "license": "MIT", | ||
"deep-is": "^0.1.3", | ||
"ip-regex": "^2.1.0", | ||
"is-url": "^1.2.2" | ||
@@ -51,0 +52,0 @@ }, |
@@ -14,7 +14,7 @@ is2 | ||
var is = require('is2'); | ||
const is = require('is2'); | ||
console.log('true is equal to 1===1: '+(is.equal(true, 1===1)); | ||
console.log('10 is a positive number: '+(is.positiveNumber(10)); | ||
console.log('11 is an odd number: '+(is.oddNumber(11)); | ||
console.log(`1===1 is: ${is.equal(true, 1===1)}`); | ||
console.log(`10 is a positive number: ${is.positiveNumber(10)}`); | ||
console.log(`11 is an odd number: ${is.oddNumber(11)}`); | ||
@@ -79,7 +79,7 @@ ## API | ||
* is.even(val) | ||
* is.even(val) - is.evenNum, is.evenNumber | ||
* is.decimal(val) - is.decNum, is.dec | ||
* is.integer(val) - is.int | ||
* is.notANumber(val) - is.nan, is.notANum | ||
* is.odd(val) | ||
* is.odd(val) - is.oddNum, is.oddNumber | ||
@@ -86,0 +86,0 @@ Numeric Type and State: |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2603
122237
3
+ Addedip-regex@^2.1.0
+ Addedip-regex@2.1.0(transitive)