1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-11 18:32:50 +00:00

updated bunch of file paths and changed the way posts are loaded

This commit is contained in:
2016-01-05 12:28:04 -06:00
parent 4bb8cae81e
commit 6ab45fe935
13249 changed files with 317868 additions and 2101398 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;
};

View File

@@ -0,0 +1,40 @@
'use strict';
var setPrototypeOf = require('es5-ext/object/set-prototype-of')
, d = require('d')
, Iterator = require('../')
, validIterable = require('../valid-iterable')
, push = Array.prototype.push
, defineProperties = Object.defineProperties
, IteratorChain;
IteratorChain = function (iterators) {
defineProperties(this, {
__iterators__: d('', iterators),
__current__: d('w', iterators.shift())
});
};
if (setPrototypeOf) setPrototypeOf(IteratorChain, Iterator);
IteratorChain.prototype = Object.create(Iterator.prototype, {
constructor: d(IteratorChain),
next: d(function () {
var result;
if (!this.__current__) return { done: true, value: undefined };
result = this.__current__.next();
while (result.done) {
this.__current__ = this.__iterators__.shift();
if (!this.__current__) return { done: true, value: undefined };
result = this.__current__.next();
}
return result;
})
});
module.exports = function () {
var iterators = [this];
push.apply(iterators, arguments);
iterators.forEach(validIterable);
return new IteratorChain(iterators);
};

View File

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

View File

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

View File

@@ -0,0 +1,11 @@
language: node_js
node_js:
- 0.8
- 0.10
- 0.11
notifications:
email:
- medikoo+es6-iterator@medikoo.com
script: "npm test && npm run lint"

View File

@@ -0,0 +1,28 @@
v0.1.3 -- 2015.02.02
* Update dependencies
* Fix spelling of LICENSE
v0.1.2 -- 2014.11.19
* Optimise internal `_next` to not verify internal's list length at all times
(#2 thanks @RReverser)
* Fix documentation examples
* Configure lint scripts
v0.1.1 -- 2014.04.29
* Fix es6-symbol dependency version
v0.1.0 -- 2014.04.29
* Assure strictly npm hosted dependencies
* Remove sparse arrays dedicated handling (as per spec)
* Add: isIterable, validIterable and chain (method)
* Remove toArray, it's addressed by Array.from (polyfil can be found in es5-ext/array/from)
* Add break possiblity to 'forOf' via 'doBreak' function argument
* Provide dedicated iterator for array-likes (ArrayIterator) and for strings (StringIterator)
* Provide @@toStringTag symbol
* When available rely on @@iterator symbol
* Remove 32bit integer maximum list length restriction
* Improve Iterator internals
* Update to use latest version of dependencies
v0.0.0 -- 2013.10.12
Initial (dev version)

View File

@@ -0,0 +1,19 @@
Copyright (C) 2013-2015 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.

View File

@@ -0,0 +1,148 @@
# es6-iterator
## ECMAScript 6 Iterator interface
### Installation
$ npm install es6-iterator
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/)
## API
### Constructors
#### Iterator(list) _(es6-iterator)_
Abstract Iterator interface. Meant for extensions and not to be used on its own.
Accepts any _list_ object (technically object with numeric _length_ property).
_Mind it doesn't iterate strings properly, for that use dedicated [StringIterator](#string-iterator)_
```javascript
var Iterator = require('es6-iterator')
var iterator = new Iterator([1, 2, 3]);
iterator.next(); // { value: 1, done: false }
iterator.next(); // { value: 2, done: false }
iterator.next(); // { value: 3, done: false }
iterator.next(); // { value: undefined, done: true }
```
#### ArrayIterator(arrayLike[, kind]) _(es6-iterator/array)_
Dedicated for arrays and array-likes. Supports three iteration kinds:
* __value__ _(default)_ - Iterates values
* __key__ - Iterates indexes
* __key+value__ - Iterates keys and indexes, each iteration value is in _[key, value]_ form.
```javascript
var ArrayIterator = require('es6-iterator/array')
var iterator = new ArrayIterator([1, 2, 3], 'key+value');
iterator.next(); // { value: [0, 1], done: false }
iterator.next(); // { value: [1, 2], done: false }
iterator.next(); // { value: [2, 3], done: false }
iterator.next(); // { value: undefined, done: true }
```
May also be used for _arguments_ objects:
```javascript
(function () {
var iterator = new ArrayIterator(arguments);
iterator.next(); // { value: 1, done: false }
iterator.next(); // { value: 2, done: false }
iterator.next(); // { value: 3, done: false }
iterator.next(); // { value: undefined, done: true }
}(1, 2, 3));
```
#### StringIterator(str) _(es6-iterator/string)_
Assures proper iteration over unicode symbols.
See: http://mathiasbynens.be/notes/javascript-unicode
```javascript
var StringIterator = require('es6-iterator/string');
var iterator = new StringIterator('f🙈o🙉o🙊');
iterator.next(); // { value: 'f', done: false }
iterator.next(); // { value: '🙈', done: false }
iterator.next(); // { value: 'o', done: false }
iterator.next(); // { value: '🙉', done: false }
iterator.next(); // { value: 'o', done: false }
iterator.next(); // { value: '🙊', done: false }
iterator.next(); // { value: undefined, done: true }
```
### Function utilities
#### forOf(iterable, callback[, thisArg]) _(es6-iterator/for-of)_
Polyfill for ECMAScript 6 [`for...of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) statement.
```
var forOf = require('es6-iterator/for-of');
var result = [];
forOf('🙈🙉🙊', function (monkey) { result.push(monkey); });
console.log(result); // ['🙈', '🙉', '🙊'];
```
Optionally you can break iteration at any point:
```javascript
var result = [];
forOf([1,2,3,4]', function (val, doBreak) {
result.push(monkey);
if (val >= 3) doBreak();
});
console.log(result); // [1, 2, 3];
```
#### get(obj) _(es6-iterator/get)_
Return iterator for any iterable object.
```javascript
var getIterator = require('es6-iterator/get');
var iterator = get([1,2,3]);
iterator.next(); // { value: 1, done: false }
iterator.next(); // { value: 2, done: false }
iterator.next(); // { value: 3, done: false }
iterator.next(); // { value: undefined, done: true }
```
#### isIterable(obj) _(es6-iterator/is-iterable)_
Whether _obj_ is iterable
```javascript
var isIterable = require('es6-iterator/is-iterable');
isIterable(null); // false
isIterable(true); // false
isIterable('str'); // true
isIterable(['a', 'r', 'r']); // true
isIterable(new ArrayIterator([])); // true
```
#### validIterable(obj) _(es6-iterator/valid-iterable)_
If _obj_ is an iterable it is returned. Otherwise _TypeError_ is thrown.
### Method extensions
#### iterator.chain(iterator1[, …iteratorn]) _(es6-iterator/#/chain)_
Chain multiple iterators into one.
### Tests [![Build Status](https://travis-ci.org/medikoo/es6-iterator.png)](https://travis-ci.org/medikoo/es6-iterator)
$ npm test

View File

@@ -0,0 +1,30 @@
'use strict';
var setPrototypeOf = require('es5-ext/object/set-prototype-of')
, contains = require('es5-ext/string/#/contains')
, d = require('d')
, Iterator = require('./')
, defineProperty = Object.defineProperty
, ArrayIterator;
ArrayIterator = module.exports = function (arr, kind) {
if (!(this instanceof ArrayIterator)) return new ArrayIterator(arr, kind);
Iterator.call(this, arr);
if (!kind) kind = 'value';
else if (contains.call(kind, 'key+value')) kind = 'key+value';
else if (contains.call(kind, 'key')) kind = 'key';
else kind = 'value';
defineProperty(this, '__kind__', d('', kind));
};
if (setPrototypeOf) setPrototypeOf(ArrayIterator, Iterator);
ArrayIterator.prototype = Object.create(Iterator.prototype, {
constructor: d(ArrayIterator),
_resolve: d(function (i) {
if (this.__kind__ === 'value') return this.__list__[i];
if (this.__kind__ === 'key+value') return [i, this.__list__[i]];
return i;
}),
toString: d(function () { return '[object Array Iterator]'; })
});

View File

@@ -0,0 +1,44 @@
'use strict';
var callable = require('es5-ext/object/valid-callable')
, isString = require('es5-ext/string/is-string')
, get = require('./get')
, isArray = Array.isArray, call = Function.prototype.call;
module.exports = function (iterable, cb/*, thisArg*/) {
var mode, thisArg = arguments[2], result, doBreak, broken, i, l, char, code;
if (isArray(iterable)) mode = 'array';
else if (isString(iterable)) mode = 'string';
else iterable = get(iterable);
callable(cb);
doBreak = function () { broken = true; };
if (mode === 'array') {
iterable.some(function (value) {
call.call(cb, thisArg, value, doBreak);
if (broken) return true;
});
return;
}
if (mode === 'string') {
l = iterable.length;
for (i = 0; i < l; ++i) {
char = iterable[i];
if ((i + 1) < l) {
code = char.charCodeAt(0);
if ((code >= 0xD800) && (code <= 0xDBFF)) char += iterable[++i];
}
call.call(cb, thisArg, char, doBreak);
if (broken) break;
}
return;
}
result = iterable.next();
while (!result.done) {
call.call(cb, thisArg, result.value, doBreak);
if (broken) return;
result = iterable.next();
}
};

View File

@@ -0,0 +1,13 @@
'use strict';
var isString = require('es5-ext/string/is-string')
, ArrayIterator = require('./array')
, StringIterator = require('./string')
, iterable = require('./valid-iterable')
, iteratorSymbol = require('es6-symbol').iterator;
module.exports = function (obj) {
if (typeof iterable(obj)[iteratorSymbol] === 'function') return obj[iteratorSymbol]();
if (isString(obj)) return new StringIterator(obj);
return new ArrayIterator(obj);
};

View File

@@ -0,0 +1,90 @@
'use strict';
var clear = require('es5-ext/array/#/clear')
, assign = require('es5-ext/object/assign')
, callable = require('es5-ext/object/valid-callable')
, value = require('es5-ext/object/valid-value')
, d = require('d')
, autoBind = require('d/auto-bind')
, Symbol = require('es6-symbol')
, defineProperty = Object.defineProperty
, defineProperties = Object.defineProperties
, Iterator;
module.exports = Iterator = function (list, context) {
if (!(this instanceof Iterator)) return new Iterator(list, context);
defineProperties(this, {
__list__: d('w', value(list)),
__context__: d('w', context),
__nextIndex__: d('w', 0)
});
if (!context) return;
callable(context.on);
context.on('_add', this._onAdd);
context.on('_delete', this._onDelete);
context.on('_clear', this._onClear);
};
defineProperties(Iterator.prototype, assign({
constructor: d(Iterator),
_next: d(function () {
var i;
if (!this.__list__) return;
if (this.__redo__) {
i = this.__redo__.shift();
if (i !== undefined) return i;
}
if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++;
this._unBind();
}),
next: d(function () { return this._createResult(this._next()); }),
_createResult: d(function (i) {
if (i === undefined) return { done: true, value: undefined };
return { done: false, value: this._resolve(i) };
}),
_resolve: d(function (i) { return this.__list__[i]; }),
_unBind: d(function () {
this.__list__ = null;
delete this.__redo__;
if (!this.__context__) return;
this.__context__.off('_add', this._onAdd);
this.__context__.off('_delete', this._onDelete);
this.__context__.off('_clear', this._onClear);
this.__context__ = null;
}),
toString: d(function () { return '[object Iterator]'; })
}, autoBind({
_onAdd: d(function (index) {
if (index >= this.__nextIndex__) return;
++this.__nextIndex__;
if (!this.__redo__) {
defineProperty(this, '__redo__', d('c', [index]));
return;
}
this.__redo__.forEach(function (redo, i) {
if (redo >= index) this.__redo__[i] = ++redo;
}, this);
this.__redo__.push(index);
}),
_onDelete: d(function (index) {
var i;
if (index >= this.__nextIndex__) return;
--this.__nextIndex__;
if (!this.__redo__) return;
i = this.__redo__.indexOf(index);
if (i !== -1) this.__redo__.splice(i, 1);
this.__redo__.forEach(function (redo, i) {
if (redo > index) this.__redo__[i] = --redo;
}, this);
}),
_onClear: d(function () {
if (this.__redo__) clear.call(this.__redo__);
this.__nextIndex__ = 0;
})
})));
defineProperty(Iterator.prototype, Symbol.iterator, d(function () {
return this;
}));
defineProperty(Iterator.prototype, Symbol.toStringTag, d('', 'Iterator'));

View File

@@ -0,0 +1,13 @@
'use strict';
var isString = require('es5-ext/string/is-string')
, iteratorSymbol = require('es6-symbol').iterator
, isArray = Array.isArray;
module.exports = function (value) {
if (value == null) return false;
if (isArray(value)) return true;
if (isString(value)) return true;
return (typeof value[iteratorSymbol] === 'function');
};

View File

@@ -0,0 +1,91 @@
{
"_args": [
[
"es6-iterator@~0.1.3",
"/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/es6-weak-map"
]
],
"_from": "es6-iterator@>=0.1.3 <0.2.0",
"_id": "es6-iterator@0.1.3",
"_inCache": true,
"_installable": true,
"_location": "/es6-weak-map/es6-iterator",
"_nodeVersion": "0.11.16",
"_npmUser": {
"email": "medikoo+npm@medikoo.com",
"name": "medikoo"
},
"_npmVersion": "2.3.0",
"_phantomChildren": {},
"_requested": {
"name": "es6-iterator",
"raw": "es6-iterator@~0.1.3",
"rawSpec": "~0.1.3",
"scope": null,
"spec": ">=0.1.3 <0.2.0",
"type": "range"
},
"_requiredBy": [
"/es6-weak-map"
],
"_resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-0.1.3.tgz",
"_shasum": "d6f58b8c4fc413c249b4baa19768f8e4d7c8944e",
"_shrinkwrap": null,
"_spec": "es6-iterator@~0.1.3",
"_where": "/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/es6-weak-map",
"author": {
"email": "medyk@medikoo.com",
"name": "Mariusz Nowak",
"url": "http://www.medikoo.com/"
},
"bugs": {
"url": "https://github.com/medikoo/es6-iterator/issues"
},
"dependencies": {
"d": "~0.1.1",
"es5-ext": "~0.10.5",
"es6-symbol": "~2.0.1"
},
"description": "Iterator abstraction based on ES6 specification",
"devDependencies": {
"event-emitter": "~0.3.3",
"tad": "~0.2.1",
"xlint": "~0.2.2",
"xlint-jslint-medikoo": "~0.1.2"
},
"directories": {},
"dist": {
"shasum": "d6f58b8c4fc413c249b4baa19768f8e4d7c8944e",
"tarball": "http://registry.npmjs.org/es6-iterator/-/es6-iterator-0.1.3.tgz"
},
"gitHead": "2addc362c6f139e4941cf4726eeb59e5960c5cef",
"homepage": "https://github.com/medikoo/es6-iterator",
"keywords": [
"array",
"generator",
"iterator",
"list",
"map",
"set"
],
"license": "MIT",
"maintainers": [
{
"name": "medikoo",
"email": "medikoo+npm@medikoo.com"
}
],
"name": "es6-iterator",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/medikoo/es6-iterator.git"
},
"scripts": {
"lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream",
"lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch",
"test": "node ./node_modules/tad/bin/tad"
},
"version": "0.1.3"
}

View File

@@ -0,0 +1,37 @@
// Thanks @mathiasbynens
// http://mathiasbynens.be/notes/javascript-unicode#iterating-over-symbols
'use strict';
var setPrototypeOf = require('es5-ext/object/set-prototype-of')
, d = require('d')
, Iterator = require('./')
, defineProperty = Object.defineProperty
, StringIterator;
StringIterator = module.exports = function (str) {
if (!(this instanceof StringIterator)) return new StringIterator(str);
str = String(str);
Iterator.call(this, str);
defineProperty(this, '__length__', d('', str.length));
};
if (setPrototypeOf) setPrototypeOf(StringIterator, Iterator);
StringIterator.prototype = Object.create(Iterator.prototype, {
constructor: d(StringIterator),
_next: d(function () {
if (!this.__list__) return;
if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++;
this._unBind();
}),
_resolve: d(function (i) {
var char = this.__list__[i], code;
if (this.__nextIndex__ === this.__length__) return char;
code = char.charCodeAt(0);
if ((code >= 0xD800) && (code <= 0xDBFF)) return char + this.__list__[this.__nextIndex__++];
return char;
}),
toString: d(function () { return '[object String Iterator]'; })
});

View File

@@ -0,0 +1,23 @@
'use strict';
var Iterator = require('../../');
module.exports = function (t, a) {
var i1 = new Iterator(['raz', 'dwa', 'trzy'])
, i2 = new Iterator(['cztery', 'pięć', 'sześć'])
, i3 = new Iterator(['siedem', 'osiem', 'dziewięć'])
, iterator = t.call(i1, i2, i3);
a.deep(iterator.next(), { done: false, value: 'raz' }, "#1");
a.deep(iterator.next(), { done: false, value: 'dwa' }, "#2");
a.deep(iterator.next(), { done: false, value: 'trzy' }, "#3");
a.deep(iterator.next(), { done: false, value: 'cztery' }, "#4");
a.deep(iterator.next(), { done: false, value: 'pięć' }, "#5");
a.deep(iterator.next(), { done: false, value: 'sześć' }, "#6");
a.deep(iterator.next(), { done: false, value: 'siedem' }, "#7");
a.deep(iterator.next(), { done: false, value: 'osiem' }, "#8");
a.deep(iterator.next(), { done: false, value: 'dziewięć' }, "#9");
a.deep(iterator.next(), { done: true, value: undefined }, "Done #1");
a.deep(iterator.next(), { done: true, value: undefined }, "Done #2");
};

View File

@@ -0,0 +1,67 @@
'use strict';
var iteratorSymbol = require('es6-symbol').iterator;
module.exports = function (T) {
return {
Values: function (a) {
var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], it;
it = new T(x);
a(it[iteratorSymbol](), it, "@@iterator");
a.deep(it.next(), { done: false, value: 'raz' }, "#1");
a.deep(it.next(), { done: false, value: 'dwa' }, "#2");
x.splice(1, 0, 'elo');
a.deep(it.next(), { done: false, value: 'dwa' }, "Insert");
a.deep(it.next(), { done: false, value: 'trzy' }, "#3");
a.deep(it.next(), { done: false, value: 'cztery' }, "#4");
x.pop();
a.deep(it.next(), { done: false, value: 'pięć' }, "#5");
a.deep(it.next(), { done: true, value: undefined }, "End");
},
"Keys & Values": function (a) {
var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], it;
it = new T(x, 'key+value');
a(it[iteratorSymbol](), it, "@@iterator");
a.deep(it.next(), { done: false, value: [0, 'raz'] }, "#1");
a.deep(it.next(), { done: false, value: [1, 'dwa'] }, "#2");
x.splice(1, 0, 'elo');
a.deep(it.next(), { done: false, value: [2, 'dwa'] }, "Insert");
a.deep(it.next(), { done: false, value: [3, 'trzy'] }, "#3");
a.deep(it.next(), { done: false, value: [4, 'cztery'] }, "#4");
x.pop();
a.deep(it.next(), { done: false, value: [5, 'pięć'] }, "#5");
a.deep(it.next(), { done: true, value: undefined }, "End");
},
Keys: function (a) {
var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], it;
it = new T(x, 'key');
a(it[iteratorSymbol](), it, "@@iterator");
a.deep(it.next(), { done: false, value: 0 }, "#1");
a.deep(it.next(), { done: false, value: 1 }, "#2");
x.splice(1, 0, 'elo');
a.deep(it.next(), { done: false, value: 2 }, "Insert");
a.deep(it.next(), { done: false, value: 3 }, "#3");
a.deep(it.next(), { done: false, value: 4 }, "#4");
x.pop();
a.deep(it.next(), { done: false, value: 5 }, "#5");
a.deep(it.next(), { done: true, value: undefined }, "End");
},
Sparse: function (a) {
var x = new Array(6), it;
x[2] = 'raz';
x[4] = 'dwa';
it = new T(x);
a.deep(it.next(), { done: false, value: undefined }, "#1");
a.deep(it.next(), { done: false, value: undefined }, "#2");
a.deep(it.next(), { done: false, value: 'raz' }, "#3");
a.deep(it.next(), { done: false, value: undefined }, "#4");
a.deep(it.next(), { done: false, value: 'dwa' }, "#5");
a.deep(it.next(), { done: false, value: undefined }, "#6");
a.deep(it.next(), { done: true, value: undefined }, "End");
}
};
};

View File

@@ -0,0 +1,35 @@
'use strict';
var ArrayIterator = require('../array')
, slice = Array.prototype.slice;
module.exports = function (t, a) {
var i = 0, x = ['raz', 'dwa', 'trzy'], y = {}, called = 0;
t(x, function () {
a.deep(slice.call(arguments, 0, 1), [x[i]], "Array " + i + "#");
a(this, y, "Array: context: " + (i++) + "#");
}, y);
i = 0;
t(x = 'foo', function () {
a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#");
a(this, y, "Regular String: context: " + (i++) + "#");
}, y);
i = 0;
x = ['r', '💩', 'z'];
t('r💩z', function () {
a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#");
a(this, y, "Unicode String: context: " + (i++) + "#");
}, y);
i = 0;
t(new ArrayIterator(x), function () {
a.deep(slice.call(arguments, 0, 1), [x[i]], "Iterator " + i + "#");
a(this, y, "Iterator: context: " + (i++) + "#");
}, y);
t(x = ['raz', 'dwa', 'trzy'], function (value, doBreak) {
++called;
return doBreak();
});
a(called, 1, "Break");
};

View File

@@ -0,0 +1,16 @@
'use strict';
var iteratorSymbol = require('es6-symbol').iterator
, Iterator = require('../');
module.exports = function (t, a) {
var iterator;
a.throws(function () { t(); }, TypeError, "Null");
a.throws(function () { t({}); }, TypeError, "Plain object");
a.throws(function () { t({ length: 0 }); }, TypeError, "Array-like");
iterator = {};
iterator[iteratorSymbol] = function () { return new Iterator([]); };
a(t(iterator) instanceof Iterator, true, "Iterator");
a(String(t([])), '[object Array Iterator]', " Array");
a(String(t('foo')), '[object String Iterator]', "String");
};

View File

@@ -0,0 +1,99 @@
'use strict';
var ee = require('event-emitter')
, iteratorSymbol = require('es6-symbol').iterator;
module.exports = function (T) {
return {
"": function (a) {
var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć'], it, y, z;
it = new T(x);
a(it[iteratorSymbol](), it, "@@iterator");
y = it.next();
a.deep(y, { done: false, value: 'raz' }, "#1");
z = it.next();
a.not(y, z, "Recreate result");
a.deep(z, { done: false, value: 'dwa' }, "#2");
a.deep(it.next(), { done: false, value: 'trzy' }, "#3");
a.deep(it.next(), { done: false, value: 'cztery' }, "#4");
a.deep(it.next(), { done: false, value: 'pięć' }, "#5");
a.deep(y = it.next(), { done: true, value: undefined }, "End");
a.not(y, it.next(), "Recreate result on dead");
},
Emited: function (a) {
var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć'], y, it;
y = ee();
it = new T(x, y);
a.deep(it.next(), { done: false, value: 'raz' }, "#1");
a.deep(it.next(), { done: false, value: 'dwa' }, "#2");
y.emit('_add', x.push('sześć') - 1);
a.deep(it.next(), { done: false, value: 'trzy' }, "#3");
x.splice(1, 0, 'półtora');
y.emit('_add', 1);
a.deep(it.next(), { done: false, value: 'półtora' }, "Insert");
x.splice(5, 1);
y.emit('_delete', 5);
a.deep(it.next(), { done: false, value: 'cztery' }, "#4");
a.deep(it.next(), { done: false, value: 'sześć' }, "#5");
a.deep(it.next(), { done: true, value: undefined }, "End");
},
"Emited #2": function (a) {
var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], y, it;
y = ee();
it = new T(x, y);
a.deep(it.next(), { done: false, value: 'raz' }, "#1");
a.deep(it.next(), { done: false, value: 'dwa' }, "#2");
x.splice(1, 0, 'półtora');
y.emit('_add', 1);
x.splice(1, 0, '1.25');
y.emit('_add', 1);
x.splice(0, 1);
y.emit('_delete', 0);
a.deep(it.next(), { done: false, value: 'półtora' }, "Insert");
a.deep(it.next(), { done: false, value: '1.25' }, "Insert #2");
a.deep(it.next(), { done: false, value: 'trzy' }, "#3");
a.deep(it.next(), { done: false, value: 'cztery' }, "#4");
x.splice(5, 1);
y.emit('_delete', 5);
a.deep(it.next(), { done: false, value: 'sześć' }, "#5");
a.deep(it.next(), { done: true, value: undefined }, "End");
},
"Emited: Clear #1": function (a) {
var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], y, it;
y = ee();
it = new T(x, y);
a.deep(it.next(), { done: false, value: 'raz' }, "#1");
a.deep(it.next(), { done: false, value: 'dwa' }, "#2");
x.length = 0;
y.emit('_clear');
a.deep(it.next(), { done: true, value: undefined }, "End");
},
"Emited: Clear #2": function (a) {
var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], y, it;
y = ee();
it = new T(x, y);
a.deep(it.next(), { done: false, value: 'raz' }, "#1");
a.deep(it.next(), { done: false, value: 'dwa' }, "#2");
x.length = 0;
y.emit('_clear');
x.push('foo');
x.push('bar');
a.deep(it.next(), { done: false, value: 'foo' }, "#3");
a.deep(it.next(), { done: false, value: 'bar' }, "#4");
x.splice(1, 0, 'półtora');
y.emit('_add', 1);
x.splice(1, 0, '1.25');
y.emit('_add', 1);
x.splice(0, 1);
y.emit('_delete', 0);
a.deep(it.next(), { done: false, value: 'półtora' }, "Insert");
a.deep(it.next(), { done: false, value: '1.25' }, "Insert #2");
a.deep(it.next(), { done: true, value: undefined }, "End");
}
};
};

View File

@@ -0,0 +1,18 @@
'use strict';
var iteratorSymbol = require('es6-symbol').iterator
, Iterator = require('../');
module.exports = function (t, a) {
var iterator;
a(t(), false, "Undefined");
a(t(123), false, "Number");
a(t({}), false, "Plain object");
a(t({ length: 0 }), false, "Array-like");
iterator = {};
iterator[iteratorSymbol] = function () { return new Iterator([]); };
a(t(iterator), true, "Iterator");
a(t([]), true, "Array");
a(t('foo'), true, "String");
a(t(''), true, "Empty string");
};

View File

@@ -0,0 +1,23 @@
'use strict';
var iteratorSymbol = require('es6-symbol').iterator;
module.exports = function (T, a) {
var it = new T('foobar');
a(it[iteratorSymbol](), it, "@@iterator");
a.deep(it.next(), { done: false, value: 'f' }, "#1");
a.deep(it.next(), { done: false, value: 'o' }, "#2");
a.deep(it.next(), { done: false, value: 'o' }, "#3");
a.deep(it.next(), { done: false, value: 'b' }, "#4");
a.deep(it.next(), { done: false, value: 'a' }, "#5");
a.deep(it.next(), { done: false, value: 'r' }, "#6");
a.deep(it.next(), { done: true, value: undefined }, "End");
a.h1("Outside of BMP");
it = new T('r💩z');
a.deep(it.next(), { done: false, value: 'r' }, "#1");
a.deep(it.next(), { done: false, value: '💩' }, "#2");
a.deep(it.next(), { done: false, value: 'z' }, "#3");
a.deep(it.next(), { done: true, value: undefined }, "End");
};

View File

@@ -0,0 +1,16 @@
'use strict';
var iteratorSymbol = require('es6-symbol').iterator
, Iterator = require('../');
module.exports = function (t, a) {
var obj;
a.throws(function () { t(); }, TypeError, "Undefined");
a.throws(function () { t({}); }, TypeError, "Plain object");
a.throws(function () { t({ length: 0 }); }, TypeError, "Array-like");
obj = {};
obj[iteratorSymbol] = function () { return new Iterator([]); };
a(t(obj), obj, "Iterator");
obj = [];
a(t(obj), obj, 'Array');
};

View File

@@ -0,0 +1,8 @@
'use strict';
var isIterable = require('./is-iterable');
module.exports = function (value) {
if (!isIterable(value)) throw new TypeError(value + " is not iterable");
return value;
};

View File

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

View File

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

View File

@@ -0,0 +1,9 @@
language: node_js
node_js:
- 0.8
- 0.10
- 0.11
notifications:
email:
- medikoo+es6-symbol@medikoo.com

View File

@@ -0,0 +1,34 @@
v2.0.1 -- 2015.01.28
* Fix Symbol.prototype[Symbol.isPrimitive] implementation
* Improve validation within Symbol.prototype.toString and
Symbol.prototype.valueOf
v2.0.0 -- 2015.01.28
* Update up to changes in specification:
* Implement `for` and `keyFor`
* Remove `Symbol.create` and `Symbol.isRegExp`
* Add `Symbol.match`, `Symbol.replace`, `Symbol.search`, `Symbol.species` and
`Symbol.split`
* Rename `validSymbol` to `validateSymbol`
* Improve documentation
* Remove dead test modules
v1.0.0 -- 2015.01.26
* Fix enumerability for symbol properties set normally (e.g. obj[symbol] = value)
* Introduce initialization via hidden constructor
* Fix isSymbol handling of polyfill values when native Symbol is present
* Fix spelling of LICENSE
* Configure lint scripts
v0.1.1 -- 2014.10.07
* Fix isImplemented, so it returns true in case of polyfill
* Improve documentations
v0.1.0 -- 2014.04.28
* Assure strictly npm dependencies
* Update to use latest versions of dependencies
* Fix implementation detection so it doesn't crash on `String(symbol)`
* throw on `new Symbol()` (as decided by TC39)
v0.0.0 -- 2013.11.15
* Initial (dev) version

View File

@@ -0,0 +1,19 @@
Copyright (C) 2013-2015 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.

View File

@@ -0,0 +1,71 @@
# es6-symbol
## ECMAScript 6 Symbol polyfill
For more information about symbols see following links
- [Symbols in ECMAScript 6 by Axel Rauschmayer](http://www.2ality.com/2014/12/es6-symbols.html)
- [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol)
- [Specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-constructor)
### Limitations
Underneath it uses real string property names which can easily be retrieved, however accidental collision with other property names is unlikely.
### Usage
If you'd like to use native version when it exists and fallback to polyfill if it doesn't (but without implementing `Symbol` on global scope), do:
```javascript
var Symbol = require('es6-symbol');
```
If you want to make sure your environment implements `Symbol`, do:
```javascript
require('es6-symbol/implement');
```
If you strictly want to use polyfill even if native `Symbol` exists (hard to find a good reason for that), do:
```javascript
var Symbol = require('es6-symbol/polyfill');
```
#### API
Best is to refer to [specification](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-symbol-objects). Still if you want quick look, follow examples:
```javascript
var Symbol = require('es6-symbol');
var symbol = Symbol('My custom symbol');
var x = {};
x[symbol] = 'foo';
console.log(x[symbol]); 'foo'
// Detect iterable:
var iterator, result;
if (possiblyIterable[Symbol.iterator]) {
iterator = possiblyIterable[Symbol.iterator]();
result = iterator.next();
while(!result.done) {
console.log(result.value);
result = iterator.next();
}
}
```
### Installation
#### NPM
In your project path:
$ npm install es6-symbol
##### Browser
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/)
## Tests [![Build Status](https://travis-ci.org/medikoo/es6-symbol.png)](https://travis-ci.org/medikoo/es6-symbol)
$ npm test

View File

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

View File

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

View File

@@ -0,0 +1,18 @@
'use strict';
module.exports = function () {
var symbol;
if (typeof Symbol !== 'function') return false;
symbol = Symbol('test symbol');
try { String(symbol); } catch (e) { return false; }
if (typeof Symbol.iterator === 'symbol') return true;
// Return 'true' for polyfills
if (typeof Symbol.isConcatSpreadable !== 'object') return false;
if (typeof Symbol.iterator !== 'object') return false;
if (typeof Symbol.toPrimitive !== 'object') return false;
if (typeof Symbol.toStringTag !== 'object') return false;
if (typeof Symbol.unscopables !== 'object') return false;
return true;
};

View File

@@ -0,0 +1,8 @@
// Exports true if environment provides native `Symbol` implementation
'use strict';
module.exports = (function () {
if (typeof Symbol !== 'function') return false;
return (typeof Symbol.iterator === 'symbol');
}());

View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = function (x) {
return (x && ((typeof x === 'symbol') || (x['@@toStringTag'] === 'Symbol'))) || false;
};

View File

@@ -0,0 +1,89 @@
{
"_args": [
[
"es6-symbol@~2.0.1",
"/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/es6-weak-map"
]
],
"_from": "es6-symbol@>=2.0.1 <2.1.0",
"_id": "es6-symbol@2.0.1",
"_inCache": true,
"_installable": true,
"_location": "/es6-weak-map/es6-symbol",
"_npmUser": {
"email": "medikoo+npm@medikoo.com",
"name": "medikoo"
},
"_npmVersion": "1.4.28",
"_phantomChildren": {},
"_requested": {
"name": "es6-symbol",
"raw": "es6-symbol@~2.0.1",
"rawSpec": "~2.0.1",
"scope": null,
"spec": ">=2.0.1 <2.1.0",
"type": "range"
},
"_requiredBy": [
"/es6-weak-map",
"/es6-weak-map/es6-iterator"
],
"_resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-2.0.1.tgz",
"_shasum": "761b5c67cfd4f1d18afb234f691d678682cb3bf3",
"_shrinkwrap": null,
"_spec": "es6-symbol@~2.0.1",
"_where": "/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/es6-weak-map",
"author": {
"email": "medyk@medikoo.com",
"name": "Mariusz Nowak",
"url": "http://www.medikoo.com/"
},
"bugs": {
"url": "https://github.com/medikoo/es6-symbol/issues"
},
"dependencies": {
"d": "~0.1.1",
"es5-ext": "~0.10.5"
},
"description": "ECMAScript6 Symbol polyfill",
"devDependencies": {
"tad": "~0.2.1",
"xlint": "~0.2.2",
"xlint-jslint-medikoo": "~0.1.2"
},
"directories": {},
"dist": {
"shasum": "761b5c67cfd4f1d18afb234f691d678682cb3bf3",
"tarball": "http://registry.npmjs.org/es6-symbol/-/es6-symbol-2.0.1.tgz"
},
"gitHead": "51f6938d7830269fefa38f02eb912f5472b3ccd7",
"homepage": "https://github.com/medikoo/es6-symbol",
"keywords": [
"ecmascript",
"es6",
"harmony",
"private",
"property",
"symbol"
],
"license": "MIT",
"maintainers": [
{
"name": "medikoo",
"email": "medikoo+npm@medikoo.com"
}
],
"name": "es6-symbol",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/medikoo/es6-symbol.git"
},
"scripts": {
"lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream",
"lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch",
"test": "node ./node_modules/tad/bin/tad"
},
"version": "2.0.1"
}

View File

@@ -0,0 +1,77 @@
'use strict';
var d = require('d')
, validateSymbol = require('./validate-symbol')
, create = Object.create, defineProperties = Object.defineProperties
, defineProperty = Object.defineProperty, objPrototype = Object.prototype
, Symbol, HiddenSymbol, globalSymbols = create(null);
var generateName = (function () {
var created = create(null);
return function (desc) {
var postfix = 0, name;
while (created[desc + (postfix || '')]) ++postfix;
desc += (postfix || '');
created[desc] = true;
name = '@@' + desc;
defineProperty(objPrototype, name, d.gs(null, function (value) {
defineProperty(this, name, d(value));
}));
return name;
};
}());
HiddenSymbol = function Symbol(description) {
if (this instanceof HiddenSymbol) throw new TypeError('TypeError: Symbol is not a constructor');
return Symbol(description);
};
module.exports = Symbol = function Symbol(description) {
var symbol;
if (this instanceof Symbol) throw new TypeError('TypeError: Symbol is not a constructor');
symbol = create(HiddenSymbol.prototype);
description = (description === undefined ? '' : String(description));
return defineProperties(symbol, {
__description__: d('', description),
__name__: d('', generateName(description))
});
};
defineProperties(Symbol, {
for: d(function (key) {
if (globalSymbols[key]) return globalSymbols[key];
return (globalSymbols[key] = Symbol(String(key)));
}),
keyFor: d(function (s) {
var key;
validateSymbol(s);
for (key in globalSymbols) if (globalSymbols[key] === s) return key;
}),
hasInstance: d('', Symbol('hasInstance')),
isConcatSpreadable: d('', Symbol('isConcatSpreadable')),
iterator: d('', Symbol('iterator')),
match: d('', Symbol('match')),
replace: d('', Symbol('replace')),
search: d('', Symbol('search')),
species: d('', Symbol('species')),
split: d('', Symbol('split')),
toPrimitive: d('', Symbol('toPrimitive')),
toStringTag: d('', Symbol('toStringTag')),
unscopables: d('', Symbol('unscopables'))
});
defineProperties(HiddenSymbol.prototype, {
constructor: d(Symbol),
toString: d('', function () { return this.__name__; })
});
defineProperties(Symbol.prototype, {
toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),
valueOf: d(function () { return validateSymbol(this); })
});
defineProperty(Symbol.prototype, Symbol.toPrimitive, d('',
function () { return validateSymbol(this); }));
defineProperty(Symbol.prototype, Symbol.toStringTag, d('c', 'Symbol'));
defineProperty(HiddenSymbol.prototype, Symbol.toPrimitive,
d('c', Symbol.prototype[Symbol.toPrimitive]));
defineProperty(HiddenSymbol.prototype, Symbol.toStringTag,
d('c', Symbol.prototype[Symbol.toStringTag]));

View File

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

View File

@@ -0,0 +1,12 @@
'use strict';
var d = require('d')
, defineProperty = Object.defineProperty;
module.exports = function (T, a) {
var symbol = T('test'), x = {};
defineProperty(x, symbol, d('foo'));
a(x.test, undefined, "Name");
a(x[symbol], 'foo', "Get");
};

View File

@@ -0,0 +1,14 @@
'use strict';
var global = require('es5-ext/global')
, polyfill = require('../polyfill');
module.exports = function (t, a) {
var cache;
a(typeof t(), 'boolean');
cache = global.Symbol;
global.Symbol = polyfill;
a(t(), true);
if (cache === undefined) delete global.Symbol;
else global.Symbol = cache;
};

View File

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

View File

@@ -0,0 +1,16 @@
'use strict';
var SymbolPoly = 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 Symbol !== 'undefined') {
a(t(Symbol()), true, "Native");
}
a(t(SymbolPoly()), true, "Polyfill");
};

View File

@@ -0,0 +1,27 @@
'use strict';
var d = require('d')
, isSymbol = require('../is-symbol')
, defineProperty = Object.defineProperty;
module.exports = function (T, a) {
var symbol = T('test'), x = {};
defineProperty(x, symbol, d('foo'));
a(x.test, undefined, "Name");
a(x[symbol], 'foo', "Get");
a(x instanceof T, false);
a(isSymbol(symbol), true, "Symbol");
a(isSymbol(T.iterator), true, "iterator");
a(isSymbol(T.toStringTag), true, "toStringTag");
x = {};
x[symbol] = 'foo';
a.deep(Object.getOwnPropertyDescriptor(x, symbol), { configurable: true, enumerable: false,
value: 'foo', writable: true });
symbol = T.for('marko');
a(isSymbol(symbol), true);
a(T.for('marko'), symbol);
a(T.keyFor(symbol), 'marko');
};

View File

@@ -0,0 +1,19 @@
'use strict';
var SymbolPoly = require('../polyfill');
module.exports = function (t, a) {
var symbol;
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 Symbol !== 'undefined') {
symbol = Symbol();
a(t(symbol), symbol, "Native");
}
symbol = SymbolPoly();
a(t(symbol), symbol, "Polyfill");
};

View File

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

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

@@ -0,0 +1,92 @@
{
"_args": [
[
"es6-weak-map@~0.1.4",
"/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/memoizee"
]
],
"_from": "es6-weak-map@>=0.1.4 <0.2.0",
"_id": "es6-weak-map@0.1.4",
"_inCache": true,
"_installable": true,
"_location": "/es6-weak-map",
"_nodeVersion": "0.12.2",
"_npmUser": {
"email": "medikoo+npm@medikoo.com",
"name": "medikoo"
},
"_npmVersion": "2.7.4",
"_phantomChildren": {
"d": "0.1.1",
"es5-ext": "0.10.11"
},
"_requested": {
"name": "es6-weak-map",
"raw": "es6-weak-map@~0.1.4",
"rawSpec": "~0.1.4",
"scope": null,
"spec": ">=0.1.4 <0.2.0",
"type": "range"
},
"_requiredBy": [
"/memoizee"
],
"_resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-0.1.4.tgz",
"_shasum": "706cef9e99aa236ba7766c239c8b9e286ea7d228",
"_shrinkwrap": null,
"_spec": "es6-weak-map@~0.1.4",
"_where": "/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/memoizee",
"author": {
"email": "medyk@medikoo.com",
"name": "Mariusz Nowak",
"url": "http://www.medikoo.com/"
},
"bugs": {
"url": "https://github.com/medikoo/es6-weak-map/issues"
},
"dependencies": {
"d": "~0.1.1",
"es5-ext": "~0.10.6",
"es6-iterator": "~0.1.3",
"es6-symbol": "~2.0.1"
},
"description": "ECMAScript6 WeakMap polyfill",
"devDependencies": {
"tad": "~0.2.2"
},
"directories": {},
"dist": {
"shasum": "706cef9e99aa236ba7766c239c8b9e286ea7d228",
"tarball": "http://registry.npmjs.org/es6-weak-map/-/es6-weak-map-0.1.4.tgz"
},
"gitHead": "e68802395b82a700257374c379cfaafe84ee8552",
"homepage": "https://github.com/medikoo/es6-weak-map",
"keywords": [
"collection",
"es6",
"gc",
"harmony",
"hash",
"list",
"map",
"weakmap"
],
"license": "MIT",
"maintainers": [
{
"name": "medikoo",
"email": "medikoo+npm@medikoo.com"
}
],
"name": "es6-weak-map",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/medikoo/es6-weak-map.git"
},
"scripts": {
"test": "node ./node_modules/tad/bin/tad"
},
"version": "0.1.4"
}

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;
};