diff --git a/README.md b/README.md index 74cf86b39..e8ec39467 100644 --- a/README.md +++ b/README.md @@ -8594,7 +8594,7 @@ isPromiseLike({}); // false ### isString -Checks if the given argument is a string. +Checks if the given argument is a string. Only works for string primitives. Use `typeof` to check if a value is classified as a string primitive. diff --git a/docs/type.html b/docs/type.html index 8d52b4bf3..12dcf006c 100644 --- a/docs/type.html +++ b/docs/type.html @@ -170,7 +170,7 @@ }); // true isPromiseLike(null); // false isPromiseLike({}); // false -
Checks if the given argument is a string.
Use typeof to check if a value is classified as a string primitive.
const isString = val => typeof val === 'string'; +
Checks if the given argument is a string. Only works for string primitives.
Use typeof to check if a value is classified as a string primitive.
const isString = val => typeof val === 'string';
isString('10'); // true
Checks if the given argument is a symbol.
Use typeof to check if a value is classified as a symbol primitive.
const isSymbol = val => typeof val === 'symbol';
isSymbol(Symbol('x')); // true