mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Merge pull request #6441 from chrootsu/lodash-trunc
lodash: signatures of the method _.trunc changed
This commit is contained in:
+27
-10
@@ -3954,16 +3954,33 @@ result = <string>_('-_-abc-_-').trimRight();
|
||||
result = <string>_('-_-abc-_-').trimRight('_-');
|
||||
|
||||
// _.trunc
|
||||
result = <string>_.trunc('hi-diddly-ho there, neighborino');
|
||||
result = <string>_.trunc('hi-diddly-ho there, neighborino', 24);
|
||||
result = <string>_.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' ' });
|
||||
result = <string>_.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': /,? +/ });
|
||||
result = <string>_.trunc('hi-diddly-ho there, neighborino', { 'omission': ' […]' });
|
||||
result = <string>_('hi-diddly-ho there, neighborino').trunc();
|
||||
result = <string>_('hi-diddly-ho there, neighborino').trunc(24);
|
||||
result = <string>_('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': ' ' });
|
||||
result = <string>_('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': /,? +/ });
|
||||
result = <string>_('hi-diddly-ho there, neighborino').trunc({ 'omission': ' […]' });
|
||||
module TestTrunc {
|
||||
{
|
||||
let result: string;
|
||||
|
||||
result = _.trunc('hi-diddly-ho there, neighborino');
|
||||
result = _.trunc('hi-diddly-ho there, neighborino', 24);
|
||||
result = _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' ' });
|
||||
result = _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': /,? +/ });
|
||||
result = _.trunc('hi-diddly-ho there, neighborino', { 'omission': ' […]' });
|
||||
|
||||
result = _('hi-diddly-ho there, neighborino').trunc();
|
||||
result = _('hi-diddly-ho there, neighborino').trunc(24);
|
||||
result = _('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': ' ' });
|
||||
result = _('hi-diddly-ho there, neighborino').trunc({ 'length': 24, 'separator': /,? +/ });
|
||||
result = _('hi-diddly-ho there, neighborino').trunc({ 'omission': ' […]' });
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<string>;
|
||||
|
||||
result = _('hi-diddly-ho there, neighborino').chain().trunc();
|
||||
result = _('hi-diddly-ho there, neighborino').chain().trunc(24);
|
||||
result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'length': 24, 'separator': ' ' });
|
||||
result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'length': 24, 'separator': /,? +/ });
|
||||
result = _('hi-diddly-ho there, neighborino').chain().trunc({ 'omission': ' […]' });
|
||||
}
|
||||
}
|
||||
|
||||
// _.unescape
|
||||
result = <string>_.unescape('fred, barney, & pebbles');
|
||||
|
||||
Vendored
+12
-1
@@ -9506,11 +9506,15 @@ declare module _ {
|
||||
/**
|
||||
* Truncates string if it’s longer than the given maximum string length. The last characters of the truncated
|
||||
* string are replaced with the omission string which defaults to "…".
|
||||
*
|
||||
* @param string The string to truncate.
|
||||
* @param options The options object or maximum string length.
|
||||
* @return Returns the truncated string.
|
||||
*/
|
||||
trunc(string?: string, options?: TruncOptions|number): string;
|
||||
trunc(
|
||||
string?: string,
|
||||
options?: TruncOptions|number
|
||||
): string;
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapper<T> {
|
||||
@@ -9520,6 +9524,13 @@ declare module _ {
|
||||
trunc(options?: TruncOptions|number): string;
|
||||
}
|
||||
|
||||
interface LoDashExplicitWrapper<T> {
|
||||
/**
|
||||
* @see _.trunc
|
||||
*/
|
||||
trunc(options?: TruncOptions|number): LoDashExplicitWrapper<string>;
|
||||
}
|
||||
|
||||
//_.unescape
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user