From 297d69ad0eb1cadd6500d8d9dbdfc747a835f056 Mon Sep 17 00:00:00 2001 From: Karl von Randow Date: Wed, 29 May 2019 13:04:16 +1200 Subject: [PATCH 1/2] =?UTF-8?q?Remove=20documentation=20for=20`keepImageTa?= =?UTF-8?q?g`=20option=20which=20doesn=E2=80=99t=20exist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- truncate.js | 1 - 1 file changed, 1 deletion(-) diff --git a/truncate.js b/truncate.js index 07fb83f..e228ab5 100644 --- a/truncate.js +++ b/truncate.js @@ -25,7 +25,6 @@ * @param {String} string string needs to be truncated * @param {Number} maxLength length of truncated string * @param {Object} options (optional) - * @param {Boolean} [options.keepImageTag] flag to specify if keep image tag, false by default * @param {Boolean|String} [options.ellipsis] omission symbol for truncated string, '...' by default * @return {String} truncated string */ From 7916cecefbb87be94099fad67607edaee9b20c3c Mon Sep 17 00:00:00 2001 From: Karl von Randow Date: Wed, 29 May 2019 13:04:27 +1200 Subject: [PATCH 2/2] Add types --- package.json | 1 + truncate.d.ts | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 truncate.d.ts diff --git a/package.json b/package.json index ae77beb..8148119 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "author": "Francois-Guillaume Ribreau (http://fgribreau.com)", "name": "truncate", "main": "truncate.js", + "types": "truncate.d.ts", "description": "Truncate text and keep urls safe", "version": "2.0.1", "homepage": "https://github.com/FGRibreau/node-truncate", diff --git a/truncate.d.ts b/truncate.d.ts new file mode 100644 index 0000000..f2778db --- /dev/null +++ b/truncate.d.ts @@ -0,0 +1,7 @@ +declare module 'truncate' { + interface TruncateOptions { + ellipsis?: string + } + + export default function truncate(string: string, maxLength: number, options?: TruncateOptions): string +}