editor-api icon indicating copy to clipboard operation
editor-api copied to clipboard

Problem with capital letters in scriptName

Open albertvanveen opened this issue 5 years ago • 3 comments

Description

When I create a new script with for example the name 'lookAtScreen' then inside the script the result is 'lookAtscreen'. The S is no capital letter anymore. With for example 'thisIsABug' the result inside the script is 'thisIsAbug'. The B is no capital letter anymore. If I try 'testTestTest' then the result is as expected.

unknown

image

Steps to Reproduce

  1. Create a new script with some capital letters
  2. Check the result inside the script

albertvanveen avatar Sep 22 '20 10:09 albertvanveen

Based on naming conventions been used: lookAtScreen should be lookAtScreen indeed. But thisIsABug should be thisIsAbug, as consecutive capital letters should be lower case. Like HTMLClass, should be HtmlClass, or RGB should be Rgb.

Maksims avatar Sep 22 '20 13:09 Maksims

Ah ok I didn't know that. Then the problem is only when capital letters are used with only one normal letter in between.

albertvanveen avatar Sep 22 '20 13:09 albertvanveen

The code responsible for this is here:

https://github.com/playcanvas/editor-api/blob/main/src/assets/createScript.js#L17

willeastcott avatar Feb 25 '23 11:02 willeastcott