binhend 2.1.17 → 2.1.18

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 CHANGED
@@ -24,6 +24,7 @@ const createCSD = require('./src/csd');
24
24
  const security = require('./src/security');
25
25
  const types = require('./src/utils/types');
26
26
  const validation = require('./src/utils/validation');
27
+ const typedefs = require('./src/utils/typedefs');
27
28
  const Bromise = require('./src/utils/Bromise.js');
28
29
 
29
30
  /** CLIENT - Frontend */
@@ -46,6 +47,7 @@ module.exports = {
46
47
  createCSD,
47
48
  security,
48
49
  types,
50
+ typedefs,
49
51
  validation,
50
52
  Bromise,
51
53
  WebBuilder,
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "binhend",
3
- "version": "2.1.17",
3
+ "version": "2.1.18",
4
4
  "description": "",
5
5
  "main": "index.js",
6
- "types": "src/types/index.d.ts",
7
6
  "author": "Nguyen Duc Binh",
8
7
  "license": "UNLICENSED",
9
8
  "bin": {
@@ -0,0 +1,31 @@
1
+
2
+ /**
3
+ * @typedef {Object<string, any>} ObjectType
4
+ */
5
+
6
+ /**
7
+ * Type definition for object accepting any extra properties
8
+ *
9
+ * @returns {ObjectType}
10
+ */
11
+ function ObjectType() { return this; }
12
+
13
+
14
+
15
+ /**
16
+ * @typedef {(Date|string|number)} DateType
17
+ */
18
+
19
+ /**
20
+ * Type definition for date accepting any valid formats (string, number, date)
21
+ *
22
+ * @returns {DateType}
23
+ */
24
+ function DateType() { return this; }
25
+
26
+
27
+
28
+ module.exports = {
29
+ ObjectType,
30
+ DateType
31
+ };
package/demo.js DELETED
@@ -1,45 +0,0 @@
1
-
2
- const { HttpCodes, ConfigLoader, WebBuilder, HttpError, validation } = require('./index');
3
-
4
- // HttpCodes.ACCEPTED;
5
-
6
- // new ConfigLoader({}).cli;
7
-
8
- // const builder = new WebBuilder('src', { output: 'build/bundle' });
9
-
10
- // builder.bundle();
11
-
12
- // throw new HttpError(HttpCodes.BAD_REQUEST, '[BINHEND][VALIDATION] Must be a string.');
13
- // throw new HttpError(HttpCodes.BAD_REQUEST, '[BINHEND][VALIDATION] MUST BE A STRING.');
14
- // var typeName = `array`;
15
- // throw new HttpError(HttpCodes.BAD_REQUEST, `Invalid input: value not passed custom validator.`);
16
- // throw new HttpError(HttpCodes.BAD_REQUEST, `Invalid input: unknown reason.`);
17
- // throw new HttpError(HttpCodes.BAD_REQUEST, `Invalid input: value must be type of \`${typeName}\`.`);
18
- // throw new HttpError(HttpCodes.BAD_REQUEST, `Invalid input: Field "title" must be type of \`${typeName}\`.`);
19
-
20
- // validation.String('a', {});
21
-
22
- validation.String('a');
23
- // validation.String(null);
24
- // validation.String(1, { name: 'myNum', message: 'Require string for this field' });
25
-
26
- // validation.Validator('this is me', (input) => {
27
- // if (!input.startsWith('It')) validation.throwError(`"title" must start with 'it' or 'It'`)
28
- // return input.length < 5;
29
- // }, { message: '"title" must not exceed max length of 5' })
30
-
31
-
32
- validation.NotNull(1);
33
- // validation.NotNullish(null, { required: true, default: null });
34
- // validation.String(null, { required: true, default: 1 });
35
-
36
- validation.DateLike('2022-10-29a', { default: new Date().getTime() });
37
- validation.Date(new Date());
38
-
39
- function Abc(a) {
40
- this.a = a;
41
- }
42
-
43
- console.log(JSON.stringify(new Abc(123)));
44
-
45
- validation.Object(new Abc(123));