From 3276cdc914e84978fb672817757b98419471e78d Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:38:15 +0100 Subject: [PATCH] (feature) Add _.upperFirst and _.upperCase --- lodash/lodash-tests.ts | 32 +++++++++++++++++ lodash/lodash.d.ts | 81 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 109 insertions(+), 4 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index a20319e2d..574739560 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -8608,6 +8608,38 @@ module Testtruncate { } } +// _.upperCase +module TestUpperCase { + { + let result: string; + + result = _.upperCase('fred, barney, & pebbles'); + result = _('fred, barney, & pebbles').upperCase(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred, barney, & pebbles').chain().upperCase(); + } +} + +// _.upperFirst +module TestUpperFirst { + { + let result: string; + + result = _.upperFirst('fred, barney, & pebbles'); + result = _('fred, barney, & pebbles').upperFirst(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred, barney, & pebbles').chain().upperFirst(); + } +} + // _.unescape module TestUnescape { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ee569ab6e..e3dfd5235 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -114,12 +114,12 @@ added 13 object methods: - [ ] _.unset added 8 string methods: -- [ ] _.lowerCase -- [ ] _.lowerFirst +- [x] _.lowerCase +- [x] _.lowerFirst - [ ] _.replace - [ ] _.split -- [ ] _.upperCase -- [ ] _.upperFirst +- [x] _.upperCase +- [x] _.upperFirst - [ ] _.toLower - [ ] _.toUpper @@ -13599,6 +13599,79 @@ declare module _ { truncate(options?: TruncateOptions|number): LoDashExplicitWrapper; } + //_.upperCase + interface LoDashStatic { + /** + * Converts `string`, as space separated words, to upper case. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the upper cased string. + * @example + * + * _.upperCase('--foo-bar'); + * // => 'FOO BAR' + * + * _.upperCase('fooBar'); + * // => 'FOO BAR' + * + * _.upperCase('__foo_bar__'); + * // => 'FOO BAR' + */ + upperCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.upperCase + */ + upperCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.upperCase + */ + upperCase(): LoDashExplicitWrapper; + } + + //_.upperFirst + interface LoDashStatic { + /** + * Converts the first character of `string` to upper case. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.upperFirst('fred'); + * // => 'Fred' + * + * _.upperFirst('FRED'); + * // => 'FRED' + */ + upperFirst(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.upperFirst + */ + upperFirst(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.upperFirst + */ + upperFirst(): LoDashExplicitWrapper; + } + //_.unescape interface LoDashStatic { /**