diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
commit | cc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch) | |
tree | 92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/es5-ext/string/#/at.js | |
parent | 3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff) |
remove node_modules
Diffstat (limited to 'node_modules/es5-ext/string/#/at.js')
-rw-r--r-- | node_modules/es5-ext/string/#/at.js | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/node_modules/es5-ext/string/#/at.js b/node_modules/es5-ext/string/#/at.js deleted file mode 100644 index a8c291794..000000000 --- a/node_modules/es5-ext/string/#/at.js +++ /dev/null @@ -1,35 +0,0 @@ -// Based on: https://github.com/mathiasbynens/String.prototype.at -// Thanks @mathiasbynens ! - -"use strict"; - -var toInteger = require("../../number/to-integer") - , validValue = require("../../object/valid-value"); - -module.exports = function (pos) { - var str = String(validValue(this)), size = str.length, cuFirst, cuSecond, nextPos, len; - pos = toInteger(pos); - - // Account for out-of-bounds indices - // The odd lower bound is because the ToInteger operation is - // going to round `n` to `0` for `-1 < n <= 0`. - if (pos <= -1 || pos >= size) return ""; - - // Second half of `ToInteger` - // eslint-disable-next-line no-bitwise - pos |= 0; - // Get the first code unit and code unit value - cuFirst = str.charCodeAt(pos); - nextPos = pos + 1; - len = 1; - if ( - // Check if it’s the start of a surrogate pair - cuFirst >= 0xd800 && - cuFirst <= 0xdbff && // High surrogate - size > nextPos // There is a next code unit - ) { - cuSecond = str.charCodeAt(nextPos); - if (cuSecond >= 0xdc00 && cuSecond <= 0xdfff) len = 2; // Low surrogate - } - return str.slice(pos, pos + len); -}; |