提交 17da77f9 编写于 作者: R ronihacohen

CR Fixes

上级 7b9b2cb9
......@@ -383,7 +383,7 @@ export class FormatString extends Marker {
} else if (this.shorthandName === 'capitalize') {
return !value ? '' : (value[0].toLocaleUpperCase() + value.substr(1));
} else if (this.shorthandName === 'pascalcase') {
return !value ? '' : this.toPascalCase(value);
return !value ? '' : this._toPascalCase(value);
} else if (Boolean(value) && typeof this.ifValue === 'string') {
return this.ifValue;
} else if (!Boolean(value) && typeof this.elseValue === 'string') {
......@@ -393,7 +393,7 @@ export class FormatString extends Marker {
}
}
toPascalCase(value: string): string {
private _toPascalCase(value: string): string {
return value.match(/[a-z]+/gi)
.map(function (word) {
return word.charAt(0).toUpperCase()
......
......@@ -655,6 +655,7 @@ suite('SnippetParser', () => {
assert.equal(new FormatString(1, 'downcase').resolve('FOO'), 'foo');
assert.equal(new FormatString(1, 'capitalize').resolve('bar'), 'Bar');
assert.equal(new FormatString(1, 'capitalize').resolve('bar no repeat'), 'Bar no repeat');
assert.equal(new FormatString(1, 'pascalcase').resolve('bar-foo'), 'BarFoo');
assert.equal(new FormatString(1, 'notKnown').resolve('input'), 'input');
// if
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册