Sep 9, 2021 JavaScript
How to check if a string is an octal number in JavaScript

In this Article we will go through how to check if a string is an octal number only using single line of code in JavaScript. This is a one-line JavaScript code snippet that uses one of the most popular ES6 features => Arrow Function.

Let's define this short function:

const isOctal = str => /^(0o)?[0-7]+$/i.test(str);

Sep 9, 2021 JavaScript
How to check if a string is lower case in JavaScript

In this Article we will go through how to check if a string is lower case only using single line of code in JavaScript. This is a one-line JavaScript code snippet that uses one of the most popular ES6 features => Arrow Function.

Let's define this short function:

const isLowerCase = str => str === str.toLowerCase();

Sep 9, 2021 JavaScript
How to check if a string is upper case in JavaScript

In this Article we will go through how to check if a string is upper case only using single line of code in JavaScript. This is a one-line JavaScript code snippet that uses one of the most popular ES6 features => Arrow Function.

Let's define this short function:

const isUpperCase = str => str === str.toUpperCase();

Sep 9, 2021 JavaScript
How to check if a value is a business identifier code in JavaScript

In this Article we will go through how to check if a value is a business identifier code only using single line of code in JavaScript. This is a one-line JavaScript code snippet that uses one of the most popular ES6 features => Arrow Function.

Let's define this short function:

const isBIC = value => /^[a-zA-Z]{6}[a-zA-Z0-9]{2}([a-zA-Z0-9]{3})?$/.test(value);

Sep 9, 2021 JavaScript
How to check if a value is a number in JavaScript

In this Article we will go through how to check if a value is a number only using single line of code in JavaScript. This is a one-line JavaScript code snippet that uses one of the most popular ES6 features => Arrow Function.

Let's define this short function:

const isNumber = value => !isNaN(parseFloat(value)) && isFinite(value);

Sep 9, 2021 JavaScript
How to check if a value is a plain object in JavaScript

In this Article we will go through how to check if a value is a plain object only using single line of code in JavaScript. This is a one-line JavaScript code snippet that uses one of the most popular ES6 features => Arrow Function.

Let's define this short function:

const isPlainObject = v => (!!v && typeof v === 'object' && (v.__proto__ === null || v.__proto__ === Object.prototype));

Sep 9, 2021 JavaScript
How to check if a value is a regular expression in JavaScript

In this Article we will go through how to check if a value is a regular expression only using single line of code in JavaScript. This is a one-line JavaScript code snippet that uses one of the most popular ES6 features => Arrow Function.

Let's define this short function:

const isRegExp = value => Object.prototype.toString.call(value) === '[object RegExp]';

Sep 9, 2021 JavaScript
How to check if a value is a string in JavaScript

In this Article we will go through how to check if a value is a string only using single line of code in JavaScript. This is a one-line JavaScript code snippet that uses one of the most popular ES6 features => Arrow Function.

Let's define this short function:

const isString = value => Object.prototype.toString.call(value) === '[object String]';

Sep 9, 2021 JavaScript
How to check if a value is an object in JavaScript

In this Article we will go through how to check if a value is an object only using single line of code in JavaScript. This is a one-line JavaScript code snippet that uses one of the most popular ES6 features => Arrow Function.

Let's define this short function:

const isObject = v => (v !== null && typeof v === 'object');

Sep 9, 2021 JavaScript
How to check if a value is base32 encoded in JavaScript

In this Article we will go through how to check if a value is base32 encoded only using single line of code in JavaScript. This is a one-line JavaScript code snippet that uses one of the most popular ES6 features => Arrow Function.

Let's define this short function:

const isBase32 = value => value.length % 8 === 0 && /^[A-Z2-7]+=*$/.test(value);