voca
Version:
The ultimate JavaScript string library
27 lines (22 loc) • 585 B
JavaScript
;
require('./internal/is_nil.js');
require('./is_string.js');
var coerce_to_string = require('./internal/coerce_to_string.js');
/**
* Reverses the `subject`.
*
* @function reverse
* @static
* @since 1.0.0
* @memberOf Manipulate
* @param {string} [subject=''] The string to reverse.
* @return {string} Returns the reversed string.
* @example
* v.reverse('winter');
* // => 'retniw'
*/
function reverse(subject) {
var subjectString = coerce_to_string.coerceToString(subject);
return subjectString.split('').reverse().join('');
}
module.exports = reverse;