aboutsummaryrefslogtreecommitdiff
path: root/node_modules/es6-iterator/string.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-08-14 05:01:11 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-08-14 05:02:09 +0200
commit363723fc84f7b8477592e0105aeb331ec9a017af (patch)
tree29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/es6-iterator/string.js
parent5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff)
downloadwallet-core-363723fc84f7b8477592e0105aeb331ec9a017af.tar.xz
node_modules
Diffstat (limited to 'node_modules/es6-iterator/string.js')
-rw-r--r--node_modules/es6-iterator/string.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/node_modules/es6-iterator/string.js b/node_modules/es6-iterator/string.js
new file mode 100644
index 000000000..cdb39ea4e
--- /dev/null
+++ b/node_modules/es6-iterator/string.js
@@ -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]'; })
+});