voca
Version:
The ultimate JavaScript string library
24 lines (20 loc) • 528 B
JavaScript
import './internal/is_nil.js';
import './is_string.js';
import { c as coerceToString } from './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 coerceToString(subject).length;
}
export default count;