Buslowicz / twc

TypeScript based, boilerplate-less, Polymer toolbox friendly Polymer Modules
32 stars 1 forks source link

@computed camelCase incorrectly parsed (?) #70

Closed tpluscode closed 7 years ago

tpluscode commented 7 years ago

I have the weirdest case. When a compute function contains multiple words in camelCase, in the output the names are split into pieces

import {computed} from "twc/annotations/polymer";

export class WtfTest {
    whatever: String;

    @computed
    whateverUpper(whatever){
        return whatever.toUpperCase();
    }

    @computed
    lowerCaseWhatever(whatever) {
        return whatever.toLowerCase();
    }
}

produces JS as below (irrelevant parts removed for brevity)

Polymer({
    properties: {
        whateverUpper: {
            computed: "_computeWhatever Upper(whatever)"
        },
        lowerCaseWhatever: {
            computed: "_computeLower Case Whatever(whatever)"
        }
    },
    _computeWhatever Upper: function(whatever) {},
    _computeLower Case Whatever: function(whatever) {}
});
Buslowicz commented 7 years ago

This is my bad, didn't properly read lodash.startCase doc :(. It's an easy fix, will do that as a priority.

tpluscode commented 7 years ago

Hi. Any chance for this one. Seems petty and it's a bit annoying ;)

Buslowicz commented 7 years ago

Sure, I'll get on it right now. Been a bit busy recently :/.