Open qianfeii opened 6 years ago
@HookyQR @qianfeii
What does [pieCase](params) {
mean in javascript? This looks very odd.
[xxx]
is a computed property name. xxx
can be anything that evaluates to (basically) a string. ie.
function nameIt() { return "crazyMethod"; }
class Abc {
[nameIt()]() { return "result"; }
}
Will create a class with a method of this.crazyMethod
on it. You can define properties (keys) on an object the same way. Things like:
{
[`${start}${end}`]: "some value"
}
Are perfectly valid.
Just looked at 1.8.3-rc2. Seems they're unrelated. This might be a harder one to solve.
Computed property names ... I found this in ES6: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer Is that it?
@bitwiseman Yes, specifically https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Computed_property_names
Here is my settings :
VS Code:
.jsbeautifyrc
Action performed
Format javascript file with
HookyQR.beautifyFile
command provide example code Here is my code i want to formatActual results
Details of what happened ... the end_with_newline didn't work, it didn't add new line at the end automatically。and there are 4 spaces at the beginning at the new line after symbol function .it means there are 4 spaces at
before 'let',and the lines under 'let _this=this' are all beginning with 4 space
and by the way ,how can i format json with beautify default , and i hope it can remove extra ',' .
and thanks ,i like this formatter plugin