New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

isnot

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isnot - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

16

lib/strings.js

@@ -19,2 +19,14 @@ var isString = arg => typeof arg === 'string'

var isURL = (arg) => {
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|'+ // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator
return pattern.test(arg);
}
var isNotURL = (arg) => !isURL(arg)
module.exports = {

@@ -29,3 +41,5 @@ isString: isString,

isVariableName: isVariableName,
isNotVariableName: isNotVariableName
isNotVariableName: isNotVariableName,
isURL: isURL,
isNotURL: isNotURL
}

2

package.json
{
"name": "isnot",
"version": "0.1.0",
"version": "0.2.0",
"description": "All imaginable type checking utils with negation",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -11,3 +11,5 @@ var expect = require("chai").expect;

isVariableName,
isNotVariableName
isNotVariableName,
isURL,
isNotURL
} = require("../lib/strings");

@@ -95,2 +97,14 @@

});
describe("isURL", function() {
it("checks correctly", function() {
expect(isURL('a@a.a')).to.equal(false);
expect(isURL('')).to.equal(false);
expect(isURL('localhost')).to.equal(true);
expect(isURL('http://localhost')).to.equal(true);
expect(isURL('https://localhost')).to.equal(true);
expect(isURL('//localhost')).to.equal(false);
expect(isURL('bim.bam')).to.equal(true);
});
});
});
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