CHORE: Rename js.Javascript to js.JavaScript (#2405)

This commit is contained in:
Tom Limoncelli 2023-05-30 18:02:24 -04:00 committed by GitHub
parent 83a7f06718
commit e9b4b9b34d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View file

@ -122,7 +122,7 @@ func ExecuteDSL(args ExecuteDSLArgs) (*models.DNSConfig, error) {
return nil, fmt.Errorf("no config specified")
}
dnsConfig, err := js.ExecuteJavascript(args.JSFile, args.DevMode, stringSliceToMap(args.Variable))
dnsConfig, err := js.ExecuteJavaScript(args.JSFile, args.DevMode, stringSliceToMap(args.Variable))
if err != nil {
return nil, fmt.Errorf("executing %s: %w", args.JSFile, err)
}

View file

@ -35,8 +35,8 @@ var currentDirectory string
// EnableFetch sets whether to enable fetch() in JS execution environment
var EnableFetch bool = false
// ExecuteJavascript accepts a javascript file and runs it, returning the resulting dnsConfig.
func ExecuteJavascript(file string, devMode bool, variables map[string]string) (*models.DNSConfig, error) {
// ExecuteJavaScript accepts a javascript file and runs it, returning the resulting dnsConfig.
func ExecuteJavaScript(file string, devMode bool, variables map[string]string) (*models.DNSConfig, error) {
script, err := os.ReadFile(file)
if err != nil {
return nil, err

View file

@ -41,7 +41,7 @@ func TestParsedFiles(t *testing.T) {
var err error
// Compile the .js file:
conf, err := ExecuteJavascript(string(filepath.Join(testDir, name)), true, nil)
conf, err := ExecuteJavaScript(string(filepath.Join(testDir, name)), true, nil)
if err != nil {
t.Fatal(err)
}
@ -144,7 +144,7 @@ func TestErrors(t *testing.T) {
}
for _, tst := range tests {
t.Run(tst.desc, func(t *testing.T) {
if _, err := ExecuteJavascript(tst.text, true, nil); err == nil {
if _, err := ExecuteJavaScript(tst.text, true, nil); err == nil {
t.Fatal("Expected error but found none")
}
})