Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / istanbul / lib / util / help-formatter.js
1 /*
2  Copyright (c) 2012, Yahoo! Inc.  All rights reserved.
3  Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
4  */
5
6 var OPT_PREFIX = "      ",
7     OPT_START = OPT_PREFIX.length,
8     TEXT_START = 14,
9     STOP = 80,
10     wrap = require('wordwrap')(TEXT_START, STOP),
11     paraWrap = require('wordwrap')(1, STOP);
12
13 function formatPara(text) {
14     return paraWrap(text);
15 }
16
17 function formatOption(option, helpText) {
18     var formattedText = wrap(helpText);
19
20     if (option.length > TEXT_START - OPT_START - 2) {
21         return OPT_PREFIX + option + '\n' + formattedText;
22     } else {
23         return OPT_PREFIX + option + formattedText.substring((OPT_PREFIX + option).length);
24     }
25 }
26
27 module.exports = {
28     formatPara: formatPara,
29     formatOption: formatOption
30 };