UNPKG

voca

Version:

The ultimate JavaScript string library

26 lines (21 loc) 562 B
'use strict'; require('./internal/is_nil.js'); require('./is_string.js'); var coerce_to_string = require('./internal/coerce_to_string.js'); /** * Counts the characters in `subject`.<br/> * * @function count * @static * @since 1.0.0 * @memberOf Count * @param {string} [subject=''] The string to count characters. * @return {number} Returns the number of characters in `subject`. * @example * v.count('rain'); * // => 4 */ function count(subject) { return coerce_to_string.coerceToString(subject).length; } module.exports = count;