You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
432 B

4 years ago
  1. var asciiSize = require('./_asciiSize'),
  2. hasUnicode = require('./_hasUnicode'),
  3. unicodeSize = require('./_unicodeSize');
  4. /**
  5. * Gets the number of symbols in `string`.
  6. *
  7. * @private
  8. * @param {string} string The string to inspect.
  9. * @returns {number} Returns the string size.
  10. */
  11. function stringSize(string) {
  12. return hasUnicode(string)
  13. ? unicodeSize(string)
  14. : asciiSize(string);
  15. }
  16. module.exports = stringSize;