advance-string-index.js 280 B

12345678
  1. 'use strict';
  2. var charAt = require('../internals/string-multibyte').charAt;
  3. // `AdvanceStringIndex` abstract operation
  4. // https://tc39.es/ecma262/#sec-advancestringindex
  5. module.exports = function (S, index, unicode) {
  6. return index + (unicode ? charAt(S, index).length : 1);
  7. };