initial commit

This commit is contained in:
2026-03-22 03:21:45 +02:00
commit 897fea9f4e
15431 changed files with 2548840 additions and 0 deletions

11
node_modules/es6-weak-map/.lint generated vendored Normal file
View File

@@ -0,0 +1,11 @@
@root
module
tabs
indent 2
maxlen 100
ass
nomen
plusplus

4
node_modules/es6-weak-map/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,4 @@
.DS_Store
/node_modules
/npm-debug.log
/.lintcache

10
node_modules/es6-weak-map/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,10 @@
sudo: false # use faster docker infrastructure
language: node_js
node_js:
- 0.10
- 0.12
- iojs
notifications:
email:
- medikoo+es6-weak-map@medikoo.com

24
node_modules/es6-weak-map/CHANGES generated vendored Normal file
View File

@@ -0,0 +1,24 @@
v0.1.4 -- 2015.04.13
* Republish v0.1.2 as v0.1.4 due to breaking changes
(v0.1.3 should have been published as next major)
v0.1.3 -- 2015.04.12
* Update up to changes in specification (require new, remove clear method)
* Improve native implementation validation
* Configure lint scripts
* Rename LICENCE to LICENSE
v0.1.2 -- 2014.09.01
* Use internal random and unique id generator instead of external (time-uuid based).
Global uniqueness is not needed in scope of this module. Fixes #1
v0.1.1 -- 2014.05.15
* Improve valid WeakMap detection
v0.1.0 -- 2014.04.29
* Assure to depend only npm hosted dependencies
* Update to use latest versions of dependencies
* Use ES6 symbols internally
v0.0.0 -- 2013.10.24
Initial (dev version)

19
node_modules/es6-weak-map/LICENCE generated vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (C) 2013 Mariusz Nowak (www.medikoo.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

65
node_modules/es6-weak-map/README.md generated vendored Normal file
View File

@@ -0,0 +1,65 @@
# es6-weak-map
## WeakMap collection as specified in ECMAScript6
_Roughly inspired by Mark Miller's and Kris Kowal's [WeakMap implementation](https://github.com/drses/weak-map)_.
Differences are:
- Assumes compliant ES5 environment (no weird ES3 workarounds or hacks)
- Well modularized CJS style
- Based on one solution.
### Limitations
- Will fail on non extensible objects provided as keys
- While `clear` method is provided, it's not perfectly spec compliant. If some objects were saved as _values_, they need to be removed via `delete`. Otherwise they'll remain infinitely attached to _key_ object (that means, they'll be free for GC only if _key_ object was collected as well).
### Installation
$ npm install es6-weak-map
To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/)
### Usage
If you want to make sure your environment implements `WeakMap`, do:
```javascript
require('es6-weak-map/implement');
```
If you'd like to use native version when it exists and fallback to polyfill if it doesn't, but without implementing `WeakMap` on global scope, do:
```javascript
var WeakMap = require('es6-weak-map');
```
If you strictly want to use polyfill even if native `WeakMap` exists, do:
```javascript
var WeakMap = require('es6-weak-map/polyfill');
```
#### API
Best is to refer to [specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap-objects). Still if you want quick look, follow example:
```javascript
var WeakMap = require('es6-weak-map');
var map = new WeakMap();
var obj = {};
map.set(obj, 'foo'); // map
map.get(obj); // 'foo'
map.has(obj); // true
map.delete(obj); // true
map.get(obj); // undefined
map.has(obj); // false
map.set(obj, 'bar'); // map
map.clear(); // undefined
map.has(obj); // false
```
## Tests [![Build Status](https://travis-ci.org/medikoo/es6-weak-map.png)](https://travis-ci.org/medikoo/es6-weak-map)
$ npm test

7
node_modules/es6-weak-map/implement.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
'use strict';
if (!require('./is-implemented')()) {
Object.defineProperty(require('es5-ext/global'), 'WeakMap',
{ value: require('./polyfill'), configurable: true, enumerable: false,
writable: true });
}

4
node_modules/es6-weak-map/index.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
'use strict';
module.exports = require('./is-implemented')() ?
WeakMap : require('./polyfill');

14
node_modules/es6-weak-map/is-implemented.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
'use strict';
module.exports = function () {
var map;
if (typeof WeakMap !== 'function') return false;
map = new WeakMap();
if (typeof map.set !== 'function') return false;
if (map.set({}, 1) !== map) return false;
if (typeof map.clear !== 'function') return false;
if (typeof map.delete !== 'function') return false;
if (typeof map.has !== 'function') return false;
return true;
};

10
node_modules/es6-weak-map/is-native-implemented.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
// Exports true if environment provides native `WeakMap` implementation,
// whatever that is.
'use strict';
module.exports = (function () {
if (typeof WeakMap === 'undefined') return false;
return (Object.prototype.toString.call(WeakMap.prototype) ===
'[object WeakMap]');
}());

13
node_modules/es6-weak-map/is-weak-map.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
'use strict';
var toStringTagSymbol = require('es6-symbol').toStringTag
, toString = Object.prototype.toString
, id = '[object WeakMap]'
, Global = (typeof WeakMap === 'undefined') ? null : WeakMap;
module.exports = function (x) {
return (x && ((Global && (x instanceof Global)) ||
(toString.call(x) === id) || (x[toStringTagSymbol] === 'WeakMap'))) ||
false;
};

33
node_modules/es6-weak-map/package.json generated vendored Normal file
View File

@@ -0,0 +1,33 @@
{
"name": "es6-weak-map",
"version": "0.1.4",
"description": "ECMAScript6 WeakMap polyfill",
"author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",
"keywords": [
"map",
"weakmap",
"collection",
"es6",
"harmony",
"list",
"hash",
"gc"
],
"repository": {
"type": "git",
"url": "git://github.com/medikoo/es6-weak-map.git"
},
"dependencies": {
"d": "~0.1.1",
"es5-ext": "~0.10.6",
"es6-iterator": "~0.1.3",
"es6-symbol": "~2.0.1"
},
"devDependencies": {
"tad": "~0.2.2"
},
"scripts": {
"test": "node ./node_modules/tad/bin/tad"
},
"license": "MIT"
}

75
node_modules/es6-weak-map/polyfill.js generated vendored Normal file
View File

@@ -0,0 +1,75 @@
'use strict';
var setPrototypeOf = require('es5-ext/object/set-prototype-of')
, object = require('es5-ext/object/valid-object')
, value = require('es5-ext/object/valid-value')
, d = require('d')
, getIterator = require('es6-iterator/get')
, forOf = require('es6-iterator/for-of')
, toStringTagSymbol = require('es6-symbol').toStringTag
, isNative = require('./is-native-implemented')
, isArray = Array.isArray, defineProperty = Object.defineProperty, random = Math.random
, hasOwnProperty = Object.prototype.hasOwnProperty
, genId, WeakMapPoly;
genId = (function () {
var generated = Object.create(null);
return function () {
var id;
do { id = random().toString(36).slice(2); } while (generated[id]);
generated[id] = true;
return id;
};
}());
module.exports = WeakMapPoly = function (/*iterable*/) {
var iterable = arguments[0];
if (!(this instanceof WeakMapPoly)) return new WeakMapPoly(iterable);
if (this.__weakMapData__ !== undefined) {
throw new TypeError(this + " cannot be reinitialized");
}
if (iterable != null) {
if (!isArray(iterable)) iterable = getIterator(iterable);
}
defineProperty(this, '__weakMapData__', d('c', '$weakMap$' + genId()));
if (!iterable) return;
forOf(iterable, function (val) {
value(val);
this.set(val[0], val[1]);
}, this);
};
if (isNative) {
if (setPrototypeOf) setPrototypeOf(WeakMapPoly, WeakMap);
WeakMapPoly.prototype = Object.create(WeakMap.prototype, {
constructor: d(WeakMapPoly)
});
}
Object.defineProperties(WeakMapPoly.prototype, {
clear: d(function () {
defineProperty(this, '__weakMapData__', d('c', '$weakMap$' + genId()));
}),
delete: d(function (key) {
if (hasOwnProperty.call(object(key), this.__weakMapData__)) {
delete key[this.__weakMapData__];
return true;
}
return false;
}),
get: d(function (key) {
if (hasOwnProperty.call(object(key), this.__weakMapData__)) {
return key[this.__weakMapData__];
}
}),
has: d(function (key) {
return hasOwnProperty.call(object(key), this.__weakMapData__);
}),
set: d(function (key, value) {
defineProperty(object(key), this.__weakMapData__, d('c', value));
return this;
}),
toString: d(function () { return '[object WeakMap]'; })
});
defineProperty(WeakMapPoly.prototype, toStringTagSymbol, d('c', 'WeakMap'));

3
node_modules/es6-weak-map/test/implement.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
'use strict';
module.exports = function (t, a) { a(typeof WeakMap, 'function'); };

6
node_modules/es6-weak-map/test/index.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
'use strict';
module.exports = function (T, a) {
var x = {};
a((new T([[x, 'foo']])).get(x), 'foo');
};

3
node_modules/es6-weak-map/test/is-implemented.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
'use strict';
module.exports = function (t, a) { a(typeof t(), 'boolean'); };

View File

@@ -0,0 +1,3 @@
'use strict';
module.exports = function (t, a) { a(typeof t, 'boolean'); };

16
node_modules/es6-weak-map/test/is-weak-map.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
'use strict';
var WeakMapPoly = require('../polyfill');
module.exports = function (t, a) {
a(t(undefined), false, "Undefined");
a(t(null), false, "Null");
a(t(true), false, "Primitive");
a(t('raz'), false, "String");
a(t({}), false, "Object");
a(t([]), false, "Array");
if (typeof WeakMap !== 'undefined') {
a(t(new WeakMap()), true, "Native");
}
a(t(new WeakMapPoly()), true, "Polyfill");
};

22
node_modules/es6-weak-map/test/polyfill.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
'use strict';
module.exports = function (T, a) {
var x = {}, y = {}, z = {}, arr = [[x, 'raz'], [y, 'dwa']], map = new T(arr);
a(map instanceof T, true, "WeakMap");
a(map.has(x), true, "Has: true");
a(map.get(x), 'raz', "Get: contains");
a(map.has(z), false, "Has: false");
a(map.get(z), undefined, "Get: doesn't contain");
a(map.set(z, 'trzy'), map, "Set: return");
a(map.has(z), true, "Add");
a(map.delete({}), false, "Delete: false");
a(map.delete(x), true, "Delete: true");
a(map.get(x), undefined, "Get: after delete");
a(map.has(x), false, "Has: after delete");
a(map.has(y), true, "Has: pre clear");
map.clear();
a(map.has(y), false, "Has: after clear");
};

19
node_modules/es6-weak-map/test/valid-weak-map.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
'use strict';
var WeakMapPoly = require('../polyfill');
module.exports = function (t, a) {
var map;
a.throws(function () { t(undefined); }, TypeError, "Undefined");
a.throws(function () { t(null); }, TypeError, "Null");
a.throws(function () { t(true); }, TypeError, "Primitive");
a.throws(function () { t('raz'); }, TypeError, "String");
a.throws(function () { t({}); }, TypeError, "Object");
a.throws(function () { t([]); }, TypeError, "Array");
if (typeof WeakMap !== 'undefined') {
map = new WeakMap();
a(t(map), map, "Native");
}
map = new WeakMapPoly();
a(t(map), map, "Polyfill");
};

8
node_modules/es6-weak-map/valid-weak-map.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
'use strict';
var isWeakMap = require('./is-weak-map');
module.exports = function (x) {
if (!isWeakMap(x)) throw new TypeError(x + " is not a WeakMap");
return x;
};