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

is2

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is2 - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

18

index.js

@@ -698,12 +698,16 @@ /**

if (value.length > 255) return false;
var names = value.split('.');
if (!is.array(names) || !names.length) return false;
if (names[0].indexOf('_') > -1) return false;
for (var i=0; i<names.length; i++) {
if (!dnsLabel.test(names[i])) return false;
}
if (numbersLabel.test(value)) return false;
if (!dnsLabel.test(value)) return false;
return true;
//var names = value.split('.');
//if (!is.array(names) || !names.length) return false;
//if (names[0].indexOf('_') > -1) return false;
//for (var i=0; i<names.length; i++) {
//if (!dnsLabel.test(names[i])) return false;
//}
//return true;
};
is.dnsAddr = is.dns = is.dnsAddress;
var dnsLabel = /^(?![0-9]+$)(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$/;
var dnsLabel = /^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$/;
var numbersLabel = /^([0-9]|[0-9][0-9\-]{0,61}[0-9])(\.([0-9]|[0-9][0-9\-]{0,61}[0-9]))*$/;

@@ -710,0 +714,0 @@ /**

{
"name": "is2",
"version": "1.0.1",
"version": "1.0.2",
"description": "A type checking library where each exported function returns either true or false and does not throw. Also added tests.",

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

@@ -913,5 +913,6 @@ 'use strict';

assert.equal(true, is.dns('stdarg'));
assert.equal(true, is.dns('stdarg.com'));
assert.equal(true, is.dns('www.stdarg.com'));
//assert.equal(false, is.dns('336.332'));
assert.equal(false, is.dns('336.332'));
assert.equal(true, is.dns('3stdarg.com'));

@@ -1291,3 +1292,6 @@ assert.equal(false, is.dns('192.168.0.2000000000'));

it('should return true for valid uuids ', function() {
assert.equal(false, is.uuid());
assert.equal(false, is.uuid(null));
assert.equal(false, is.uuid(-1));
assert.equal(false, is.uuid(-1));
assert.equal(false, is.uuid(false));

@@ -1311,1 +1315,25 @@ assert.equal(false, is.uuid('3678363'));

});
describe('is.hostAddress', function() {
it('should return true for valid uuids ', function() {
assert.equal(false, is.hostAddress());
assert.equal(false, is.hostAddress(null));
assert.equal(false, is.hostAddress(-1));
assert.equal(false, is.hostAddress(-1));
assert.equal(false, is.hostAddress(false));
assert.equal(false, is.hostAddress('3678363'));
assert.equal(false, is.hostAddress({}));
assert.equal(false, is.hostAddress([]));
assert.equal(false, is.hostAddress(6011090018648076));
assert.equal(false, is.hostAddress('1000000.10.1.1'));
assert.equal(true, is.hostAddress('192.168.1.1'));
assert.equal(true, is.hostAddress('10.10.1.1'));
assert.equal(true, is.hostAddress('www.google.com'));
assert.equal(true, is.hostAddress('finance.yahoo.com'));
assert.equal(true, is.hostAddress('google.com'));
assert.equal(true, is.hostAddress('google'));
assert.equal(true, is.hostAddress('close5-dev.5fxjas.0001.usw1.cache.amazonaws.com'));
});
});
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