Skip to content

Commit 95e74ba

Browse files
committed
Remove all non-letter, non-ascii-digit characters
For consistency with change-case. Signed-off-by: Kevin Locke <[email protected]>
1 parent 1182443 commit 95e74ba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,8 @@ export default function dotnetIdentifierCase(value) {
4141
return first.toUpperCase() + rest.toLowerCase();
4242
})
4343
// Remove non-alnum characters
44-
.replaceAll(/[^\p{L}\p{N}]+/gu, '');
44+
// Note: C# identifiers can have [\p{L}\p{Nl}\p{Nd}\p{Pc}\p{Mn}\p{Mc}\p{Cf}]
45+
// Stick with [\p{L}\d] for consistency with change-case
46+
// https://github.com/blakeembrey/change-case/blob/38e6b4f9115cf93b18ca9b1b4a620a32751499cb/packages/change-case/src/index.ts#L9
47+
.replaceAll(/[^\p{L}\d]+/gu, '');
4548
}

0 commit comments

Comments
 (0)