isString(val)

Return true if the provided value is a string literal or String object (otherwise return false). Uses the Object.prototype.toString.call(val) === '[object String]' implementation.

  • val any — 

    value to be checked

returns bool

See

  • maybeStringify — 

    uses this function to determine whether or not to process the value

Examples

const {isString} = require('spooning');

isString('string'); // returns true

// noinspection JSPrimitiveTypeWrapperUsage
isString(new String('string')); // returns true

isString(null); // returns false

isString(123); // returns false

isString(); // returns false