Skip to content

Commit

Permalink
Comment the truncate() function.
Browse files Browse the repository at this point in the history
  • Loading branch information
phindle committed Feb 24, 2019
1 parent 0db5e31 commit b1f861a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,17 @@ export function activate(context: vscode.ExtensionContext) {
}
}


/**
* Truncate the supplied string to a constant number of characters. (This truncation
* limit is hard-coded, and may be changed only by editing the const inside this function).
*
* @param {string} str - The string to truncate.
* @returns {string} - The truncated string, if the string argument is over the hard-coded limit.
*/
function truncate(str: string): string {
return str.length > 300 ? str.slice(0, 300) + '…' : str;
const truncationLimit: number = 300;
return str.length > truncationLimit ? str.slice(0, truncationLimit) + '…' : str;
}
}

Expand Down

0 comments on commit b1f861a

Please sign in to comment.