foodbot-cart-calculations 1.0.58 → 1.0.59
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/index.js +17 -17
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const calculation = require('./calculations');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path')
|
|
2
|
+
// const fs = require('fs');
|
|
3
|
+
// const path = require('path')
|
|
4
4
|
|
|
5
5
|
async function calculateTax(inputJSON) {
|
|
6
6
|
return new Promise(async (resolve, reject) => {
|
|
@@ -75,23 +75,23 @@ async function calculateTax(inputJSON) {
|
|
|
75
75
|
})
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
let json = JSON.parse(fs.readFileSync('./sample.json', 'utf8'));
|
|
79
|
-
calculateTax(json).then(res=>{
|
|
80
|
-
|
|
78
|
+
// let json = JSON.parse(fs.readFileSync('./sample.json', 'utf8'));
|
|
79
|
+
// calculateTax(json).then(res=>{
|
|
80
|
+
// // console.log(JSON.stringify(res))
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
// const jsonResponse = JSON.stringify(res, null, 2); // Format the JSON with indentation
|
|
83
|
+
// const filePath = path.join(__dirname, 'response.json'); // File path in the same directory
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
// fs.writeFile(filePath, jsonResponse, 'utf8', err => {
|
|
86
|
+
// if (err) {
|
|
87
|
+
// console.error('Error writing to file:', err);
|
|
88
|
+
// } else {
|
|
89
|
+
// console.log('Response successfully written to response.json');
|
|
90
|
+
// }
|
|
91
|
+
// });
|
|
92
92
|
|
|
93
|
-
}).catch(err=>{
|
|
94
|
-
|
|
95
|
-
})
|
|
93
|
+
// }).catch(err=>{
|
|
94
|
+
// console.log(err)
|
|
95
|
+
// })
|
|
96
96
|
|
|
97
97
|
module.exports = { calculateTax }
|
package/package.json
CHANGED