Socket
Socket
Sign inDemoInstall

cross-domain-safe-weakmap

Package Overview
Dependencies
2
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.25 to 1.0.26

137

dist/cross-domain-safe-weakmap.js

@@ -41,10 +41,7 @@ !function(root, factory) {

}({
"./node_modules/cross-domain-utils/src/constants.js": function(module, __webpack_exports__, __webpack_require__) {
"./src/index.js": function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.d(__webpack_exports__, "a", function() {
return PROTOCOL;
Object.defineProperty(__webpack_exports__, "__esModule", {
value: !0
});
__webpack_require__.d(__webpack_exports__, "b", function() {
return WILDCARD;
});
var PROTOCOL = {

@@ -54,21 +51,38 @@ MOCK: "mock:",

ABOUT: "about:"
}, WILDCARD = "*";
},
"./node_modules/cross-domain-utils/src/index.js": function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var __WEBPACK_IMPORTED_MODULE_0__utils__ = __webpack_require__("./node_modules/cross-domain-utils/src/utils.js");
__webpack_require__.d(__webpack_exports__, "isWindow", function() {
return __WEBPACK_IMPORTED_MODULE_0__utils__.a;
});
__webpack_require__.d(__webpack_exports__, "isWindowClosed", function() {
return __WEBPACK_IMPORTED_MODULE_0__utils__.b;
});
var __WEBPACK_IMPORTED_MODULE_1__types__ = __webpack_require__("./node_modules/cross-domain-utils/src/types.js");
__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__types__), __webpack_require__("./node_modules/cross-domain-utils/src/constants.js");
},
"./node_modules/cross-domain-utils/src/types.js": function(module, exports) {},
"./node_modules/cross-domain-utils/src/utils.js": function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var constants = __webpack_require__("./node_modules/cross-domain-utils/src/constants.js");
__webpack_exports__.b = function(win) {
}, IE_WIN_ACCESS_ERROR = "Call was rejected by callee.\r\n";
function isAboutProtocol() {
return (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : window).location.protocol === PROTOCOL.ABOUT;
}
function canReadFromWindow(win) {
try {
win && win.location && win.location.href;
return !0;
} catch (err) {}
return !1;
}
function getActualDomain(win) {
var location = (win = win || window).location;
if (!location) throw new Error("Can not read window location");
var protocol = location.protocol;
if (!protocol) throw new Error("Can not read window protocol");
if (protocol === PROTOCOL.FILE) return PROTOCOL.FILE + "//";
if (protocol === PROTOCOL.ABOUT) {
var parent = function() {
var win = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : window;
if (win) try {
if (win.parent && win.parent !== win) return win.parent;
} catch (err) {}
}(win);
return parent && canReadFromWindow(parent) ? getActualDomain(parent) : PROTOCOL.ABOUT + "//";
}
var host = location.host;
if (!host) throw new Error("Can not read window host");
return protocol + "//" + host;
}
function getDomain(win) {
var domain = getActualDomain(win = win || window);
return domain && win.mockDomain && 0 === win.mockDomain.indexOf(PROTOCOL.MOCK) ? win.mockDomain : domain;
}
var iframeWindows = [], iframeFrames = [];
function isWindowClosed(win) {
var allowMock = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];

@@ -135,4 +149,4 @@ try {

return !1;
};
__webpack_exports__.a = function(obj) {
}
function isWindow(obj) {
try {

@@ -169,3 +183,3 @@ if (obj === window) return !0;

try {
obj && obj.__cross_domain_utils_window_check__;
if (obj && "__unlikely_value__" === obj.__cross_domain_utils_window_check__) return !1;
} catch (err) {

@@ -175,49 +189,4 @@ return !0;

return !1;
};
var IE_WIN_ACCESS_ERROR = "Call was rejected by callee.\r\n";
function isAboutProtocol() {
return (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : window).location.protocol === constants.a.ABOUT;
}
function canReadFromWindow(win) {
try {
win && win.location && win.location.href;
return !0;
} catch (err) {}
return !1;
}
function getActualDomain(win) {
var location = (win = win || window).location;
if (!location) throw new Error("Can not read window location");
var protocol = location.protocol;
if (!protocol) throw new Error("Can not read window protocol");
if (protocol === constants.a.FILE) return constants.a.FILE + "//";
if (protocol === constants.a.ABOUT) {
var parent = function(win) {
if (win) try {
if (win.parent && win.parent !== win) return win.parent;
} catch (err) {}
}(win);
return parent && canReadFromWindow(parent) ? getActualDomain(parent) : constants.a.ABOUT + "//";
}
var host = location.host;
if (!host) throw new Error("Can not read window host");
return protocol + "//" + host;
}
function getDomain(win) {
var domain = getActualDomain(win = win || window);
return domain && win.mockDomain && 0 === win.mockDomain.indexOf(constants.a.MOCK) ? win.mockDomain : domain;
}
var iframeWindows = [], iframeFrames = [];
},
"./src/index.js": function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", {
value: !0
});
var interface_namespaceObject = {};
__webpack_require__.d(interface_namespaceObject, "WeakMap", function() {
return weakmap_CrossDomainSafeWeakMap;
});
var src = __webpack_require__("./node_modules/cross-domain-utils/src/index.js");
function safeIndexOf(collection, item) {
function util_safeIndexOf(collection, item) {
for (var i = 0; i < collection.length; i++) try {

@@ -228,3 +197,3 @@ if (collection[i] === item) return i;

}
var defineProperty = Object.defineProperty, counter = Date.now() % 1e9, weakmap_CrossDomainSafeWeakMap = function() {
var weakmap_CrossDomainSafeWeakMap = function() {
function CrossDomainSafeWeakMap() {

@@ -234,4 +203,3 @@ !function(instance, Constructor) {

}(this);
counter += 1;
this.name = "__weakmap_" + (1e9 * Math.random() >>> 0) + "__" + counter;
this.name = "__weakmap_" + (1e9 * Math.random() >>> 0) + "__";
if (function() {

@@ -257,3 +225,3 @@ if ("undefined" == typeof WeakMap) return !1;

var value = keys[i];
if (Object(src.isWindow)(value) && Object(src.isWindowClosed)(value)) {
if (isWindow(value) && isWindowClosed(value)) {
if (weakmap) try {

@@ -269,3 +237,3 @@ weakmap.delete(value);

CrossDomainSafeWeakMap.prototype.isSafeToReadWrite = function(key) {
if (Object(src.isWindow)(key)) return !1;
if (isWindow(key)) return !1;
try {

@@ -289,3 +257,3 @@ key && key.self;

var name = this.name, entry = key[name];
entry && entry[0] === key ? entry[1] = value : defineProperty(key, name, {
entry && entry[0] === key ? entry[1] = value : Object.defineProperty(key, name, {
value: [ key, value ],

@@ -297,3 +265,3 @@ writable: !0

this._cleanupClosedWindows();
var keys = this.keys, values = this.values, index = safeIndexOf(keys, key);
var keys = this.keys, values = this.values, index = util_safeIndexOf(keys, key);
if (-1 === index) {

@@ -317,3 +285,3 @@ keys.push(key);

this._cleanupClosedWindows();
var index = safeIndexOf(this.keys, key);
var index = util_safeIndexOf(this.keys, key);
if (-1 !== index) return this.values[index];

@@ -334,3 +302,3 @@ };

this._cleanupClosedWindows();
var keys = this.keys, index = safeIndexOf(keys, key);
var keys = this.keys, index = util_safeIndexOf(keys, key);
if (-1 !== index) {

@@ -354,3 +322,3 @@ keys.splice(index, 1);

this._cleanupClosedWindows();
return -1 !== safeIndexOf(this.keys, key);
return -1 !== util_safeIndexOf(this.keys, key);
};

@@ -368,3 +336,2 @@ CrossDomainSafeWeakMap.prototype.getOrSet = function(key, getter) {

});
__webpack_exports__.default = interface_namespaceObject;
}

@@ -371,0 +338,0 @@ });

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("xdsweakmap",[],e):"object"==typeof exports?exports.xdsweakmap=e():t.xdsweakmap=e()}("undefined"!=typeof self?self:this,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1)}([function(t,e,r){"use strict";r.d(e,"a",function(){return n}),r.d(e,"b",function(){return i});var n={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},i="*"},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={};r.d(n,"WeakMap",function(){return u});var i=r(2);function a(t,e){for(var r=0;r<t.length;r++)try{if(t[r]===e)return r}catch(t){}return-1}var o=Object.defineProperty,c=Date.now()%1e9,u=function(){function t(){if(function(e,r){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),c+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+c,function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var t=new WeakMap,e={};return Object.freeze(e),t.set(e,"__testvalue__"),"__testvalue__"===t.get(e)}catch(t){return!1}}())try{this.weakmap=new WeakMap}catch(t){}this.keys=[],this.values=[]}return t.prototype._cleanupClosedWindows=function(){for(var t=this.weakmap,e=this.keys,r=0;r<e.length;r++){var n=e[r];if(Object(i.isWindow)(n)&&Object(i.isWindowClosed)(n)){if(t)try{t.delete(n)}catch(t){}e.splice(r,1),this.values.splice(r,1),r-=1}}},t.prototype.isSafeToReadWrite=function(t){if(Object(i.isWindow)(t))return!1;try{t&&t.self,t&&t[this.name]}catch(t){return!1}return!0},t.prototype.set=function(t,e){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.set(t,e)}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var n=this.name,i=t[n];return void(i&&i[0]===t?i[1]=e:o(t,n,{value:[t,e],writable:!0}))}catch(t){}this._cleanupClosedWindows();var c=this.keys,u=this.values,s=a(c,t);-1===s?(c.push(t),u.push(e)):u[s]=e},t.prototype.get=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(t))return e.get(t)}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var r=t[this.name];return r&&r[0]===t?r[1]:void 0}catch(t){}this._cleanupClosedWindows();var n=a(this.keys,t);if(-1!==n)return this.values[n]},t.prototype.delete=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.delete(t)}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var r=t[this.name];r&&r[0]===t&&(r[0]=r[1]=void 0)}catch(t){}this._cleanupClosedWindows();var n=this.keys,i=a(n,t);-1!==i&&(n.splice(i,1),this.values.splice(i,1))},t.prototype.has=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(t))return!0}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var r=t[this.name];return!(!r||r[0]!==t)}catch(t){}return this._cleanupClosedWindows(),-1!==a(this.keys,t)},t.prototype.getOrSet=function(t,e){if(this.has(t))return this.get(t);var r=e();return this.set(t,r),r},t}();r.d(e,"WeakMap",function(){return u}),e.default=n},function(t,e,r){"use strict";var n=r(3);r.d(e,"isWindow",function(){return n.a}),r.d(e,"isWindowClosed",function(){return n.b});var i=r(4);r.n(i),r(0)},function(t,e,r){"use strict";var n=r(0);e.b=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{if(t===window)return!1}catch(t){return!0}try{if(!t)return!0}catch(t){return!0}try{if(t.closed)return!0}catch(t){return!t||t.message!==i}if(e&&function(t){if(!function(t){try{if(t===window)return!0}catch(t){}try{var e=Object.getOwnPropertyDescriptor(t,"location");if(e&&!1===e.enumerable)return!1}catch(t){}try{if(a(t)&&o(t))return!0}catch(t){}try{if(c(t)===c(window))return!0}catch(t){}return!1}(t))return!1;try{if(t===window)return!0;if(a(t)&&o(t))return!0;if(u(window)===u(t))return!0}catch(t){}return!1}(t))try{if(t.mockclosed)return!0}catch(t){}try{if(!t.parent||!t.top)return!0}catch(t){}var r=function(t,e){for(var r=0;r<t.length;r++)try{if(t[r]===e)return r}catch(t){}return-1}(s,t);if(-1!==r){var n=f[r];if(n&&function(t){if(!t.contentWindow)return!0;if(!t.parentNode)return!0;var e=t.ownerDocument;return!(!e||!e.documentElement||e.documentElement.contains(t))}(n))return!0}return!1},e.a=function(t){try{if(t===window)return!0}catch(t){if(t&&t.message===i)return!0}try{if("[object Window]"===Object.prototype.toString.call(t))return!0}catch(t){if(t&&t.message===i)return!0}try{if(window.Window&&t instanceof window.Window)return!0}catch(t){if(t&&t.message===i)return!0}try{if(t&&t.self===t)return!0}catch(t){if(t&&t.message===i)return!0}try{if(t&&t.parent===t)return!0}catch(t){if(t&&t.message===i)return!0}try{if(t&&t.top===t)return!0}catch(t){if(t&&t.message===i)return!0}try{t&&t.__cross_domain_utils_window_check__}catch(t){return!0}return!1};var i="Call was rejected by callee.\r\n";function a(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===n.a.ABOUT}function o(t){try{return t&&t.location&&t.location.href,!0}catch(t){}return!1}function c(t){var e=(t=t||window).location;if(!e)throw new Error("Can not read window location");var r=e.protocol;if(!r)throw new Error("Can not read window protocol");if(r===n.a.FILE)return n.a.FILE+"//";if(r===n.a.ABOUT){var i=function(t){if(t)try{if(t.parent&&t.parent!==t)return t.parent}catch(t){}}(t);return i&&o(i)?c(i):n.a.ABOUT+"//"}var a=e.host;if(!a)throw new Error("Can not read window host");return r+"//"+a}function u(t){var e=c(t=t||window);return e&&t.mockDomain&&0===t.mockDomain.indexOf(n.a.MOCK)?t.mockDomain:e}var s=[],f=[]},function(t,e){}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("xdsweakmap",[],e):"object"==typeof exports?exports.xdsweakmap=e():t.xdsweakmap=e()}("undefined"!=typeof self?self:this,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={MOCK:"mock:",FILE:"file:",ABOUT:"about:"},i="Call was rejected by callee.\r\n";function a(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===n.ABOUT}function o(t){try{return t&&t.location&&t.location.href,!0}catch(t){}return!1}function c(t){var e=(t=t||window).location;if(!e)throw new Error("Can not read window location");var r=e.protocol;if(!r)throw new Error("Can not read window protocol");if(r===n.FILE)return n.FILE+"//";if(r===n.ABOUT){var i=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;if(t)try{if(t.parent&&t.parent!==t)return t.parent}catch(t){}}(t);return i&&o(i)?c(i):n.ABOUT+"//"}var a=e.host;if(!a)throw new Error("Can not read window host");return r+"//"+a}function u(t){var e=c(t=t||window);return e&&t.mockDomain&&0===t.mockDomain.indexOf(n.MOCK)?t.mockDomain:e}var f=[],s=[];function h(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{if(t===window)return!1}catch(t){return!0}try{if(!t)return!0}catch(t){return!0}try{if(t.closed)return!0}catch(t){return!t||t.message!==i}if(e&&function(t){if(!function(t){try{if(t===window)return!0}catch(t){}try{var e=Object.getOwnPropertyDescriptor(t,"location");if(e&&!1===e.enumerable)return!1}catch(t){}try{if(a(t)&&o(t))return!0}catch(t){}try{if(c(t)===c(window))return!0}catch(t){}return!1}(t))return!1;try{if(t===window)return!0;if(a(t)&&o(t))return!0;if(u(window)===u(t))return!0}catch(t){}return!1}(t))try{if(t.mockclosed)return!0}catch(t){}try{if(!t.parent||!t.top)return!0}catch(t){}var r=function(t,e){for(var r=0;r<t.length;r++)try{if(t[r]===e)return r}catch(t){}return-1}(f,t);if(-1!==r){var n=s[r];if(n&&function(t){if(!t.contentWindow)return!0;if(!t.parentNode)return!0;var e=t.ownerDocument;return!(!e||!e.documentElement||e.documentElement.contains(t))}(n))return!0}return!1}function p(t){try{if(t===window)return!0}catch(t){if(t&&t.message===i)return!0}try{if("[object Window]"===Object.prototype.toString.call(t))return!0}catch(t){if(t&&t.message===i)return!0}try{if(window.Window&&t instanceof window.Window)return!0}catch(t){if(t&&t.message===i)return!0}try{if(t&&t.self===t)return!0}catch(t){if(t&&t.message===i)return!0}try{if(t&&t.parent===t)return!0}catch(t){if(t&&t.message===i)return!0}try{if(t&&t.top===t)return!0}catch(t){if(t&&t.message===i)return!0}try{if(t&&"__unlikely_value__"===t.__cross_domain_utils_window_check__)return!1}catch(t){return!0}return!1}function d(t,e){for(var r=0;r<t.length;r++)try{if(t[r]===e)return r}catch(t){}return-1}var l=function(){function t(){if(function(e,r){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var t=new WeakMap,e={};return Object.freeze(e),t.set(e,"__testvalue__"),"__testvalue__"===t.get(e)}catch(t){return!1}}())try{this.weakmap=new WeakMap}catch(t){}this.keys=[],this.values=[]}return t.prototype._cleanupClosedWindows=function(){for(var t=this.weakmap,e=this.keys,r=0;r<e.length;r++){var n=e[r];if(p(n)&&h(n)){if(t)try{t.delete(n)}catch(t){}e.splice(r,1),this.values.splice(r,1),r-=1}}},t.prototype.isSafeToReadWrite=function(t){if(p(t))return!1;try{t&&t.self,t&&t[this.name]}catch(t){return!1}return!0},t.prototype.set=function(t,e){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.set(t,e)}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var n=this.name,i=t[n];return void(i&&i[0]===t?i[1]=e:Object.defineProperty(t,n,{value:[t,e],writable:!0}))}catch(t){}this._cleanupClosedWindows();var a=this.keys,o=this.values,c=d(a,t);-1===c?(a.push(t),o.push(e)):o[c]=e},t.prototype.get=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(t))return e.get(t)}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var r=t[this.name];return r&&r[0]===t?r[1]:void 0}catch(t){}this._cleanupClosedWindows();var n=d(this.keys,t);if(-1!==n)return this.values[n]},t.prototype.delete=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{e.delete(t)}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var r=t[this.name];r&&r[0]===t&&(r[0]=r[1]=void 0)}catch(t){}this._cleanupClosedWindows();var n=this.keys,i=d(n,t);-1!==i&&(n.splice(i,1),this.values.splice(i,1))},t.prototype.has=function(t){if(!t)throw new Error("WeakMap expected key");var e=this.weakmap;if(e)try{if(e.has(t))return!0}catch(t){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var r=t[this.name];return!(!r||r[0]!==t)}catch(t){}return this._cleanupClosedWindows(),-1!==d(this.keys,t)},t.prototype.getOrSet=function(t,e){if(this.has(t))return this.get(t);var r=e();return this.set(t,r),r},t}();r.d(e,"WeakMap",function(){return l})}])});
//# sourceMappingURL=cross-domain-safe-weakmap.min.js.map

@@ -1,7 +0,1 @@

// eslint-disable-next-line import/no-namespace
import * as INTERFACE from './interface';
export * from './interface';
export default INTERFACE;
export { CrossDomainSafeWeakMap as WeakMap } from './weakmap';

@@ -8,5 +8,2 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var defineProperty = Object.defineProperty;
var counter = Date.now() % 1e9;
export var CrossDomainSafeWeakMap = function () {

@@ -16,6 +13,4 @@ function CrossDomainSafeWeakMap() {

counter += 1;
// eslint-disable-next-line no-bitwise
this.name = '__weakmap_' + (Math.random() * 1e9 >>> 0) + '__' + counter;
this.name = '__weakmap_' + (Math.random() * 1e9 >>> 0) + '__';

@@ -100,3 +95,3 @@ if (hasNativeWeakMap()) {

} else {
defineProperty(key, name, {
Object.defineProperty(key, name, {
value: [key, value],

@@ -103,0 +98,0 @@ writable: true

{
"name": "cross-domain-safe-weakmap",
"version": "1.0.25",
"version": "1.0.26",
"description": "Cross domain safe WeakMap.",

@@ -11,3 +11,2 @@ "main": "index.js",

"flow": "flow",
"flow:build": "flow gen-flow-files ./src/index.js --out-dir ./dist/module",
"karma": "cross-env NODE_ENV=test babel-node --plugins=transform-es2015-modules-commonjs ./node_modules/.bin/karma start",

@@ -17,3 +16,3 @@ "babel": "babel src/ --out-dir dist/module",

"test": "npm run lint && npm run flow-typed && npm run flow && npm run karma",
"build": "npm run test && npm run babel && npm run webpack && npm run flow:build",
"build": "npm run test && npm run babel && npm run webpack",
"release": "./publish.sh",

@@ -47,3 +46,3 @@ "release:patch": "./publish.sh patch",

"devDependencies": {
"flow-bin": "^0.70.0",
"flow-bin": "^0.100.0",
"grumbler-scripts": "^2.0.18",

@@ -50,0 +49,0 @@ "mocha": "^2.5.3"

/* @flow */
// eslint-disable-next-line import/no-namespace
import * as INTERFACE from './interface';
export * from './interface';
export default INTERFACE;
export { CrossDomainSafeWeakMap as WeakMap } from './weakmap';

@@ -8,5 +8,2 @@ /* @flow */

let defineProperty = Object.defineProperty;
let counter = Date.now() % 1e9;
export class CrossDomainSafeWeakMap<K : Object, V : mixed> {

@@ -20,6 +17,4 @@

constructor() {
counter += 1;
// eslint-disable-next-line no-bitwise
this.name = `__weakmap_${ Math.random() * 1e9 >>> 0 }__${ counter }`;
this.name = `__weakmap_${ Math.random() * 1e9 >>> 0 }__`;

@@ -104,3 +99,3 @@ if (hasNativeWeakMap()) {

} else {
defineProperty(key, name, {
Object.defineProperty(key, name, {
value: [ key, value ],

@@ -107,0 +102,0 @@ writable: true

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc