10 examples of 'typescript check if string' in JavaScript

Every line of 'typescript check if string' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
4function isString(node) {
5 return t.isLiteral(node) && typeof node.value === 'string';
6}
141isString (node) {
142 return node && (
143 types.isLiteral(node) &&
144 typeof node.value === 'string' || (
145 types.isTemplateLiteral(node) &&
146 node.expressions.length === 0 &&
147 node.quasis.length === 1
148 )
149 )
150}
9export function string(val) {
10 return typeof val === 'string' || val instanceof String;
11}
8function isString(node) {
9 return node.type == 'Value' && typeof node.value == 'string'
10}
6export default function isString(node) {
7 return node.type === 'Literal' && typeof node.value === 'string';
8}
9function isString (str) {
10 return typeof str === 'string' || str instanceof String;
11}
6function isString (str: mixed): boolean %checks {
7 return typeof str === 'string' || str instanceof String;
8}
9export function isString(string) {
10 return typeof string === 'string';
11}
4function checkArrayForString(arr, string) {
5 for(let i = 0; i < arr.length; i++) {
6 if(arr[i].indexOf(string) > -1) {
7 return true;
8 }
9 };
10 return false;
11}
40export function is_string(value) {
41 return typeof value === 'string';
42}

Related snippets