101
Version:
common javascript utils that can be required selectively that assume es5+
16 lines (13 loc) • 344 B
JavaScript
/**
* @module 101/is-string
*/
/**
* Functional version of val typeof 'string'
* @function module:101/is-string
* @param {*} val - value checked to be a string
* @return {boolean} Whether the value is an string or not
*/
module.exports = isString;
function isString (val) {
return typeof val === 'string' || val instanceof String;
}