Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

skava / exotic   js

Repository URL to install this package:

Version: 2.0.8 

/ src / types / primitive / string / isStringPrimitive.ts

/**
 * Checks if `value` is classified as a `String` **primitive**.
 *
 * @since 3.0.0
 * @category Lang
 * @memberOf is
 * @param {*} x The value to check.
 * @returns {boolean} Returns `true` if `value` is a string, else `false`.
 *
 * @see https://github.com/canjs/can-util/blob/master/js/is-string/is-string.js
 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
 * @see https://github.com/lodash/lodash/blob/master/isString.js
 * @see is/string
 *
 * @example
 *
 * isString('abc')
 * //=> true
 *
 * isString(new String('abc'))
 * //=> false
 *
 * isString(1)
 * //=> false
 */
const isStringPrimitive = (x: any): x is string => typeof x === 'string'

export { isStringPrimitive }
export default isStringPrimitive