parser-de-notas-de-corretagem 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,20 +2,20 @@
2
2
 
3
3
  Easing the PITA of making IRRF
4
4
 
5
- > Note: This is a JS/TS package. If you want the final-user solution, check the [Leitor de notas de corretagem](https://github.com/planetsLightningArrester/leitor-de-notas-de-corretagem)
5
+ > Note: This is a JS/TS package. If you want the end-user solution, check the [Leitor de notas de corretagem](https://github.com/planetsLightningArrester/leitor-de-notas-de-corretagem)
6
6
 
7
7
  ## Example result
8
8
  > The `price` and `average` fields already include the fees paid
9
9
  ```JSON
10
10
  [
11
11
  {
12
- "number": "11111",
12
+ "number": "11111", // Brokerage note number
13
13
  "buyTotal": "4054.58",
14
14
  "sellTotal": "0.00",
15
15
  "buyFees": "1.24",
16
16
  "sellFees": "0.00",
17
17
  "fees": "1.24",
18
- "date": "02/02/2022",
18
+ "date": "02/02/2022", // Can also output in yyyy-MM-dd format
19
19
  "holder": "rico",
20
20
  "deals": [
21
21
  {
@@ -34,7 +34,7 @@ Easing the PITA of making IRRF
34
34
  "average": "112.80",
35
35
  "price": "564.02",
36
36
  "date": "02/02/2022",
37
- "cnpj": "00.000.000/0000-00"
37
+ "cnpj": "00.000.000/0000-00" // FIIs' CNPJs aren't supported yet
38
38
  },
39
39
  {
40
40
  "type": "buy",
@@ -88,8 +88,8 @@ async function main() {
88
88
 
89
89
  // Get all negotiation notes inside a PDF, even with password
90
90
  const possiblePDFpasswords: string[] = ['123', '456'];
91
- let pdfPassword = path.join(__dirname, 'note.pdf');
92
- let parseResult = await assets.parseNote(pdfPassword, possiblePDFpasswords);
91
+ let pdfPath = path.join(__dirname, 'note.pdf');
92
+ let parseResult = await assets.parseNote(pdfPath, possiblePDFpasswords);
93
93
 
94
94
  // Merge all negotiation notes
95
95
  let allDeals: Deal[][] = [];
@@ -147,6 +147,6 @@ Consider thanking me: send a "Thanks!" 👋 by [PIX](https://www.bcb.gov.br/en/f
147
147
  > a09e5878-2355-45f7-9f36-6df4ccf383cf
148
148
 
149
149
  ## License
150
- As license, this software is provided as is, free of charge, without any warranty whatsoever. Its author is not responsible for its usage. Use it by your own risk.
150
+ As license, this software is provided as is, free of charge, **without any warranty whatsoever**. Its author is not responsible for its usage. Use it by your own risk.
151
151
 
152
152
  [GNU GPLv3](https://choosealicense.com/licenses/gpl-3.0/)
package/notes-parser.d.ts CHANGED
@@ -72,6 +72,10 @@ export declare class NegotiationNote {
72
72
  */
73
73
  deals: Deal[];
74
74
  }
75
+ /**
76
+ * Possible date formats to be used
77
+ */
78
+ export type DateFormat = "dd/MM/yyyy" | "yyyy-MM-dd";
75
79
  /**
76
80
  * Brokerage notes parser
77
81
  */
@@ -80,6 +84,10 @@ export declare class NoteParser {
80
84
  * Path to the JSON data file
81
85
  */
82
86
  private stockParser;
87
+ /**
88
+ * The date format used. Default is "dd/MM/yyyy"
89
+ */
90
+ private dateFormat;
83
91
  /**
84
92
  * Instantiate a new `NoteParser`
85
93
  * @param autoUpdateLookUpList whether the application should auto-update
@@ -87,6 +95,11 @@ export declare class NoteParser {
87
95
  * Updating this package to the latest version also gets the latest infos
88
96
  */
89
97
  constructor(autoUpdateLookUpList?: boolean);
98
+ /**
99
+ * Set the date format
100
+ * @param format a `DateFormat`
101
+ */
102
+ setDateFormat(format: DateFormat): void;
90
103
  /**
91
104
  * Read and parse a given PDF negotiation note by its full path
92
105
  * @param noteFullPath the full path to the PDF note to be parsed
@@ -100,5 +113,11 @@ export declare class NoteParser {
100
113
  * @param cnpj stock CNPJ
101
114
  */
102
115
  defineStock(code: string, name: string, cnpj?: string): void;
116
+ /**
117
+ * Convert a date according to `dateFormat`
118
+ * @param date the date to be formatted
119
+ * @returns the formatted date
120
+ */
121
+ private formatDate;
103
122
  }
104
123
  //# sourceMappingURL=notes-parser.d.ts.map