some-common-functions-js 1.0.0 → 1.0.1
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 +8 -2
- package/index.js +1 -3
- package/package.json +20 -1
package/README.md
CHANGED
|
@@ -31,6 +31,8 @@ let paths = getPaths(client);
|
|
|
31
31
|
### `hasOnly(anObject, ...fields)`
|
|
32
32
|
Returns `true` if the object contains **only** some or all of the specified fields and no others.
|
|
33
33
|
** Examples **
|
|
34
|
+
const { hasOnly } = require("some-common-functions-js");
|
|
35
|
+
|
|
34
36
|
let car = {
|
|
35
37
|
make: "Ford",
|
|
36
38
|
model: "Ranger",
|
|
@@ -52,7 +54,9 @@ result = hasOnly(car, ["make", "model"]);
|
|
|
52
54
|
### `hasAll(anObject, ...fields)`
|
|
53
55
|
Returns `true` if the object contains **all** the specified fields.
|
|
54
56
|
The object may contain additional fields.
|
|
55
|
-
**
|
|
57
|
+
** Examples **
|
|
58
|
+
const { hasAll } = require("some-common-functions-js");
|
|
59
|
+
|
|
56
60
|
let car = {
|
|
57
61
|
make: "Ford",
|
|
58
62
|
model: "Ranger",
|
|
@@ -61,9 +65,11 @@ let car = {
|
|
|
61
65
|
type: "pickup truck"
|
|
62
66
|
};
|
|
63
67
|
|
|
64
|
-
let result = hasAll(car, ["make", "model"
|
|
68
|
+
let result = hasAll(car, ["make", "model"]);
|
|
65
69
|
// true, because car has all the specified fields.
|
|
66
70
|
|
|
71
|
+
let result = hasAll(car, ["passengerCapacity", "year"]);
|
|
72
|
+
// false, because car does not have "passengerCapacity" field.
|
|
67
73
|
---
|
|
68
74
|
|
|
69
75
|
## 2. Field Validation Functions
|
package/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/** File: ./backend/utilityFunctions/commonFunctions.js
|
|
2
2
|
* Description: Common functions to be put here.
|
|
3
3
|
* Date Dev Version Description
|
|
4
|
-
*
|
|
5
|
-
* 2024/11/11 ITA 1.02 Added file header. Function getPaths to return a sorted array of paths.
|
|
6
|
-
* 2024/11/29 ITA 1.03 Function to be added to export soon after definition.
|
|
4
|
+
* 2025/11/19 ITA 1.00 Genesis.
|
|
7
5
|
*/
|
|
8
6
|
|
|
9
7
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "some-common-functions-js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Common functions used with Javascript objects, and field validation functions.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"validation",
|
|
7
|
+
"validator",
|
|
8
|
+
"validators",
|
|
9
|
+
"validate",
|
|
10
|
+
"user input",
|
|
11
|
+
"email validation",
|
|
12
|
+
"password validation",
|
|
13
|
+
"phone validation",
|
|
14
|
+
"username validation",
|
|
15
|
+
"javascript",
|
|
16
|
+
"utilities",
|
|
17
|
+
"utility",
|
|
18
|
+
"functions",
|
|
19
|
+
"helpers",
|
|
20
|
+
"object utils",
|
|
21
|
+
"object validation",
|
|
22
|
+
"nodejs"
|
|
23
|
+
],
|
|
5
24
|
"repository": {
|
|
6
25
|
"type": "git",
|
|
7
26
|
"url": "https://github.com/IsaiahTshabalala/common-functions"
|