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]';
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]';
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);
In this Article we will go through how to check if a value is base58 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:
// It doesn't accept the I, O, l characters
const isBase58 = value => /^[A-HJ-NP-Za-km-z1-9]*$/.test(value);
In this Article we will go through how to capitalize 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 capitalize = str => `${str.charAt(0).toUpperCase()}${str.slice(1)}`;
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');
In this Article we will go through how to check if a path is relative 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 isRelative = path => !/^([a-z]+:)?[\\/]/i.test(path);
In this Article we will go through how to check if a string is a palindrome 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 isPalindrome = str => str === str.split('').reverse().join('');
In this Article we will go through how to check if a url is absolute 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 isAbsoluteUrl = url => /^[a-z][a-z0-9+.-]*:/.test(url);
In this Article we will go through how to convert a letter to associate emoji 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 letterToEmoji = c => String.fromCodePoint(c.toLowerCase().charCodeAt() + 127365);