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

bv-ui-core

Package Overview
Dependencies
Maintainers
12
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 0.14.5 to 0.14.6

6

karma.conf.js

@@ -26,5 +26,2 @@ /**

files: [
// We need the polyfill for testing es6 modules.
'node_modules/babel-polyfill/dist/polyfill.js',
// Loaded into the browser test page.

@@ -43,2 +40,5 @@ 'test/unit/mochaInit.js',

},
// We need the polyfill for testing es6 modules.
'node_modules/babel-polyfill/dist/polyfill.js',
],

@@ -45,0 +45,0 @@

@@ -9,35 +9,28 @@ /**

var waitForBody = require('../waitForBody');
var constructors = {};
// eslint-disable-next-line no-useless-escape
var constructorNameRegExp = /function\s+([^\(\s]+)/;
var constructorNameRegExp = /function\s+([^\(\s]+)/
var iframe;
var getOriginalConstructor = function getOriginalConstructor (constructor) {
return new Promise(function (resolve) {
waitForBody(function () {
var constructorName = constructor.name;
// IE11 doesn't have a constructor.name property, so just in case any other
// browsers also don't, use a simple regex to pull the constructor's name
// out of the .toString()'d function declaration, e.g. "function Array()"
if (!constructorName) {
constructorName = constructorNameRegExp.exec(constructor.toString())[1];
}
var constructorName = constructor.name;
// IE11 doesn't have a constructor.name property, so just in case any other
// browsers also don't, use a simple regex to pull the constructor's name
// out of the .toString()'d function declaration, e.g. "function Array()"
if (!constructorName) {
constructorName = constructorNameRegExp.exec(constructor.toString())[1];
}
if (!iframe) {
iframe = document.createElement('iframe');
iframe.src = 'about:blank';
document.body.appendChild(iframe);
}
if (!iframe) {
iframe = document.createElement('iframe');
iframe.src = 'about:blank';
document.head.appendChild(iframe);
}
if (!constructors[constructorName]) {
constructors[constructorName] = iframe.contentWindow[constructorName];
}
if (!constructors[constructorName]) {
constructors[constructorName] = iframe.contentWindow[constructorName];
}
resolve(constructors[constructorName]);
});
});
return constructors[constructorName];
};
module.exports = getOriginalConstructor;

@@ -6,12 +6,9 @@ # getOriginalConstructor

methods in their own primitives, or used a utility like Prototype.js, which
does that on its own. It returns a Promise that will be resolved with the
original primitive constructor.
does that on its own.
## Usage
```javascript
var getOriginalConstructor = require('bv-ui-core/lib/getOriginalConstructor');
var getOriginalConstructor = require('getOriginalConstructor');
getOriginalConstructor(Array).then(function (originalArray) {
originalArray.prototype.forEach(someNodeList, callback);
});
getOriginalConstructor(Array).prototype.forEach(someNodeList, callback);
```
{
"name": "bv-ui-core",
"version": "0.14.5",
"version": "0.14.6",
"license": "Apache 2.0",

@@ -5,0 +5,0 @@ "description": "Bazaarvoice UI-related JavaScript",

@@ -47,3 +47,2 @@ ![](https://travis-ci.org/bazaarvoice/bv-ui-core.svg)

- [evented](./lib/evented)
- [getOriginalConstructor](./lib/getOriginalConstructor)
- [global](./lib/global)

@@ -59,5 +58,4 @@ - [ie](./lib/ie)

- [staticAssetLoader](./lib/staticAssetLoader)
- [waitForBody](./lib/waitForBody)
[1]: ./CONTRIBUTING.md
[2]: https://nodejs.org/download/
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