本文整理汇总了TypeScript中colors/safe.strip函数的典型用法代码示例。如果您正苦于以下问题:TypeScript strip函数的具体用法?TypeScript strip怎么用?TypeScript strip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strip函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: helpRun
return helpRun(command).then(() => {
var expected: string = expectedLines.join("\n");
var actual: string = colors.strip(memoryStdout.contentsAsText()); // The colors add extra characters
actual = actual.replace(/ (\.+) ?\n +/gm, " $1 "); // We undo the word-wrapping
actual = actual.replace(/ +$/gm, ""); // Remove useless spaces at the end of a line
actual.should.be.equal(expected);
});
示例2: templatesRun
templatesRun().done(() => {
var expected = [
"CommandTemplatesHeader",
"",
" blank ............... BlankTemplateName",
" typescript .......... TypescriptTemplateName",
"",
"HowToUseCreateProjectWithTemplate",
""].join("\n");
var actual: string = colors.strip(memoryStdout.contentsAsText()); // The colors add extra characters
actual.should.be.equal(expected);
done();
}, done);
示例3: done
create.run(commandData).done(() => {
var expected : string = expectedMessages.join("\n");
var actual: string = colors.strip(memoryStdout.contentsAsText()); // We don't want to compare the colors
actual = actual.replace(/ {10,}/g, tenSpaces); // We don't want to count spaces when we have a lot of them, so we replace it with 10
actual = actual.replace(/-{10,}/g, tenMinuses); // We don't want to count -----s when we have a lot of them, so we replace it with 10 (They also depend dynamically on the path length)
actual = actual.replace(/ +$/gm, ""); // We also don't want trailing spaces
actual = actual.replace(/ \.+ ?\n +/gm, " ..... "); // We undo the word-wrapping
actual = actual.replace(/ *\n +\(/gm, " ("); // We undo the word-wrapping
actual = actual.replace(/\n\n /gm, "\n "); // We undo the word-wrapping
actual = actual.replace(/ \.+ /gm, " ..... "); // We want all the points to always be 5 points .....
if (expectedMessages.every((msg: string) => actual.indexOf(msg) >= 0) || alternativeExpectedMessages.every((msg: string) => actual.indexOf(msg) >= 0)) {
done();
} else {
done(new Error("Bad onboarding for " + createCommandLineArguments));
}
}, (arg: any) => {