@rogolev/value 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +19 -1
  3. package/docs/classes/Value/constructor.md +48 -0
  4. package/docs/classes/Value/get.md +51 -0
  5. package/docs/classes/Value/getType.md +71 -0
  6. package/docs/classes/Value/isArray.md +67 -0
  7. package/docs/classes/Value/isAssoc.md +68 -0
  8. package/docs/classes/Value/isBigInt.md +52 -0
  9. package/docs/classes/Value/isBool.md +60 -0
  10. package/docs/classes/Value/isBoolean.md +60 -0
  11. package/docs/classes/Value/isClass.md +55 -0
  12. package/docs/classes/Value/isEmpty.md +84 -0
  13. package/docs/classes/Value/isFloat.md +52 -0
  14. package/docs/classes/Value/isFunction.md +60 -0
  15. package/docs/classes/Value/isInfinity.md +60 -0
  16. package/docs/classes/Value/isInt.md +52 -0
  17. package/docs/classes/Value/isInteger.md +52 -0
  18. package/docs/classes/Value/isList.md +59 -0
  19. package/docs/classes/Value/isNaN.md +79 -0
  20. package/docs/classes/Value/isNull.md +59 -0
  21. package/docs/classes/Value/isNumber.md +80 -0
  22. package/docs/classes/Value/isNumeric.md +79 -0
  23. package/docs/classes/Value/isObject.md +68 -0
  24. package/docs/classes/Value/isScalar.md +72 -0
  25. package/docs/classes/Value/isString.md +67 -0
  26. package/docs/classes/Value/isSymbol.md +75 -0
  27. package/docs/classes/Value/isUndefined.md +67 -0
  28. package/docs/classes/Value/print.md +164 -0
  29. package/docs/classes/Value/printType.md +158 -0
  30. package/docs/classes/Value/setType.md +79 -0
  31. package/docs/classes/Value/toArray.md +85 -0
  32. package/docs/classes/Value/toAssoc.md +85 -0
  33. package/docs/classes/Value/toBool.md +71 -0
  34. package/docs/classes/Value/toBoolean.md +71 -0
  35. package/docs/classes/Value/toFloat.md +72 -0
  36. package/docs/classes/Value/toInt.md +72 -0
  37. package/docs/classes/Value/toInteger.md +72 -0
  38. package/docs/classes/Value/toList.md +77 -0
  39. package/docs/classes/Value/toObject.md +78 -0
  40. package/docs/classes/Value/toPrint.md +115 -0
  41. package/docs/classes/Value/toPrintType.md +110 -0
  42. package/docs/classes/Value/toString.md +134 -0
  43. package/docs/classes/Value.md +113 -0
  44. package/docs/classes.md +2 -0
  45. package/docs/constants.md +47 -0
  46. package/docs/helpers/value.md +95 -0
  47. package/docs/helpers.md +2 -0
  48. package/index.mjs +3 -0
  49. package/package.json +2 -2
  50. package/src/classes/Convert.mjs +818 -819
  51. package/src/classes/Type.mjs +1284 -1285
  52. package/src/classes/Value.mjs +2846 -0
  53. package/src/constants.mjs +14 -0
  54. package/src/helpers/array.mjs +107 -107
  55. package/src/helpers/empty.mjs +70 -70
  56. package/src/helpers/gettype.mjs +149 -133
  57. package/src/helpers/is_array.mjs +128 -128
  58. package/src/helpers/is_assoc.mjs +51 -51
  59. package/src/helpers/is_bigint.mjs +47 -47
  60. package/src/helpers/is_bool.mjs +43 -43
  61. package/src/helpers/is_boolean.mjs +43 -43
  62. package/src/helpers/is_class.mjs +87 -87
  63. package/src/helpers/is_float.mjs +67 -67
  64. package/src/helpers/is_function.mjs +74 -74
  65. package/src/helpers/is_infinity.mjs +52 -52
  66. package/src/helpers/is_int.mjs +57 -57
  67. package/src/helpers/is_integer.mjs +74 -74
  68. package/src/helpers/is_list.mjs +43 -43
  69. package/src/helpers/is_nan.mjs +51 -51
  70. package/src/helpers/is_null.mjs +37 -37
  71. package/src/helpers/is_number.mjs +49 -49
  72. package/src/helpers/is_numeric.mjs +64 -64
  73. package/src/helpers/is_object.mjs +72 -72
  74. package/src/helpers/is_scalar.mjs +45 -45
  75. package/src/helpers/is_string.mjs +46 -46
  76. package/src/helpers/is_symbol.mjs +46 -46
  77. package/src/helpers/is_undefined.mjs +44 -44
  78. package/src/helpers/print.mjs +245 -245
  79. package/src/helpers/print_type.mjs +261 -261
  80. package/src/helpers/settype.mjs +101 -101
  81. package/src/helpers/to_array.mjs +118 -118
  82. package/src/helpers/to_assoc.mjs +98 -98
  83. package/src/helpers/to_bool.mjs +68 -68
  84. package/src/helpers/to_boolean.mjs +64 -64
  85. package/src/helpers/to_float.mjs +72 -72
  86. package/src/helpers/to_int.mjs +93 -93
  87. package/src/helpers/to_integer.mjs +81 -81
  88. package/src/helpers/to_list.mjs +56 -56
  89. package/src/helpers/to_object.mjs +94 -94
  90. package/src/helpers/to_string.mjs +157 -157
  91. package/src/helpers/value.mjs +92 -0
  92. package/tests/classes/Convert.test.mjs +398 -399
  93. package/tests/classes/Type.test.mjs +1262 -1263
  94. package/tests/classes/Value.test.mjs +423 -0
  95. package/tests/constants.test.mjs +75 -0
  96. package/tests/helpers/array.test.mjs +58 -58
  97. package/tests/helpers/empty.test.mjs +22 -22
  98. package/tests/helpers/gettype.test.mjs +74 -74
  99. package/tests/helpers/is_array.test.mjs +404 -404
  100. package/tests/helpers/is_assoc.test.mjs +42 -42
  101. package/tests/helpers/is_bigint.test.mjs +51 -51
  102. package/tests/helpers/is_bool.test.mjs +43 -43
  103. package/tests/helpers/is_boolean.test.mjs +43 -43
  104. package/tests/helpers/is_class.test.mjs +84 -84
  105. package/tests/helpers/is_float.test.mjs +87 -87
  106. package/tests/helpers/is_function.test.mjs +83 -83
  107. package/tests/helpers/is_infinity.test.mjs +46 -46
  108. package/tests/helpers/is_int.test.mjs +45 -45
  109. package/tests/helpers/is_integer.test.mjs +64 -64
  110. package/tests/helpers/is_list.test.mjs +42 -42
  111. package/tests/helpers/is_nan.test.mjs +43 -43
  112. package/tests/helpers/is_null.test.mjs +17 -17
  113. package/tests/helpers/is_number.test.mjs +25 -25
  114. package/tests/helpers/is_numeric.test.mjs +30 -30
  115. package/tests/helpers/is_object.test.mjs +52 -52
  116. package/tests/helpers/is_scalar.test.mjs +21 -21
  117. package/tests/helpers/is_string.test.mjs +20 -20
  118. package/tests/helpers/is_symbol.test.mjs +20 -20
  119. package/tests/helpers/is_undefined.test.mjs +18 -18
  120. package/tests/helpers/print.test.mjs +62 -62
  121. package/tests/helpers/print_type.test.mjs +62 -62
  122. package/tests/helpers/settype.test.mjs +34 -34
  123. package/tests/helpers/to_array.test.mjs +38 -38
  124. package/tests/helpers/to_assoc.test.mjs +33 -33
  125. package/tests/helpers/to_bool.test.mjs +51 -51
  126. package/tests/helpers/to_boolean.test.mjs +51 -51
  127. package/tests/helpers/to_float.test.mjs +26 -26
  128. package/tests/helpers/to_int.test.mjs +48 -48
  129. package/tests/helpers/to_integer.test.mjs +48 -48
  130. package/tests/helpers/to_list.test.mjs +32 -32
  131. package/tests/helpers/to_object.test.mjs +36 -36
  132. package/tests/helpers/to_string.test.mjs +71 -71
  133. package/tests/helpers/value.test.mjs +68 -0
@@ -0,0 +1,47 @@
1
+ [Главная](../README.md) / Константы
2
+
3
+ # Константы
4
+
5
+ Этот файл содержит константы, используемые для определения типов данных в библиотеке.
6
+
7
+ ## Сигнатура
8
+
9
+ ```ts
10
+ export const TYPE_NULL: string;
11
+ export const TYPE_NAN: string;
12
+ export const TYPE_UNDEFINED: string;
13
+ export const TYPE_INFINITY: string;
14
+ export const TYPE_BOOLEAN: string;
15
+ export const TYPE_INTEGER: string;
16
+ export const TYPE_BIGINT: string;
17
+ export const TYPE_FLOAT: string;
18
+ export const TYPE_STRING: string;
19
+ export const TYPE_SYMBOL: string;
20
+ export const TYPE_CLASS: string;
21
+ export const TYPE_FUNCTION: string;
22
+ export const TYPE_ARRAY: string;
23
+ export const TYPE_OBJECT: string;
24
+ ```
25
+
26
+ ## Описание
27
+
28
+ Константы используются для определения типов данных в библиотеке. Они представляют собой строки,
29
+ которые описывают различные типы данных.
30
+
31
+ ### Константы
32
+
33
+ - `TYPE_NULL` — Представляет тип `null`.
34
+ - `TYPE_NAN` — Представляет тип `NaN`.
35
+ - `TYPE_UNDEFINED` — Представляет тип `undefined`.
36
+ - `TYPE_INFINITY` — Представляет тип `infinity`.
37
+ - `TYPE_BOOLEAN` — Представляет тип `boolean`.
38
+ - `TYPE_INTEGER` — Представляет тип `integer`.
39
+ - `TYPE_BIGINT` — Представляет тип `bigint`.
40
+ - `TYPE_FLOAT` — Представляет тип `float`.
41
+ - `TYPE_STRING` — Представляет тип `string`.
42
+ - `TYPE_SYMBOL` — Представляет тип `symbol`.
43
+ - `TYPE_CLASS` — Представляет тип `class`.
44
+ - `TYPE_FUNCTION` — Представляет тип `function`.
45
+ - `TYPE_ARRAY` — Представляет тип `array`.
46
+ - `TYPE_OBJECT` — Представляет тип `object`.
47
+
@@ -0,0 +1,95 @@
1
+ [Главная](../../README.md) / [Помощники](../helpers.md) / value
2
+
3
+ [Исходный код](../../src/helpers/value.mjs)
4
+
5
+ # value
6
+
7
+ `value` — Создает новый экземпляр класса `Value` с заданным значением.
8
+
9
+ ## Сигнатура функции
10
+
11
+ ```ts
12
+ value(val: any): Value;
13
+ ```
14
+
15
+ ## Описание
16
+
17
+ Функция `value` используется для создания нового экземпляра класса `Value` с переданным значением.
18
+ Это позволяет легко обернуть значение в экземпляр класса `Value` и использовать методы класса для
19
+ работы с этим значением.
20
+
21
+ ## Параметры
22
+
23
+ - `val` (any): Значение, которое необходимо обернуть в экземпляр класса `Value`.
24
+
25
+ ## Возвращаемое значение
26
+
27
+ Возвращает новый экземпляр класса `Value` с переданным значением.
28
+
29
+ ## Примеры использования
30
+
31
+ 1. Создание экземпляра класса `Value` с числом:
32
+
33
+ ```js
34
+ const valueInstance = value(123);
35
+ console.log(valueInstance.get()); // 123
36
+ console.log(valueInstance.getType()); // 'integer'
37
+ console.log(valueInstance.isNumber()); // true
38
+ ```
39
+
40
+ 2. Создание экземпляра класса `Value` со строкой:
41
+
42
+ ```js
43
+ const valueInstance = value('example');
44
+ console.log(valueInstance.get()); // 'example'
45
+ console.log(valueInstance.getType()); // 'string'
46
+ console.log(valueInstance.isString()); // true
47
+ ```
48
+
49
+ 3. Создание экземпляра класса `Value` с объектом:
50
+
51
+ ```js
52
+ const obj = { key: 'value' };
53
+ const valueInstance = value(obj);
54
+ console.log(valueInstance.get()); // { key: 'value' }
55
+ console.log(valueInstance.getType()); // 'object'
56
+ console.log(valueInstance.isObject()); // true
57
+ ```
58
+
59
+ 4. Создание экземпляра класса `Value` с массивом:
60
+
61
+ ```js
62
+ const arr = [1, 2, 3];
63
+ const valueInstance = value(arr);
64
+ console.log(valueInstance.get()); // [1, 2, 3]
65
+ console.log(valueInstance.getType()); // 'array'
66
+ console.log(valueInstance.isArray()); // true
67
+ ```
68
+
69
+ 5. Создание экземпляра класса `Value` с булевым значением:
70
+
71
+ ```js
72
+ const valueInstance = value(true);
73
+ console.log(valueInstance.get()); // true
74
+ console.log(valueInstance.getType()); // 'boolean'
75
+ console.log(valueInstance.isBool()); // true
76
+ ```
77
+
78
+ 6. Создание экземпляра класса `Value` с null:
79
+
80
+ ```js
81
+ const valueInstance = value(null);
82
+ console.log(valueInstance.get()); // null
83
+ console.log(valueInstance.getType()); // 'null'
84
+ console.log(valueInstance.isNull()); // true
85
+ ```
86
+
87
+ 7. Создание экземпляра класса `Value` с undefined:
88
+
89
+ ```js
90
+ const valueInstance = value(undefined);
91
+ console.log(valueInstance.get()); // undefined
92
+ console.log(valueInstance.getType()); // 'undefined'
93
+ console.log(valueInstance.isUndefined()); // true
94
+ ```
95
+
package/docs/helpers.md CHANGED
@@ -49,3 +49,5 @@
49
49
  - [to_list](./helpers/to_list.md) — Преобразует значение в список.
50
50
  - [to_object](./helpers/to_object.md) — Преобразует значение в объект.
51
51
  - [to_string](./helpers/to_string.md) — Преобразует значение в строку.
52
+ - [value](./helpers/value.md) — Создает новый экземпляр класса `Value` с заданным значением.
53
+
package/index.mjs CHANGED
@@ -35,6 +35,9 @@ export { default as empty } from './src/helpers/empty.mjs';
35
35
  export { default as settype } from './src/helpers/settype.mjs';
36
36
  export { default as print } from './src/helpers/print.mjs';
37
37
  export { default as print_type } from './src/helpers/print_type.mjs';
38
+ export { default as value } from './src/helpers/value.mjs';
38
39
  export { default as Type } from './src/classes/Type.mjs';
39
40
  export { default as Convert } from './src/classes/Convert.mjs';
41
+ export { default as Value } from './src/classes/Value.mjs';
42
+ export * from './src/constants.mjs';
40
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogolev/value",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Библиотека, переосмысливающая типы данных и работу с ними.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -35,6 +35,7 @@
35
35
  "eslint": "^9.18.0",
36
36
  "eslint-config-prettier": "^9.1.0",
37
37
  "eslint-plugin-prettier": "^5.2.1",
38
+ "globals": "^15.14.0",
38
39
  "jest": "^29.7.0",
39
40
  "jest-environment-jsdom": "^29.7.0",
40
41
  "prettier": "3.4.2"
@@ -45,4 +46,3 @@
45
46
  "test": "jest"
46
47
  }
47
48
  }
48
-