repo
replacements.fyi

// package

toidentifier

type: "module"

// preferences

// replacements (1)

snippet::to-identifier

Simple or drop-in replacement

This package is no longer necessary. You can transform a string into an identifier (alphanumeric PascalCase) using `map` and a regular expression.

// example

function toIdentifier(str) {
	return str
		.split(' ')
		.map(
			(t) =>
				t.charAt(0).toUpperCase() + t.slice(1),
		)
		.join('')
		.replace(/[^ _0-9a-z]/gi, '');
}