@ibi-dev/valid-check 1.0.0

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 ADDED
@@ -0,0 +1,37 @@
1
+ # valid-check
2
+
3
+ Lightweight, dependency-free validation helpers for JavaScript and React Native applications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install valid-check
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```javascript
14
+ import { isValidString, isValidNumber, isValidElement } from "validation-check";
15
+
16
+ console.log(isValidString("Hello"));
17
+ console.log(isValidNumber(123));
18
+ console.log(isValidElement("test"));
19
+ ```
20
+
21
+ ## Functions
22
+
23
+ ### isValidString
24
+
25
+ Checks whether a value is a non-empty string.
26
+
27
+ ### isValidNumber
28
+
29
+ Checks whether a value is a valid number.
30
+
31
+ ### isValidElement
32
+
33
+ Checks whether a value is not null, undefined.
34
+
35
+ ## License
36
+
37
+ MIT
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@ibi-dev/valid-check",
3
+ "version": "1.0.0",
4
+ "description": "Valid-check/Validation-check: Lightweight, dependency-free validation helpers for strings, numbers, and elements.",
5
+ "main": "src/index.js",
6
+ "files": [
7
+ "src"
8
+ ],
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1"
11
+ },
12
+ "keywords": [
13
+ "validation",
14
+ "validator",
15
+ "isvalid",
16
+ "string",
17
+ "number",
18
+ "element",
19
+ "utils",
20
+ "checker"
21
+ ],
22
+ "author": "mohammedibrahimfazal@gmail.com",
23
+ "license": "MIT"
24
+ }
package/src/index.js ADDED
@@ -0,0 +1,9 @@
1
+ const isValidString = require('./isValidString');
2
+ const isValidNumber = require('./isValidNumber');
3
+ const isValidElement = require('./isValidElement');
4
+
5
+ module.exports = {
6
+ isValidString,
7
+ isValidNumber,
8
+ isValidElement,
9
+ };
@@ -0,0 +1,5 @@
1
+ const isValidElement = (value) => {
2
+ return value !== null && value !== undefined;
3
+ };
4
+
5
+ module.exports = isValidElement;
@@ -0,0 +1,5 @@
1
+ const isValidNumber = (value) => {
2
+ return typeof value === 'number' && Number.isFinite(value);
3
+ };
4
+
5
+ module.exports = isValidNumber;
@@ -0,0 +1,5 @@
1
+ const isValidString = (value) => {
2
+ return typeof value === "string" && value?.trim()?.length > 0;
3
+ };
4
+
5
+ module.exports = isValidString;