aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPriyansh <[email protected]>2022-01-18 21:32:38 -0500
committerPriyansh <[email protected]>2022-01-18 21:32:38 -0500
commitdf1e7936c73dbc4754068643c1b4f129469dd82f (patch)
tree1e45ebf9d6005349dada3c9d3adaa9c6218c3150 /src
parente43088ab05bdad73e014fe7ba0911a3459ba1977 (diff)
downloadizuku.js-df1e7936c73dbc4754068643c1b4f129469dd82f.tar.xz
izuku.js-df1e7936c73dbc4754068643c1b4f129469dd82f.zip
refactor: renamed frame frunction to data in frame class
Diffstat (limited to 'src')
-rw-r--r--src/index.ts30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/index.ts b/src/index.ts
index 4452730..37fa533 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,36 +1,36 @@
export default class Izuku {
- constructor(data?: Array<unknown[]>, header?: Array<string>) {
- this.data = data || [];
+ constructor(rowdata?: Array<unknown[]>, header?: Array<string>) {
+ this.rowdata = rowdata || [];
this.header = header || [];
}
- protected data: Array<unknown[]> = [];
+ protected rowdata: Array<unknown[]> = [];
protected header: Array<string> = [];
/**
- * frame creates a new frame
- * @param data: the data to be sent to the frame
- * @returns a new frame with the data or updates the current frame with new data or returns the current data if data is present
+ * data sets the rowdata of the frame, it creates a new frame if the frame is undefined
+ * @param rowdata: the rowdata to be sent to the frame
+ * @returns a new frame with the rowdata or updates the current frame with new rowdata or returns the current rowdata if rowdata is present
*/
- frame(data?: Array<unknown[]>): Izuku | unknown[][] {
- if (data) {
- this.data = data;
- return new Izuku(data, this.header);
- } else if (this.data) {
- return this.data;
+ data(rowdata?: Array<unknown[]>): Izuku | unknown[][] {
+ if (rowdata) {
+ this.rowdata = rowdata;
+ return new Izuku(rowdata, this.header);
+ } else if (this.rowdata) {
+ return this.rowdata;
} else {
- throw new Error('Frame has no data.');
+ throw new Error('Frame has no rowdata.');
}
}
/**
- * columns creates a new header for the current data
+ * columns sets the header of the frame, it creates a new frame if the frame is undefined
* @param header: the header to be sent to the frame
* @returns a new frame with the header or updates the current frame with new header or returns the current header if header is present
*/
columns(header?: Array<string>): Izuku | Array<string> {
if (header) {
this.header = header;
- return new Izuku(this.data, header);
+ return new Izuku(this.rowdata, header);
} else if (this.header) {
return this.header;
} else {