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

bv-ui-core

Package Overview
Dependencies
Maintainers
10
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bv-ui-core - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

yarn.lock

4

lib/domainPolice/index.js

@@ -35,3 +35,3 @@ /**

*
* @param {String} url The URL to check (including protocol, e.g. "http://example.com")
* @param {String} url The URL to check
* @param {Array} domains The set of domain objects to check the URL against

@@ -59,3 +59,3 @@ * @return {Object} The matching domain object from the array of provided domains

*
* @param {String} url The URL to check (including protocol, e.g. "http://example.com")
* @param {String} url The URL to check
* @param {Array} domains The set of domain objects to check the URL against

@@ -62,0 +62,0 @@ * @return {Object} An object representing the state of the matched domain

@@ -9,3 +9,3 @@ # domainPolice

- `url`: The particular URL to be validated as a string.
- `url`: The particular URL to be validated as a string. Ports and protocols are not validated.
- `allowedDomains`: An array of objects representing whitelisted arrays.

@@ -34,3 +34,3 @@

var bvCop = domainPolice('http://www.bazaarvoice.com', allowedDomains);
var bvCop = domainPolice('www.bazaarvoice.com', allowedDomains);
bvCop.isValid; // => true

@@ -41,3 +41,3 @@ bvCop.get('domain'); // => '.bazaarvoice.com'

var nopeCop = domainPolice('http://ww.w.foo.com');
var nopeCop = domainPolice('ww.w.foo.com');
nopeCop.isValid; // => false

@@ -44,0 +44,0 @@ nopeCop.get('anything'); // => undefined

@@ -34,5 +34,9 @@ /**

},
// Both of these parser regexes have been edited from the original linked above.
// A / character has been added to the excluded characters in the 4th and 5th
// capture groups to fix a bug where it would see a @ character in a query
// and consume it like it was delimiting a userInfo section.
parser: {
strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:\/@]*)(?::([^\/:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^\/:@]*)(?::([^:\/@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
}

@@ -39,0 +43,0 @@ };

{
"name": "bv-ui-core",
"version": "1.2.0",
"version": "1.2.1",
"license": "Apache 2.0",

@@ -19,7 +19,7 @@ "description": "Bazaarvoice UI-related JavaScript",

"devDependencies": {
"babel-core": "^6.13.2",
"babel-loader": "^6.2.5",
"babel-plugin-lodash": "^3.2.8",
"babel-polyfill": "^6.13.0",
"babel-preset-es2015": "^6.13.2",
"babel-core": "^6.26.3",
"babel-loader": "^6.4.1",
"babel-plugin-lodash": "^3.3.4",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"chai": "^3.5.0",

@@ -29,21 +29,21 @@ "eslint": "2.2.0",

"istanbul-instrumenter-loader": "0.2.0",
"json-loader": "^0.5.4",
"karma": "^1.2.0",
"json-loader": "^0.5.7",
"karma": "^3.0.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "2.0.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.0",
"karma-htmlfile-reporter": "^0.3.4",
"karma-mocha": "^1.1.1",
"karma-phantomjs-launcher": "^1.0.1",
"karma-coverage": "^1.1.2",
"karma-firefox-launcher": "^1.1.0",
"karma-htmlfile-reporter": "^0.3.6",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sinon": "^1.0.5",
"karma-sinon-chai": "^1.2.3",
"karma-sinon-chai": "^1.3.4",
"karma-webpack": "^1.7.0",
"lodash": "^4.15.0",
"mocha": "^3.0.2",
"lodash": "^4.17.10",
"mocha": "^5.2.0",
"node-libs-browser": "1.0.0",
"phantomjs": "^2.1.7",
"sinon": "^1.17.5",
"sinon-chai": "^2.8.0",
"webpack": "^1.13.2"
"sinon": "^4.5.0",
"sinon-chai": "^2.14.0",
"webpack": "^1.15.0"
},

@@ -50,0 +50,0 @@ "config": {

@@ -32,2 +32,23 @@ /**

it('correctly parses a simple URL without protocol', function () {
var url = 'www.example.com';
var parsedUri = parseUri(url);
expect(parsedUri.anchor).to.equal('');
expect(parsedUri.query).to.equal('');
expect(parsedUri.file).to.equal('');
expect(parsedUri.directory).to.equal('');
expect(parsedUri.path).to.equal('');
expect(parsedUri.relative).to.equal('');
expect(parsedUri.port).to.equal('');
expect(parsedUri.host).to.equal('www.example.com');
expect(parsedUri.password).to.equal('');
expect(parsedUri.user).to.equal('');
expect(parsedUri.userInfo).to.equal('');
expect(parsedUri.authority).to.equal('www.example.com');
expect(parsedUri.protocol).to.equal('');
expect(parsedUri.source).to.equal(url);
expect(parsedUri.queryKey).to.eql({});
});
it('correctly parses a complex URL', function () {

@@ -54,2 +75,65 @@ var url = 'https://bob:smith@subdomain.example.com:8080/path/to/file.html?foo=bar&baz=3#hash';

it('correctly parses a complex URL without protocol', function () {
var url = 'www.example.com/foo/?bar=baz&inga=42&quux';
var parsedUri = parseUri(url);
expect(parsedUri.anchor).to.equal('');
expect(parsedUri.query).to.equal('bar=baz&inga=42&quux');
expect(parsedUri.file).to.equal('');
expect(parsedUri.directory).to.equal('/foo/');
expect(parsedUri.path).to.equal('/foo/');
expect(parsedUri.relative).to.equal('/foo/?bar=baz&inga=42&quux');
expect(parsedUri.port).to.equal('');
expect(parsedUri.host).to.equal('www.example.com');
expect(parsedUri.password).to.equal('');
expect(parsedUri.user).to.equal('');
expect(parsedUri.userInfo).to.equal('');
expect(parsedUri.authority).to.equal('www.example.com');
expect(parsedUri.protocol).to.equal('');
expect(parsedUri.source).to.equal(url);
expect(parsedUri.queryKey).to.eql({ bar: 'baz', inga: '42', quux: '' });
});
it('correctly parses a URL with the @ symbol in the query', function () {
var url = 'https://foo-bar-baz.example.net/on/website.store/apple-gamma-tao/en_GB/makeAsite-doAThing?id=name@site.com&&pid=13897423';
var parsedUri = parseUri(url);
expect(parsedUri.anchor).to.equal('');
expect(parsedUri.query).to.equal('id=name@site.com&&pid=13897423');
expect(parsedUri.file).to.equal('');
expect(parsedUri.directory).to.equal('/on/website.store/apple-gamma-tao/en_GB/makeAsite-doAThing');
expect(parsedUri.path).to.equal('/on/website.store/apple-gamma-tao/en_GB/makeAsite-doAThing');
expect(parsedUri.relative).to.equal('/on/website.store/apple-gamma-tao/en_GB/makeAsite-doAThing?id=name@site.com&&pid=13897423');
expect(parsedUri.port).to.equal('');
expect(parsedUri.host).to.equal('foo-bar-baz.example.net');
expect(parsedUri.password).to.equal('');
expect(parsedUri.user).to.equal('');
expect(parsedUri.userInfo).to.equal('');
expect(parsedUri.authority).to.equal('foo-bar-baz.example.net');
expect(parsedUri.protocol).to.equal('https');
expect(parsedUri.source).to.equal(url);
expect(parsedUri.queryKey).to.eql({ id: 'name@site.com', pid: '13897423' });
})
it('correctly parses an oddly fragmented URL', function () {
var url = 'http://code.example.com/events/#&product=browser';
var parsedUri = parseUri(url);
expect(parsedUri.anchor).to.equal('&product=browser');
expect(parsedUri.query).to.equal('');
expect(parsedUri.file).to.equal('');
expect(parsedUri.directory).to.equal('/events/');
expect(parsedUri.path).to.equal('/events/');
expect(parsedUri.relative).to.equal('/events/#&product=browser');
expect(parsedUri.port).to.equal('');
expect(parsedUri.host).to.equal('code.example.com');
expect(parsedUri.password).to.equal('');
expect(parsedUri.user).to.equal('');
expect(parsedUri.userInfo).to.equal('');
expect(parsedUri.authority).to.equal('code.example.com');
expect(parsedUri.protocol).to.equal('http');
expect(parsedUri.source).to.equal(url);
expect(parsedUri.queryKey).to.eql({});
});
});

@@ -23,3 +23,3 @@ /**

sinonSandbox = sinon.sandbox.create();
stub = sinonSandbox.stub(module, 'getDimensions', function () {
stub = sinonSandbox.stub(module, 'getDimensions').callsFake(function () {
return {

@@ -26,0 +26,0 @@ width: 500,

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