Skip to main content

Strings

anagram#

Check if a string is an anagram of another string.

const td = require('types-doodler');
const options = { string: 'abbccc' };
const anagram = td.strings.anagram({ str1: 'listen', str2: 'silent' });
console.log(anagram); // true
PropertyDescriptionTypeDefaultRequired
str1Target string 1.string✔️
str2Target string 2.string✔️
insensitiveWhether it should worry about casing or not.booleanfalse

charmap#

Returns a charmap (object) of the provided string.

const td = require('types-doodler');
const options = { string: 'abbccc' };
const charmap = td.strings.charmap(options);
console.log(charmap); // { a: 1, b: 2, c: 3 }
PropertyDescriptionTypeDefaultRequired
stringString to be checked.string✔️
insensitiveWhether it should worry about casing or not.booleanfalse

palindrome#

Checks whether the provided string is a palindrome or not.

const td = require('types-doodler');
const options = { string: 'madam' };
const palindrome = td.strings.palindrome(options);
console.log(palindrome); // true
PropertyDescriptionTypeDefaultRequired
stringString to be checked.string✔️

reverse#

Reverse the provided string as a whole or word by word.

const td = require('types-doodler');
const options = { string: 'This-is-entirely-reversed', whole: true, separator: '-' };
const reverse = td.strings.reverse(options);
console.log(reverse); // desrever-yleritne-si-sihT
PropertyDescriptionTypeDefaultRequired
stringString to be edited.string✔️
wholeWhether the string should be separated as a whole or not.booleanfalse
separatorCharacter used as a separator in the string.string

weird-case#

Transform the supplied string to weird-casing.

const td = require('types-doodler');
const options = { string: 'this-is-so-weird', separator: '-' };
const weird = td.strings.weirdCase(options);
console.log(weird); // ThIs-Is-So-WeIrD
PropertyDescriptionTypeDefaultRequired
stringString to be edited.string✔️
separatorCharacter used as a separator in the string.string