UNPKG

jsmodern

Version:

An extension to existing JavaScript, influenced by other great languages such as Rust, Dart, Java, Golang, etc.

14 lines 408 B
export const capitalize = { label: 'capitalize', fn: function stringCapitalize() { const ctx = this; const len = ctx.length; if (!len) return ''; if (1 === len) return ctx.toUpperCase(); const char0 = ctx.slice(0, 1); return `${char0.toUpperCase()}${ctx.slice(1).toLowerCase()}`; }, }; //# sourceMappingURL=capitalize.js.map