UNPKG

voca

Version:

The ultimate JavaScript string library

27 lines (22 loc) 608 B
'use strict'; require('./internal/is_nil.js'); require('./is_string.js'); var coerce_to_string = require('./internal/coerce_to_string.js'); /** * Splits `subject` into an array of characters. * * @function chars * @static * @since 1.0.0 * @memberOf Split * @param {string} [subject=''] The string to split into characters. * @return {Array} Returns the array of characters. * @example * v.chars('cloud'); * // => ['c', 'l', 'o', 'u', 'd'] */ function chars(subject) { var subjectString = coerce_to_string.coerceToString(subject); return subjectString.split(''); } module.exports = chars;