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

bv-ui-core

Package Overview
Dependencies
Maintainers
1
Versions
50
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 0.3.0 to 0.4.0

CHANGELOG.md

2

CONTRIBUTING.md

@@ -32,3 +32,3 @@ # Contributing to bv-ui-core

return {
awesome : function (arg) {
awesome: function (arg) {
return $(arg);

@@ -35,0 +35,0 @@ }

@@ -1,10 +0,13 @@

// Karma configuration
var webpack = require('webpack');
/**
* @fileOverview
* Karma configuration.
*/
module.exports = function(config) {
module.exports = function (config) {
config.set({
plugins: [
require('karma-mocha'),
require('karma-chai'),
require('karma-webpack'),
require('karma-tap'),
require('karma-chrome-launcher'),

@@ -15,22 +18,39 @@ require('karma-phantomjs-launcher'),

// base path that will be used to resolve all patterns (eg. files, exclude)
// Base path that will be used to resolve all patterns (eg. files, exclude).
basePath: '',
// Frameworks to use.
// See: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai'],
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['tap'],
client: {
mocha: {
// Change Karma's debug.html to the mocha web reporter.
reporter: 'html',
ui: 'bdd'
}
},
// list of files / patterns to load in the browser
// list of files / patterns to load in the browser.
files: [
'test/**/*.js'
],
// Loaded into the browser test page.
'test/unit/mochaInit.js',
'test/unit/**/*.spec.js',
// list of files to exclude
exclude: [
// Made available but not loaded. Note that the path for loading these
// files is prefixed with 'base/'.
{
pattern: 'test/fixtures/**',
included: false,
served: true,
watched: true,
nocache: true
}
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
// List of files to exclude.
exclude: [],
// Preprocess matching files before serving them to the browser.
// See: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {

@@ -46,7 +66,7 @@ 'test/**/*.js': ['webpack']

webpack: {
node : {
node: {
fs: 'empty'
},
// https://github.com/deepsweet/istanbul-instrumenter-loader allows
// code coverage of just the things we want
// code coverage of just the things we want.
module: {

@@ -65,5 +85,4 @@ postLoaders: [{

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
// Test results reporter to use. Possible values: 'dots', 'progress'.
// See: https://npmjs.org/browse/keyword/karma-reporter
reporters: [

@@ -74,29 +93,30 @@ 'dots',

// web server port
// Web server port.
port: 9876,
// enable / disable colors in the output (reporters and logs)
// Enable / disable colors in the output (reporters and logs).
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
// Level of logging.
//
// possible values:
// config.LOG_DISABLE
// config.LOG_ERROR
// config.LOG_WARN
// config.LOG_INFO
// config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
// Enable / disable watching file and executing tests whenever any file
// changes.
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
// Start these browsers.
// See: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
// Continuous Integration mode. If true, Karma captures browsers, runs the
// tests and exits.
singleRun: false
})
});
};
# Body
This is a shorthand method for accessing the <body> element within the document. Not only is it shorter, it returns the current body of the current context. Also useful in non-browser environments by overloading the function to return an appropriate element.
This is a shorthand method for accessing the `<body>` element within the
document. Not only is it shorter, it returns the current body of the current
context. Also useful in non-browser environments by overloading the function to
return an appropriate element.

@@ -10,2 +13,2 @@ ## Usage

var body = body();
```
```

@@ -24,4 +24,4 @@ # checkHighContrast

if( checkHighContrast(body) ) {
... setup alternate styles ...
// ... setup alternative styles here ...
}
```

@@ -36,3 +36,3 @@ /**

module.exports = {
now : function () {
now: function () {
var func = (isNativeSupported) ? nativeImplementation : polyfillImplementation;

@@ -39,0 +39,0 @@ return func();

# Date.now
Uses `Date.now` when available and falls back to `new Date().getTime()` when needed to get the number of milliseconds elapsed since 1 Jan 1970 00:00:00 UTC
Uses `Date.now` when available and falls back to `new Date().getTime()` when
needed to get the number of milliseconds elapsed since 1 Jan 1970 00:00:00 UTC.
## Usage
```javascript
var date = require('date.now');
var date = require('date.now');
var now = date.now();
```
```

@@ -65,4 +65,4 @@ /**

var domain = {
isValid : false,
get : function (key) {
isValid: false,
get: function (key) {
return domainState[key];

@@ -69,0 +69,0 @@ }

# domainPolice
The `domainPolice` module provides a function that takes in an array of objects that represent a known whitelist of domains, as well as a particular URL, and provides an object with an API to get information about that domain.
The `domainPolice` module provides a function that takes a URL and an array of
objects representing a known whitelist of domains, and returns an object with a
simple API, representing the state of that URL in the whitelist.
The `domainPolice` module provides a function that takes a URL and an array of objects representing a known whitelist of domains, and returns an object with a simple API, representing the state of that URL in the whitelist.
## Module arguments

@@ -19,13 +19,13 @@

{
domain : '.bazaarvoice.com',
thirdPartyCookieEnabled : true
domain: '.bazaarvoice.com',
thirdPartyCookieEnabled: true
},
{
domain : '.localhost',
thirdPartyCookieEnabled : false,
commentsEnabled : true,
domain: '.localhost',
thirdPartyCookieEnabled: false,
commentsEnabled: true,
},
{
domain : 'no-prefixing-dot.foo.com',
commentsEnabled : true
domain: 'no-prefixing-dot.foo.com',
commentsEnabled: true
}

@@ -47,5 +47,8 @@ ];

`allowedDomains` is an array of objects, and each object is expected to have a `domain` property. It may also contain any other arbitrary properties as desired for later lookup.
`allowedDomains` is an array of objects, and each object is expected to have a
`domain` property. It may also contain any other arbitrary properties as desired
for later lookup.
The prefixing `.` on the `domain` will allow it to match all subdomains as well. Given the above example, the following domains are all valid:
Prefixing `.` on the `domain` will allow it to match all subdomains as well.
Given the above example, the following domains are all valid:

@@ -52,0 +55,0 @@ - `bazaarvoice.com`

# Global
Exposes the browser's `window` object for safe use elsewhere
Exposes the browser's `window` object for safe use elsewhere.
## Usage
```javascript
var global = require('global');
var global = require('bv-ui-core/lib/global');
var window = global;
```
```

@@ -28,11 +28,11 @@ /**

parseUri.options = {
strictMode : false,
key : ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],
q : {
name : 'queryKey',
parser : /(?:^|&)([^&=]*)=?([^&]*)/g
strictMode: false,
key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],
q: {
name: 'queryKey',
parser: /(?:^|&)([^&=]*)=?([^&]*)/g
},
parser : {
strict : /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
loose : /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
parser: {
strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
}

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

# parseUri
This utility parses a URI and returns an object that provides various parts of the URI. It is an adaptation of code published on [blog.stevenlevithan.com](http://blog.stevenlevithan.com/archives/parseuri).
This utility parses a URI and returns an object that provides various parts of
the URI. It is an adaptation of code published on [blog.stevenlevithan.com][1].

@@ -8,3 +9,3 @@ ## Usage

```javascript
var parseUri = require('bv-ui-core/lib/util/parseUri');
var parseUri = require('bv-ui-core/lib/parseUri');
var url = 'http://some.example.com';

@@ -15,3 +16,4 @@

The resulting `parsedUri` object in the above example has properties that represent the various parts of the provided URI.
The resulting `parsedUri` object in the above example has properties that
represent the various parts of the provided URI.

@@ -47,2 +49,5 @@ Given the following URL:

Of special note is the `queryKey` property; it provides a simple key/value representation of the query string parameters.
Of special note is the `queryKey` property; it provides a simple key/value
representation of the query string parameters.
[1]: http://blog.stevenlevithan.com/archives/parseuri

@@ -24,23 +24,23 @@ /**

var reservedNames = {
navigationStart : 1,
unloadEventStart : 1,
unloadEventEnd : 1,
redirectStart : 1,
redirectEnd : 1,
fetchStart : 1,
domainLookupStart : 1,
domainLookupEnd : 1,
connectStart : 1,
connectEnd : 1,
secureConnectionStart : 1,
requestStart : 1,
responseStart : 1,
responseEnd : 1,
domLoading : 1,
domInteractive : 1,
domContentLoadedEventStart : 1,
domContentLoadedEventEnd : 1,
domComplete : 1,
loadEventStart : 1,
loadEventEnd : 1
navigationStart: 1,
unloadEventStart: 1,
unloadEventEnd: 1,
redirectStart: 1,
redirectEnd: 1,
fetchStart: 1,
domainLookupStart: 1,
domainLookupEnd: 1,
connectStart: 1,
connectEnd: 1,
secureConnectionStart: 1,
requestStart: 1,
responseStart: 1,
responseEnd: 1,
domLoading: 1,
domInteractive: 1,
domContentLoadedEventStart: 1,
domContentLoadedEventEnd: 1,
domComplete: 1,
loadEventStart: 1,
loadEventEnd: 1
};

@@ -80,6 +80,6 @@

var record = {
entryType : 'mark',
name : name,
startTime : perfNow.now(),
duration : 0
entryType: 'mark',
name: name,
startTime: perfNow.now(),
duration: 0
};

@@ -97,3 +97,3 @@

*/
mark : function (name) {
mark: function (name) {
// Note: because the implementation functions explicitly check their number of arguments,

@@ -100,0 +100,0 @@ // we want to preserve the calls exactly as they came in

@@ -59,3 +59,3 @@ /**

module.exports = {
now : function () {
now: function () {
var func = (isNativeSupported) ? nativeImplementation : polyfillImplementation;

@@ -62,0 +62,0 @@ return func();

@@ -7,8 +7,9 @@ # Performance

Ported from Firebird's scout directory, and based on https://gist.github.com/paulirish/5438650
Ported from Bazaarvoice internal code and based on [a Paul Irish polyfill][1].
### Usage
```javascript
var perfNow = require('performance/now.js');
var timing = perfNow.now();

@@ -18,13 +19,19 @@ ```

### Notes
This is not a true polyfill in browsers that do not implement the Navigation Timing API. Rather than returning the time elapsed since `navigationStart`, it will return the time elapsed since the polyfill was installed.
This is not a true polyfill in browsers that do not implement the Navigation
Timing API. Rather than returning the time elapsed since `navigationStart`, it
will return the time elapsed since the polyfill was installed.
## Performance/mark
Ported from Firebird's scout directory
Also ported from Bazaarvoice internal code.
### Usage
```javascript
var perfMark = require('performance/mark.js');
perfMark.mark('mark-name');
```
```
[1]: https://gist.github.com/paulirish/5438650
{
"name": "bv-ui-core",
"version": "0.3.0",
"version": "0.4.0",
"license": "Apache 2.0",

@@ -11,3 +11,3 @@ "description": "Bazaarvoice UI-related JavaScript",

"scripts": {
"lint": "eslint lib test",
"lint": "eslint karma.conf.js lib test",
"test": "./node_modules/karma/bin/karma start --single-run --browsers PhantomJS",

@@ -18,21 +18,21 @@ "dev": "./node_modules/karma/bin/karma start --browsers Chrome"

"devDependencies": {
"eslint": "^0.24.1",
"ghooks": "^0.3.2",
"istanbul-instrumenter-loader": "^0.1.3",
"karma": "^0.13.9",
"karma-chrome-launcher": "^0.2.0",
"karma-coverage": "^0.4.2",
"karma-firefox-launcher": "^0.1.6",
"karma-htmlfile-reporter": "^0.2.1",
"karma-phantomjs-launcher": "^0.2.0",
"karma-tap": "^1.0.3",
"karma-webpack": "^1.6.0",
"node-libs-browser": "^0.5.2",
"phantomjs": "^1.9.17",
"tape": "^4.0.0",
"webpack": "^1.10.1"
"eslint": "1.3.1",
"ghooks": "0.3.2",
"istanbul-instrumenter-loader": "0.1.3",
"karma": "0.13.9",
"karma-chrome-launcher": "0.2.0",
"karma-coverage": "0.5.1",
"karma-chai": "0.1.0",
"karma-firefox-launcher": "0.1.6",
"karma-htmlfile-reporter": "0.2.2",
"karma-phantomjs-launcher": "0.2.1",
"karma-mocha": "0.2.0",
"karma-webpack": "1.7.0",
"node-libs-browser": "0.5.2",
"phantomjs": "1.9.18",
"webpack": "1.12.0"
},
"config": {
"ghooks": {
"pre-commit": "node_modules/.bin/eslint lib test",
"pre-commit": "npm run lint",
"pre-push": "npm run lint && npm test"

@@ -39,0 +39,0 @@ }

@@ -5,11 +5,18 @@ ![](https://magnum.travis-ci.com/bazaarvoice/bv-ui-core.svg?token=hwKyg8j4RFg7BgmSksac&branch=master)

This project provides a central location for common Bazaarvoice UI code. It is intended to be installed into a project via npm. Individual modules are authored as CommonJS modules, to be consumed by Webpack or another build tool that can ingest CommonJS.
This project provides a central location for common Bazaarvoice UI code. It is
intended to be installed into a project via NPM. Individual modules are authored
as CommonJS modules, to be consumed by Webpack or another build tool that can
ingest CommonJS.
**This is a public repository.** Please see the [contribution guidelines]](./CONTRIBUTING.md) for details on contributing to this repo.
**This is a public repository.** Please see the [contribution guidelines][1] for
details on contributing to this repo.
## Installation
You will need npm to add this to your project; it is installed when you install Node, so it is likely that you already have it. If not, you can install Node using an [installer](https://nodejs.org/download/), or by using your favorite package manater (such as Homebrew).
You will need NPM to add this to your project; it is installed when you install
Node, so it is likely that you already have it. If not, you can install Node
using an [installer][2], or by using your favorite package manager (such as
Homebrew).
Once you have npm, you can install bv-ui-core:
Once you have NPM, you can install bv-ui-core as follows:

@@ -29,2 +36,20 @@ ```bash

For details on how to use individual modules, see the README inside the module's directory.
For details on how to use a specific module, see the README document in the
module's directory.
## Modules
- [body](./lib/body)
- [checkHighContrast](./lib/checkHighContrast)
- [cookie](./lib/cookie)
- [date.now](./lib/date.now)
- [domainPolice](./lib/domainPolice)
- [evented](./lib/evented)
- [global](./lib/global)
- [ie](./lib/ie)
- [loader](./lib/loader)
- [parseUri](./lib/parseUri)
- [performance](./lib/performance)
[1]: ./CONTRIBUTING.md
[2]: https://nodejs.org/download/

Sorry, the diff of this file is not supported yet

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