Skip to content

Commit

Permalink
Improve JavascriptConverter example
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Jan 20, 2024
1 parent c94d012 commit f574c20
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Enum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,12 @@ Here's a more advance usage of the converter to highlight how you can configure
use Bakame\Aide\Enum\JavascriptConverter;
use Illuminate\Support\Str;

$pascalCase = fn (string $word): string => Str::ucfirst(Str::camel($word)));

$converter = JavascriptConverter::new()
->useImmutability()
->useExportDefault()
->useSymbol()
->intendSize(4)
->propertyNameCase(fn (string $name) => $pascalCase(str_replace('HTTP_', '', $name)));
->propertyNameCase(fn (string $name) => Str::studly(str_replace('HTTP_', '', $name)));

echo $converter->convertToObject(HttpStatusCode::class);

Expand Down

0 comments on commit f574c20

Please sign in to comment.