-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
43 lines (39 loc) · 1.07 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"use strict";
const ListItBuffer = require("./lib/list-it-buffer.js");
/**
* @typedef {object} ListItOption
* @property {boolean} autoAlign - Align number vertical with its decimal point.
* @property {Array<number>|number|null} columnWidth - Column width by character length.
*/
/**
* ListIt constructor.
*
* @class
* @param {ListItOption|null} opt An option to create.
* @example <caption>Create instace</caption>
* const ListIt = require("list-it");
* const listit = new ListIt({ autoAlign: true });
* @description
* In default, the `autoAlign` of option is true.
*/
function ListIt(opt) {
ListItBuffer.call(this, opt);
}
ListIt.prototype = new ListItBuffer();
/**
* Create the ListIt instance.
* This method clear the autoAlign option, it it was not specified.
*
* @deprecated Use ListIt constructor instead.
*
* @param {object} opt option
* @returns {ListIt} A ListIt instance
*/
ListIt.buffer = function (opt) {
opt = opt || {};
if(!("autoAlign" in opt)) {
opt.autoAlign = false;
}
return new ListIt(opt);
};
module.exports = ListIt;