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

weakmap

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

weakmap - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

4

package.json

@@ -6,3 +6,3 @@ {

"keywords": ["harmony", "collection", "weakmap","ecmascript", "es6", "shim", "garbage collection", "gc"],
"version": "0.0.4",
"version": "0.0.5",
"homepage": "http://benvie.github.com/WeakMap",

@@ -13,4 +13,4 @@ "repository": {

},
"main": "WeakMap.js",
"main": "weakmap.js",
"license": "MIT"
}

@@ -26,4 +26,2 @@ /* (The MIT License)

void function(global, undefined_, undefined){
"use strict";
var getProps = Object.getOwnPropertyNames,

@@ -111,4 +109,4 @@ defProp = Object.defineProperty,

var WeakMap = (function(data){
function validate(key){
var WM = (function(data){
var validate = function(key){
if (key == null || typeof key !== 'object' && typeof key !== 'function')

@@ -118,3 +116,3 @@ throw new TypeError("Invalid WeakMap key");

function wrap(collection, value){
var wrap = function(collection, value){
var store = data.unlock(collection);

@@ -126,3 +124,3 @@ if (store.value)

function unwrap(collection){
var unwrap = function(collection){
var storage = data.unlock(collection).value;

@@ -134,3 +132,3 @@ if (!storage)

function initialize(weakmap, iterable){
var initialize = function(weakmap, iterable){
if (iterable !== null && typeof iterable === 'object' && typeof iterable.forEach === 'function') {

@@ -211,8 +209,38 @@ iterable.forEach(function(item, i){

if (typeof module !== 'undefined')
module.exports = WeakMap;
else if (typeof exports !== 'undefined')
exports.WeakMap = WeakMap;
else if (!('WeakMap' in global))
global.WeakMap = WeakMap;
}(new Function('return this')(), {});
var defaultCreator = Object.create
? function(){ return Object.create(null) }
: function(){ return {} };
function createStorage(creator){
var weakmap = new WeakMap;
creator || (creator = defaultCreator);
function storage(object, value){
if (value || arguments.length === 2) {
weakmap.set(object, value);
} else {
value = weakmap.get(object);
if (value === undefined) {
value = creator(object);
weakmap.set(object, value);
}
}
return value;
}
return storage;
}
if (typeof module !== 'undefined') {
module.exports = WM;
} else if (typeof exports !== 'undefined') {
exports.WeakMap = WM;
} else if (!('WeakMap' in global)) {
global.WeakMap = WM;
}
WM.createStorage = createStorage;
if (global.WeakMap)
global.WeakMap.createStorage = createStorage;
}((0, eval)('this'));

@@ -6,2 +6,2 @@ /* (The MIT License)

void function(e,h,b){function define(c,a,b){return typeof a==='function'&&(b=a,a=nameOf(b).replace(/_$/,'')),d(c,a,{configurable:!0,writable:!0,value:b})}function nameOf(a){return typeof a!=='function'?'':'name'in a?a.name:k.call(a).match(j)[1]}'use strict';var i=Object.getOwnPropertyNames,d=Object.defineProperty,k=Function.prototype.toString,f=Object.create,g=Object.prototype.hasOwnProperty,j=/^\n?function\s?(\w*)?_?\(/;var c=function(){function c(){var a=e(),b={};this.unlock=function(h){var c=l(h);if(g.call(c,a))return c[a](b);var e=f(null,j);return d(c,a,{value:new Function('s','l',k)(b,e)}),e}}var j={value:{writable:!0,value:b}},k='return function(k){if(k===s)return l}',h=f(null),e=function(){var a=Math.random().toString(36).slice(2);return a in h?e():h[a]=a},a=e(),l=function(b){if(g.call(b,a))return b[a];if(!Object.isExtensible(b))throw new TypeError('Object must be extensible');var c=f(null);return d(b,a,{value:c}),c};return define(Object,function getOwnPropertyNames(c){var b=i(c);return g.call(c,a)&&b.splice(b.indexOf(a),1),b}),define(c.prototype,function get(a){return this.unlock(a).value}),define(c.prototype,function set(a,b){this.unlock(a).value=b}),c}();var a=function(g){function validate(a){if(a==null||typeof a!=='object'&&typeof a!=='function')throw new TypeError('Invalid WeakMap key')}function wrap(b,c){var a=g.unlock(b);if(a.value)throw new TypeError('Object is already a WeakMap');a.value=c}function unwrap(b){var a=g.unlock(b).value;if(!a)throw new TypeError('WeakMap is not generic');return a}function initialize(b,a){a!==null&&typeof a==='object'&&typeof a.forEach==='function'&&a.forEach(function(c,d){c instanceof Array&&c.length===2&&set.call(b,a[d][0],a[d][1])})}function WeakMap(b){if(this===e||this==null||this===WeakMap.prototype)return new WeakMap(b);wrap(this,new c),initialize(this,b)}function get(a){validate(a);var c=unwrap(this).get(a);return c===h?b:c}function set(a,c){validate(a),unwrap(this).set(a,c===b?h:c)}function has(a){return validate(a),unwrap(this).get(a)!==b}function delete_(a){validate(a);var c=unwrap(this),d=c.get(a)!==b;return c.set(a,b),d}function toString(){return unwrap(this),'[object WeakMap]'}try{var d=('return '+delete_).replace('e_','\\u0065'),i=new Function('unwrap','validate',d)(unwrap,validate)}catch(a){var i=delete_}var d=(''+Object).split('Object');var f=function toString(){return d[0]+nameOf(this)+d[1]};define(f,f);var j={__proto__:[]}instanceof Array?function(a){a.__proto__=f}:function(a){define(a,f)};return j(WeakMap),[toString,get,set,has,i].forEach(function(b){define(WeakMap.prototype,b),j(b)}),WeakMap}(new c);typeof module!=='undefined'?module.exports=a:typeof exports!=='undefined'?exports.WeakMap=a:!('WeakMap'in e)&&(e.WeakMap=a)}(new Function('return this')(),{})
void function(c,h,a){function define(c,a,b){return typeof a==='function'&&(b=a,a=nameOf(b).replace(/_$/,'')),e(c,a,{configurable:!0,writable:!0,value:b})}function nameOf(a){return typeof a!=='function'?'':'name'in a?a.name:i.call(a).match(j)[1]}function createStorage(b){function storage(e,d){return d||arguments.length===2?c.set(e,d):(d=c.get(e),d===a&&(d=b(e),c.set(e,d))),d}var c=new WeakMap;return b||(b=k),storage}var l=Object.getOwnPropertyNames,e=Object.defineProperty,i=Function.prototype.toString,f=Object.create,g=Object.prototype.hasOwnProperty,j=/^\n?function\s?(\w*)?_?\(/;var b=function(){function b(){var a=d(),c={};this.unlock=function(h){var b=k(h);if(g.call(b,a))return b[a](c);var d=f(null,i);return e(b,a,{value:new Function('s','l',j)(c,d)}),d}}var i={value:{writable:!0,value:a}},j='return function(k){if(k===s)return l}',h=f(null),d=function(){var a=Math.random().toString(36).slice(2);return a in h?d():h[a]=a},c=d(),k=function(a){if(g.call(a,c))return a[c];if(!Object.isExtensible(a))throw new TypeError('Object must be extensible');var b=f(null);return e(a,c,{value:b}),b};return define(Object,function getOwnPropertyNames(b){var a=l(b);return g.call(b,c)&&a.splice(a.indexOf(c),1),a}),define(b.prototype,function get(a){return this.unlock(a).value}),define(b.prototype,function set(a,b){this.unlock(a).value=b}),b}();var d=function(i){function WeakMap(a){if(this===c||this==null||this===WeakMap.prototype)return new WeakMap(a);l(this,new b),m(this,a)}function get(b){e(b);var c=d(this).get(b);return c===h?a:c}function set(b,c){e(b),d(this).set(b,c===a?h:c)}function has(b){return e(b),d(this).get(b)!==a}function delete_(b){e(b);var c=d(this),f=c.get(b)!==a;return c.set(b,a),f}function toString(){return d(this),'[object WeakMap]'}var e=function(a){if(a==null||typeof a!=='object'&&typeof a!=='function')throw new TypeError('Invalid WeakMap key')};var l=function(b,c){var a=i.unlock(b);if(a.value)throw new TypeError('Object is already a WeakMap');a.value=c};var d=function(b){var a=i.unlock(b).value;if(!a)throw new TypeError('WeakMap is not generic');return a};var m=function(b,a){a!==null&&typeof a==='object'&&typeof a.forEach==='function'&&a.forEach(function(c,d){c instanceof Array&&c.length===2&&set.call(b,a[d][0],a[d][1])})};try{var f=('return '+delete_).replace('e_','\\u0065'),j=new Function('unwrap','validate',f)(d,e)}catch(a){var j=delete_}var f=(''+Object).split('Object');var g=function toString(){return f[0]+nameOf(this)+f[1]};define(g,g);var k={__proto__:[]}instanceof Array?function(a){a.__proto__=g}:function(a){define(a,g)};return k(WeakMap),[toString,get,set,has,j].forEach(function(a){define(WeakMap.prototype,a),k(a)}),WeakMap}(new b);var k=Object.create?function(){return Object.create(null)}:function(){return{}};typeof module!=='undefined'?module.exports=d:typeof exports!=='undefined'?exports.WeakMap=d:!('WeakMap'in c)&&(c.WeakMap=d),d.createStorage=createStorage,c.WeakMap&&(c.WeakMap.createStorage=createStorage)}((0,eval)('this'))
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