Add type definitions for wrap-ansi (https://www.npmjs.com/package/wrap-ansi) (#9090)

This commit is contained in:
Klaus Reimer
2016-04-25 23:47:15 +09:00
committed by Masahiro Wakame
parent b97c0d5a22
commit d4c9dc3197
2 changed files with 28 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
/// <reference path="./wrap-ansi.d.ts" />
import wrapAnsi = require("wrap-ansi");
wrapAnsi("input", 80) === "output";
wrapAnsi("input", 80, {}) === "output";
wrapAnsi("input", 80, { hard: true }) === "output";
wrapAnsi("input", 80, { hard: false }) === "output";
+20
View File
@@ -0,0 +1,20 @@
// Type definitions for wrap-ansi v2.0.0
// Project: https://www.npmjs.com/package/wrap-ansi
// Definitions by: Klaus Reimer <https://github.com/kayahr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "wrap-ansi" {
/**
* Wrap words to the specified column width.
*
* @param input String with ANSI escape codes. Like one styled by chalk.
* @param columns Number of columns to wrap the text to.
* @param options By default the wrap is soft, meaning long words may extend past the column width. Setting
* this to true will make it hard wrap at the column width.
*/
function wrapAnsi(input: string, columns: number, options?: { hard?: boolean }): string;
namespace wrapAnsi {}
export = wrapAnsi;
}