JavaScript version
decapitalize.js
const decapitalize = (str) => `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
// Or
const decapitalize = ([first, ...rest]) => `${first.toLowerCase()}${rest.join('')}`;
TypeScript version
decapitalize.ts
const decapitalize = (str: string): string => `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
// Or
const decapitalize = ([first, ...rest]: string): string => `${first.toLowerCase()}${rest.join('')}`;
Examples
examples.js
decapitalize('Hello world'); // 'hello world'