@enre-ts/naming
v0.4.3
Published
@enre-ts/naming defines data structures for naming entities unambiguously
Downloads
49
Maintainers
Readme
Notice
The @enre-ts/naming package has been refactored to leverage simplified format.
BEFORE:
foo // Normal and valid identifier
<File base="foo" ext="ts">
<Anonymous as="Function">
<Modified raw="a-not-valid-identifier" as="StringLiteral">AFTER:
foo // Not changed
<File foo.ts>
<Anon Function>
<Str a-not-valid-identifier>(For details see src/name.ts)
Migration
Below are step-by-step guides to help downstream users to migrate to the new format.
Apply new string format in docs
Below are regex matcher and replacer that convert strings matched to the former pattern to the latter.
Update all
Filename<File base="(.+)" ext="(.+)"><File $1.$2>Update all
Anonymousname<Anonymous as="(.+)"><Anon $1>Update all
Modifiedname<Modified raw="(.+)" as="StringLiteral"><Str $1><Modified raw="(.+)" as="NumericLiteral" value=".+"><Num $1><Modified raw="(.+)" as="PrivateIdentifier"><Pvt $1>
Apply new object creation format in code
BEFORE:
import {buildENREName, ENRENameAnonymous} from '@enre-ts/naming';
buildENREName('some name'); // Normal valid identifier
buildENREName<ENRENameAnonymous>({as: 'Class'}); // Anonymous classAFTER:
import ENREName from '@enre-ts/naming';
new ENREName('Norm', 'some name'); // Normal valid identifier
new ENREName('Anon', 'Class'); // Anonymous class