_stringSize.js 430 B

123456789101112131415161718
  1. import asciiSize from './_asciiSize.js';
  2. import hasUnicode from './_hasUnicode.js';
  3. import unicodeSize from './_unicodeSize.js';
  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. export default stringSize;