inibase 1.0.0-rc.73 → 1.0.0-rc.74
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/dist/cli.js +3 -3
- package/dist/file.js +1 -1
- package/dist/index.js +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +3 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "dotenv/config";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { basename, join } from "node:path";
|
|
3
5
|
import { createInterface } from "node:readline/promises";
|
|
4
6
|
import { parseArgs } from "node:util";
|
|
5
|
-
import { basename, join } from "node:path";
|
|
6
|
-
import { readFileSync } from "node:fs";
|
|
7
7
|
import Inison from "inison";
|
|
8
|
+
import { isExists } from "./file.js";
|
|
8
9
|
import Inibase from "./index.js";
|
|
9
10
|
import { isJSON, isNumber, setField, unsetField } from "./utils.js";
|
|
10
|
-
import { isExists } from "./file.js";
|
|
11
11
|
const textGreen = (input) => `\u001b[1;32m${input}\u001b[0m`;
|
|
12
12
|
const textRed = (input) => `\u001b[1;31m${input}\u001b[0m`;
|
|
13
13
|
const textBlue = (input) => `\u001b[1;34m${input}\u001b[0m`;
|
package/dist/file.js
CHANGED
|
@@ -109,7 +109,7 @@ export const encode = (input) => Array.isArray(input)
|
|
|
109
109
|
*/
|
|
110
110
|
const unSecureString = (input) => {
|
|
111
111
|
if (isNumber(input))
|
|
112
|
-
return Number(input);
|
|
112
|
+
return String(input).at(0) === "0" ? input : Number(input);
|
|
113
113
|
if (typeof input === "string")
|
|
114
114
|
return input.replace(/\\n/g, "\n") || null;
|
|
115
115
|
return null;
|
package/dist/index.js
CHANGED
|
@@ -383,7 +383,7 @@ export default class Inibase {
|
|
|
383
383
|
const RETURN = {};
|
|
384
384
|
for (const field of schema) {
|
|
385
385
|
if (!Object.hasOwn(data, field.key)) {
|
|
386
|
-
if (formatOnlyAvailiableKeys
|
|
386
|
+
if (formatOnlyAvailiableKeys)
|
|
387
387
|
continue;
|
|
388
388
|
RETURN[field.key] = this.getDefaultValue(field);
|
|
389
389
|
continue;
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -118,7 +118,7 @@ export const isHTML = (input) => /<\/?\s*[a-z-][^>]*\s*>|(\&(?:[\w\d]+|#\d+|#x[a
|
|
|
118
118
|
* Note: Validates the input against being a number, boolean, email, URL, or IP address to ensure it's a general string.
|
|
119
119
|
*/
|
|
120
120
|
export const isString = (input) => Object.prototype.toString.call(input) === "[object String]" &&
|
|
121
|
-
!isNumber(input);
|
|
121
|
+
(!isNumber(input) || String(input).at(0) === "0");
|
|
122
122
|
/**
|
|
123
123
|
* Checks if the input is a valid IP address format.
|
|
124
124
|
*
|
|
@@ -208,6 +208,8 @@ export const detectFieldType = (input, availableTypes) => {
|
|
|
208
208
|
return "date";
|
|
209
209
|
if (availableTypes.includes("number"))
|
|
210
210
|
return "number";
|
|
211
|
+
if (availableTypes.includes("string") && String(input).at(0) === "0")
|
|
212
|
+
return "string";
|
|
211
213
|
}
|
|
212
214
|
else if (typeof input === "string") {
|
|
213
215
|
if (availableTypes.includes("table") && isValidID(input))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inibase",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.74",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Karim Amahtil",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"dotenv": "^16.4.5",
|
|
77
|
-
"inison": "
|
|
77
|
+
"inison": "1.0.0-rc.3"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"build": "npx tsc",
|