aboutsummaryrefslogtreecommitdiff
path: root/node_modules/core-js/modules/$.string-at.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-03 15:35:00 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-03 15:35:00 +0200
commitde98e0b232509d5f40c135d540a70e415272ff85 (patch)
treea79222a5b58484ab3b80d18efcaaa7ccc4769b33 /node_modules/core-js/modules/$.string-at.js
parente0c9d480a73fa629c1e4a47d3e721f1d2d345406 (diff)
node_modules
Diffstat (limited to 'node_modules/core-js/modules/$.string-at.js')
-rw-r--r--node_modules/core-js/modules/$.string-at.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/node_modules/core-js/modules/$.string-at.js b/node_modules/core-js/modules/$.string-at.js
new file mode 100644
index 000000000..3d344bba7
--- /dev/null
+++ b/node_modules/core-js/modules/$.string-at.js
@@ -0,0 +1,17 @@
+var toInteger = require('./$.to-integer')
+ , defined = require('./$.defined');
+// true -> String#at
+// false -> String#codePointAt
+module.exports = function(TO_STRING){
+ return function(that, pos){
+ var s = String(defined(that))
+ , i = toInteger(pos)
+ , l = s.length
+ , a, b;
+ if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
+ a = s.charCodeAt(i);
+ return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
+ ? TO_STRING ? s.charAt(i) : a
+ : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
+ };
+}; \ No newline at end of file