tiny-essentials 1.8.3 → 1.8.5

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.
Files changed (130) hide show
  1. package/dist/TinyBasicsEs.js +31 -0
  2. package/dist/TinyBasicsEs.min.js +1 -1
  3. package/dist/TinyEssentials.js +31 -0
  4. package/dist/TinyEssentials.min.js +1 -1
  5. package/dist/legacy/crypto/decrypt.cjs +1 -1
  6. package/dist/legacy/crypto/decrypt.mjs +3 -3
  7. package/dist/legacy/crypto/default.cjs +0 -2
  8. package/dist/legacy/crypto/default.mjs +0 -1
  9. package/dist/legacy/crypto/encrypt.cjs +1 -2
  10. package/dist/legacy/crypto/encrypt.mjs +3 -4
  11. package/dist/legacy/crypto/index.cjs +1 -1
  12. package/dist/legacy/crypto/index.mjs +0 -1
  13. package/dist/legacy/firebase/database/presence.cjs +4 -1
  14. package/dist/legacy/firebase/database/presence.d.mts +3 -0
  15. package/dist/legacy/firebase/database/presence.mjs +4 -1
  16. package/dist/legacy/firebase/databaseLogger.cjs +2 -2
  17. package/dist/legacy/firebase/discord/get/cookie-session.cjs +2 -2
  18. package/dist/legacy/firebase/discord/get/errorValidator.cjs +2 -2
  19. package/dist/legacy/firebase/discord/http/login.cjs +7 -7
  20. package/dist/legacy/firebase/discord/http/logout.cjs +4 -4
  21. package/dist/legacy/firebase/discord/http/redirect.cjs +7 -7
  22. package/dist/legacy/firebase/discord/http/refreshToken.cjs +5 -5
  23. package/dist/legacy/firebase/discord/template/cookie-session.cjs +8 -8
  24. package/dist/legacy/firebase/logger.cjs +7 -7
  25. package/dist/legacy/firebase/mySQL.cjs +1 -0
  26. package/dist/legacy/firebase/mysqlConnector/sameUser.cjs +2 -2
  27. package/dist/legacy/get/countObj.cjs +2 -22
  28. package/dist/legacy/get/countObj.d.mts +2 -11
  29. package/dist/legacy/get/countObj.mjs +2 -22
  30. package/dist/legacy/get/decimalColor.cjs +10 -11
  31. package/dist/legacy/get/decimalColor.mjs +10 -10
  32. package/dist/legacy/get/objType.cjs +2 -40
  33. package/dist/legacy/get/objType.d.mts +2 -19
  34. package/dist/legacy/get/objType.mjs +2 -41
  35. package/dist/legacy/get/pagination.cjs +30 -25
  36. package/dist/legacy/get/pagination.d.mts +29 -12
  37. package/dist/legacy/get/pagination.mjs +30 -23
  38. package/dist/legacy/get/queryUrlByName.cjs +0 -2
  39. package/dist/legacy/get/queryUrlByName.mjs +0 -1
  40. package/dist/legacy/get/queryUrlJSON.cjs +2 -2
  41. package/dist/legacy/get/queryUrlJSON.mjs +1 -1
  42. package/dist/legacy/get/super_string_filter.cjs +14 -6
  43. package/dist/legacy/get/super_string_filter.mjs +11 -1
  44. package/dist/legacy/get/versionCheck.cjs +18 -19
  45. package/dist/legacy/get/versionCheck.d.mts +15 -5
  46. package/dist/legacy/get/versionCheck.mjs +16 -16
  47. package/dist/legacy/http/HTTP-1.0.cjs +2 -4
  48. package/dist/legacy/http/HTTP-1.0.d.mts +1 -1
  49. package/dist/legacy/http/HTTP-1.0.mjs +2 -3
  50. package/dist/legacy/http/auth.cjs +2 -4
  51. package/dist/legacy/http/auth.d.mts +4 -4
  52. package/dist/legacy/http/auth.mjs +2 -3
  53. package/dist/legacy/http/check_domain.cjs +15 -9
  54. package/dist/legacy/http/check_domain.d.mts +5 -6
  55. package/dist/legacy/http/check_domain.mjs +12 -8
  56. package/dist/legacy/http/csrfTokenAnalyze.cjs +5 -4
  57. package/dist/legacy/http/csrfTokenAnalyze.d.mts +3 -3
  58. package/dist/legacy/http/csrfTokenAnalyze.mjs +7 -4
  59. package/dist/legacy/http/domainValidator.cjs +13 -9
  60. package/dist/legacy/http/domainValidator.d.mts +15 -6
  61. package/dist/legacy/http/domainValidator.mjs +11 -6
  62. package/dist/legacy/http/errorsCallback.cjs +10 -4
  63. package/dist/legacy/http/errorsCallback.d.mts +13 -3
  64. package/dist/legacy/http/errorsCallback.mjs +12 -4
  65. package/dist/legacy/http/fetch/json.cjs +1 -3
  66. package/dist/legacy/http/fetch/json.mjs +1 -1
  67. package/dist/legacy/http/fetch/text.cjs +1 -3
  68. package/dist/legacy/http/fetch/text.mjs +1 -1
  69. package/dist/legacy/http/fileCache.cjs +2 -5
  70. package/dist/legacy/http/fileCache.d.mts +3 -3
  71. package/dist/legacy/http/fileCache.mjs +2 -3
  72. package/dist/legacy/http/getDomainURL.cjs +4 -7
  73. package/dist/legacy/http/getDomainURL.d.mts +2 -2
  74. package/dist/legacy/http/getDomainURL.mjs +4 -5
  75. package/dist/legacy/http/userIP.cjs +7 -5
  76. package/dist/legacy/http/userIP.d.mts +10 -4
  77. package/dist/legacy/http/userIP.mjs +7 -4
  78. package/dist/legacy/index.cjs +3 -4
  79. package/dist/legacy/index.d.mts +8 -9
  80. package/dist/legacy/libs/arraySortPositions.cjs +1 -3
  81. package/dist/legacy/libs/arraySortPositions.d.mts +2 -2
  82. package/dist/legacy/libs/arraySortPositions.mjs +1 -2
  83. package/dist/legacy/libs/capitalize.cjs +0 -2
  84. package/dist/legacy/libs/capitalize.mjs +0 -1
  85. package/dist/legacy/libs/convertBytes.cjs +1 -3
  86. package/dist/legacy/libs/convertBytes.mjs +1 -2
  87. package/dist/legacy/libs/custom_module_loader.cjs +13 -9
  88. package/dist/legacy/libs/custom_module_loader.d.mts +1 -1
  89. package/dist/legacy/libs/custom_module_loader.mjs +10 -5
  90. package/dist/legacy/libs/dice.cjs +0 -2
  91. package/dist/legacy/libs/dice.mjs +0 -1
  92. package/dist/legacy/libs/markdown.cjs +13 -4
  93. package/dist/legacy/libs/markdown.d.mts +7 -71
  94. package/dist/legacy/libs/markdown.mjs +13 -3
  95. package/dist/legacy/libs/percentage.cjs +0 -2
  96. package/dist/legacy/libs/percentage.mjs +0 -1
  97. package/dist/legacy/libs/regex/getLetter.cjs +0 -2
  98. package/dist/legacy/libs/regex/getLetter.mjs +0 -1
  99. package/dist/legacy/libs/rule3.cjs +0 -2
  100. package/dist/legacy/libs/rule3.mjs +0 -1
  101. package/dist/legacy/momentjs/getAge.cjs +0 -3
  102. package/dist/legacy/momentjs/getAge.d.mts +1 -0
  103. package/dist/legacy/momentjs/getAge.mjs +0 -1
  104. package/dist/legacy/momentjs/index.cjs +1 -1
  105. package/dist/legacy/momentjs/index.mjs +0 -1
  106. package/dist/legacy/momentjs/timeDuration.cjs +1 -3
  107. package/dist/legacy/momentjs/timeDuration.d.mts +1 -0
  108. package/dist/legacy/momentjs/timeDuration.mjs +1 -1
  109. package/dist/legacy/socket.io/antiFlood/index.cjs +1 -1
  110. package/dist/legacy/socket.io/antiFlood/index.mjs +0 -1
  111. package/dist/legacy/socket.io/antiFlood/install.cjs +3 -5
  112. package/dist/legacy/socket.io/antiFlood/install.d.mts +5 -3
  113. package/dist/legacy/socket.io/antiFlood/install.mjs +3 -3
  114. package/dist/legacy/socket.io/antiFlood/verify.cjs +10 -6
  115. package/dist/legacy/socket.io/antiFlood/verify.d.mts +8 -3
  116. package/dist/legacy/socket.io/antiFlood/verify.mjs +10 -6
  117. package/dist/legacy/socket.io/cookie-session.cjs +1 -2
  118. package/dist/legacy/socket.io/cookie-session.mjs +1 -1
  119. package/dist/legacy/socket.io/discord.cjs +0 -3
  120. package/dist/legacy/socket.io/discord.mjs +0 -1
  121. package/dist/legacy/socket.io/index.cjs +0 -3
  122. package/dist/legacy/socket.io/index.mjs +0 -1
  123. package/dist/v1/basics/index.cjs +3 -0
  124. package/dist/v1/basics/index.d.mts +3 -1
  125. package/dist/v1/basics/index.mjs +3 -2
  126. package/dist/v1/index.cjs +3 -0
  127. package/dist/v1/index.d.mts +3 -1
  128. package/dist/v1/index.mjs +3 -2
  129. package/docs/basics/array.md +61 -0
  130. package/package.json +8 -2
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var objType = require('../get/objType.cjs');
3
+ var objFilter = require('../../v1/basics/objFilter.cjs');
4
4
  var moment = require('moment-timezone');
5
5
  var getDBData = require('./getDBData.cjs');
6
6
 
@@ -80,7 +80,7 @@ const tinyAction = async function (where, type, args) {
80
80
  }
81
81
 
82
82
  // Object Type
83
- const type = objType(args[item]);
83
+ const type = objFilter.objType(args[item]);
84
84
 
85
85
  // Insert Args
86
86
  if (type === 'string' || type === 'number' || type === 'object' || type === 'array')
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var objType = require('../../../get/objType.cjs');
3
+ var objFilter = require('../../../../v1/basics/objFilter.cjs');
4
4
 
5
5
  // @ts-nocheck
6
6
 
@@ -26,7 +26,7 @@ var objType = require('../../../get/objType.cjs');
26
26
  */
27
27
  function cookieSession(req, where) {
28
28
  // Get Token
29
- if (objType(req.session, 'object') && typeof req.session[where] === 'string')
29
+ if (objFilter.objType(req.session, 'object') && typeof req.session[where] === 'string')
30
30
  return req.session[where];
31
31
  // Nope
32
32
  else return null;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var objType = require('../../../get/objType.cjs');
3
+ var objFilter = require('../../../../v1/basics/objFilter.cjs');
4
4
 
5
5
  // @ts-nocheck
6
6
 
@@ -37,7 +37,7 @@ function errorValidator(data) {
37
37
  const result = { data: null, error: null };
38
38
 
39
39
  // Exist Object
40
- if (objType(data, 'object')) {
40
+ if (objFilter.objType(data, 'object')) {
41
41
  // Success
42
42
  if (typeof data.message !== 'string' || data.message !== '401: Unauthorized') {
43
43
  // Success Complete
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _ = require('lodash');
4
- var objType = require('../../../get/objType.cjs');
4
+ var objFilter = require('../../../../v1/basics/objFilter.cjs');
5
5
  var _default = require('../../../crypto/default.cjs');
6
6
  var HTTP1_0 = require('../../../http/HTTP-1.0.cjs');
7
7
  var getDomainURL = require('../../../http/getDomainURL.cjs');
@@ -39,7 +39,7 @@ function login(req, res, cfg, existSession) {
39
39
 
40
40
  // Detect Config
41
41
  if (
42
- objType(cfg, 'object') &&
42
+ objFilter.objType(cfg, 'object') &&
43
43
  typeof cfg.type === 'string' &&
44
44
  (cfg.type === 'login' || cfg.type === 'login_command' || cfg.type === 'webhook')
45
45
  ) {
@@ -47,7 +47,7 @@ function login(req, res, cfg, existSession) {
47
47
  const tinyCrypto = _.defaultsDeep({}, cfg.crypto, _default);
48
48
 
49
49
  // Detect Config
50
- if (objType(tinyCrypto, 'object')) {
50
+ if (objFilter.objType(tinyCrypto, 'object')) {
51
51
  // Create Settings
52
52
  const tinyCfg = _.defaultsDeep({}, cfg.auth, {
53
53
  redirect: 'http://localhost/redirect',
@@ -56,7 +56,7 @@ function login(req, res, cfg, existSession) {
56
56
  });
57
57
 
58
58
  // Validate Config
59
- if (objType(tinyCfg, 'object')) {
59
+ if (objFilter.objType(tinyCfg, 'object')) {
60
60
  // Default Values State
61
61
  let tinyState = _.defaultsDeep({}, cfg.state, {
62
62
  csrfToken: '',
@@ -68,20 +68,20 @@ function login(req, res, cfg, existSession) {
68
68
  if (typeof tinyState.type !== 'string') tinyState.type = cfg.type;
69
69
 
70
70
  // Validate State
71
- if (objType(tinyState, 'object')) {
71
+ if (objFilter.objType(tinyState, 'object')) {
72
72
  // Create Settings
73
73
  const tinyQuery = _.defaultsDeep({}, cfg.query, {
74
74
  redirect: 'redirect',
75
75
  });
76
76
 
77
77
  // Exist Cfg
78
- if (objType(tinyQuery, 'object')) {
78
+ if (objFilter.objType(tinyQuery, 'object')) {
79
79
  // Get Domain
80
80
  const tinyDomain = getDomainURL(req, cfg.port);
81
81
 
82
82
  // Redirect
83
83
  let returnRedirect = tinyDomain + '/';
84
- if (objType(req.query, 'object')) {
84
+ if (objFilter.objType(req.query, 'object')) {
85
85
  if (typeof req.query[tinyQuery.redirect] === 'string') {
86
86
  req.query[tinyQuery.redirect] = req.query[tinyQuery.redirect].trim();
87
87
  if (!req.query[tinyQuery.redirect].startsWith('http')) {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _ = require('lodash');
4
- var objType = require('../../../get/objType.cjs');
4
+ var objFilter = require('../../../../v1/basics/objFilter.cjs');
5
5
  var revokeToken = require('../api/revokeToken.cjs');
6
6
  var getUser = require('../api/getUser.cjs');
7
7
 
@@ -32,7 +32,7 @@ var getUser = require('../api/getUser.cjs');
32
32
  async function logout(req, access_token, cfg, existSession) {
33
33
  return new Promise(function (resolve, reject) {
34
34
  // Detect Config
35
- if (objType(cfg, 'object')) {
35
+ if (objFilter.objType(cfg, 'object')) {
36
36
  // Create Settings
37
37
  const tinyQuery = _.defaultsDeep({}, cfg.query, {
38
38
  csrfToken: 'csrfToken',
@@ -45,12 +45,12 @@ async function logout(req, access_token, cfg, existSession) {
45
45
  });
46
46
 
47
47
  // Exist Query Setting
48
- if (objType(tinyQuery, 'object')) {
48
+ if (objFilter.objType(tinyQuery, 'object')) {
49
49
  // Exist Query
50
50
  if (
51
51
  typeof tinyState.csrfToken !== 'string' ||
52
52
  tinyState.csrfToken.length < 1 ||
53
- (objType(req.query, 'object') &&
53
+ (objFilter.objType(req.query, 'object') &&
54
54
  typeof cfg.csrfToken === 'string' &&
55
55
  tinyState.csrfToken === cfg.csrfToken)
56
56
  ) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _ = require('lodash');
4
4
  var _default = require('../../../crypto/default.cjs');
5
- var objType = require('../../../get/objType.cjs');
5
+ var objFilter = require('../../../../v1/basics/objFilter.cjs');
6
6
  var decrypt = require('../../../crypto/decrypt.cjs');
7
7
  var getToken = require('../api/getToken.cjs');
8
8
  var getUser = require('../api/getUser.cjs');
@@ -36,12 +36,12 @@ var getUser = require('../api/getUser.cjs');
36
36
  async function redirect(req, cfg, existSession) {
37
37
  return new Promise(function (resolve, reject) {
38
38
  // Detect Config
39
- if (objType(cfg, 'object')) {
39
+ if (objFilter.objType(cfg, 'object')) {
40
40
  // Create Settings
41
41
  const tinyCrypto = _.defaultsDeep({}, cfg.crypto, _default);
42
42
 
43
43
  // Detect Config
44
- if (objType(tinyCrypto, 'object')) {
44
+ if (objFilter.objType(tinyCrypto, 'object')) {
45
45
  // Create Settings
46
46
  const tinyCfg = _.defaultsDeep({}, cfg.auth, {
47
47
  redirect: 'http://localhost/redirect',
@@ -57,7 +57,7 @@ async function redirect(req, cfg, existSession) {
57
57
  }
58
58
 
59
59
  // Detect Query
60
- if (objType(req.query, 'object')) {
60
+ if (objFilter.objType(req.query, 'object')) {
61
61
  // Get State
62
62
  if (typeof req.query.state === 'string') {
63
63
  // Crypto
@@ -74,7 +74,7 @@ async function redirect(req, cfg, existSession) {
74
74
  }
75
75
 
76
76
  // Detect State
77
- if (objType(req.query.state, 'object')) {
77
+ if (objFilter.objType(req.query.state, 'object')) {
78
78
  // Check Session
79
79
  if (
80
80
  typeof tinyCfg.csrfToken !== 'string' ||
@@ -108,7 +108,7 @@ async function redirect(req, cfg, existSession) {
108
108
  // Success
109
109
  .then((json) => {
110
110
  // Valid Json Data
111
- if (objType(json, 'object')) {
111
+ if (objFilter.objType(json, 'object')) {
112
112
  // Check Token
113
113
  if (
114
114
  typeof json.access_token === 'string' ||
@@ -129,7 +129,7 @@ async function redirect(req, cfg, existSession) {
129
129
  // Get User
130
130
  .then((dsUser) => {
131
131
  // Validate Data
132
- if (objType(dsUser, 'object')) {
132
+ if (objFilter.objType(dsUser, 'object')) {
133
133
  resolveData.user = dsUser;
134
134
  resolve(resolveData);
135
135
  }
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _ = require('lodash');
4
- var objType = require('../../../get/objType.cjs');
4
+ var objFilter = require('../../../../v1/basics/objFilter.cjs');
5
5
  var refreshToken$1 = require('../api/refreshToken.cjs');
6
6
 
7
7
  // @ts-nocheck
@@ -33,7 +33,7 @@ var refreshToken$1 = require('../api/refreshToken.cjs');
33
33
  async function refreshToken(req, cfg, existSession) {
34
34
  return new Promise(function (resolve, reject) {
35
35
  // Detect Config
36
- if (objType(cfg, 'object')) {
36
+ if (objFilter.objType(cfg, 'object')) {
37
37
  // Create Settings
38
38
  const tinyCfg = _.defaultsDeep({}, cfg.auth, {
39
39
  redirect: 'http://localhost/redirect',
@@ -72,8 +72,8 @@ async function refreshToken(req, cfg, existSession) {
72
72
 
73
73
  // Get Query
74
74
  else if (
75
- objType(tinyQuery, 'object') &&
76
- objType(req.query, 'object') &&
75
+ objFilter.objType(tinyQuery, 'object') &&
76
+ objFilter.objType(req.query, 'object') &&
77
77
  typeof tinyQuery.redirect === 'string' &&
78
78
  typeof req.query[tinyQuery.redirect] === 'string'
79
79
  ) {
@@ -99,7 +99,7 @@ async function refreshToken(req, cfg, existSession) {
99
99
  // Success
100
100
  .then((json) => {
101
101
  // Valid Json Data
102
- if (objType(json, 'object')) {
102
+ if (objFilter.objType(json, 'object')) {
103
103
  // Check Token
104
104
  if (
105
105
  typeof json.access_token === 'string' ||
@@ -5,7 +5,7 @@ var moment = require('moment-timezone');
5
5
  var _ = require('lodash');
6
6
  var clone = require('clone');
7
7
  var _default = require('../../../crypto/default.cjs');
8
- var objType = require('../../../get/objType.cjs');
8
+ var objFilter = require('../../../../v1/basics/objFilter.cjs');
9
9
  var config = require('../config.cjs');
10
10
  var logger = require('../../logger.cjs');
11
11
  var getUser = require('../api/getUser.cjs');
@@ -35,7 +35,7 @@ var revokeToken = require('../api/revokeToken.cjs');
35
35
  */
36
36
  function cookieSession(app, cfg) {
37
37
  // Config
38
- if (objType(cfg, 'object')) {
38
+ if (objFilter.objType(cfg, 'object')) {
39
39
  // Validator Session Discord and Firebase
40
40
  const sessionFirebaseDiscordValidator = function (req) {
41
41
  return (
@@ -178,7 +178,7 @@ function cookieSession(app, cfg) {
178
178
  discordSession.firebase.createAccountData = function (access_token, userData, oldData) {
179
179
  // Prepare New User Data
180
180
  const newUserData = {};
181
- const existOLD = objType(oldData, 'object');
181
+ const existOLD = objFilter.objType(oldData, 'object');
182
182
 
183
183
  // Password
184
184
  if (typeof access_token === 'string' && access_token.length > 0)
@@ -211,7 +211,7 @@ function cookieSession(app, cfg) {
211
211
  const validator = {};
212
212
 
213
213
  validator.user = hash(user);
214
- if (objType(oldUser, 'object')) validator.oldUser = hash(oldUser);
214
+ if (objFilter.objType(oldUser, 'object')) validator.oldUser = hash(oldUser);
215
215
  else validator.oldUser = '';
216
216
 
217
217
  // Validate
@@ -584,7 +584,7 @@ function cookieSession(app, cfg) {
584
584
  if (tinyAuth.discordScope.indexOf('email') < 0) tinyAuth.discordScope.push('email');
585
585
 
586
586
  // Firebase Mode
587
- if (objType(cfg.firebase, 'object')) {
587
+ if (objFilter.objType(cfg.firebase, 'object')) {
588
588
  // Fix First Get User Value
589
589
  tinyAuth.first_get_user = true;
590
590
 
@@ -896,7 +896,7 @@ function cookieSession(app, cfg) {
896
896
  else prepare_final_session(req, res);
897
897
  } else {
898
898
  // Exist Discord Session Data and Firebase
899
- if (cfg.firebase && req.discord_session.user && objType(req.firebase_session, 'object')) {
899
+ if (cfg.firebase && req.discord_session.user && objFilter.objType(req.firebase_session, 'object')) {
900
900
  // Set New Firebase Session Data
901
901
  req.session[sessionVars.access_token];
902
902
 
@@ -951,7 +951,7 @@ function cookieSession(app, cfg) {
951
951
  // Check Need Update
952
952
  let needUpdate = false;
953
953
  if (
954
- !objType(req.firebase_session.discord, 'object') ||
954
+ !objFilter.objType(req.firebase_session.discord, 'object') ||
955
955
  hash(req.firebase_session.discord) !== hash(req.discord_session.user)
956
956
  )
957
957
  needUpdate = true;
@@ -1067,7 +1067,7 @@ function cookieSession(app, cfg) {
1067
1067
  // Exist Discord
1068
1068
  if (req.discord_session.user) {
1069
1069
  // Exist Body
1070
- if (objType(req.body, 'object') && typeof req.body.token === 'string') {
1070
+ if (objFilter.objType(req.body, 'object') && typeof req.body.token === 'string') {
1071
1071
  // Exist Query
1072
1072
  if (
1073
1073
  typeof req.csrfToken.now.value !== 'string' ||
@@ -2,7 +2,7 @@
2
2
 
3
3
  var clone = require('clone');
4
4
  var index = require('../../_virtual/index.cjs');
5
- var objType = require('../get/objType.cjs');
5
+ var objFilter = require('../../v1/basics/objFilter.cjs');
6
6
  var isEmulator = require('./isEmulator.cjs');
7
7
 
8
8
  // @ts-nocheck
@@ -19,20 +19,20 @@ var isEmulator = require('./isEmulator.cjs');
19
19
  const loopInteraction = function (data) {
20
20
  const checkData = function (item) {
21
21
  // Checking
22
- if (objType(data[item], 'object') || Array.isArray(data[item])) {
22
+ if (objFilter.objType(data[item], 'object') || Array.isArray(data[item])) {
23
23
  loopInteraction(data[item]);
24
24
  }
25
25
 
26
26
  // BigInt
27
- else if (objType(data[item], 'bigint'))
27
+ else if (objFilter.objType(data[item], 'bigint'))
28
28
  data[item] = { _type_object: 'BIGINT', value: data[item].toString() };
29
29
  };
30
30
 
31
31
  // Data
32
- if (objType(data, 'object') || Array.isArray(data)) for (const item in data) checkData(item);
32
+ if (objFilter.objType(data, 'object') || Array.isArray(data)) for (const item in data) checkData(item);
33
33
  else {
34
34
  // Get BigInt
35
- if (objType(data, 'bigint')) data = { _type_object: 'BIGINT', value: data.toString() };
35
+ if (objFilter.objType(data, 'bigint')) data = { _type_object: 'BIGINT', value: data.toString() };
36
36
  }
37
37
 
38
38
  // Complete
@@ -56,7 +56,7 @@ const logBase = async function (type, args) {
56
56
  // Exist Log
57
57
  if (index) {
58
58
  let consoleData;
59
- if (objType(args, 'error'))
59
+ if (objFilter.objType(args, 'error'))
60
60
  consoleData = JSON.parse(JSON.stringify(args, Object.getOwnPropertyNames(args)));
61
61
  else consoleData = args;
62
62
 
@@ -64,7 +64,7 @@ const logBase = async function (type, args) {
64
64
  let argData = clone(consoleData[item]);
65
65
  loopInteraction(argData);
66
66
 
67
- if (objType(argData, 'object') || Array.isArray(argData))
67
+ if (objFilter.objType(argData, 'object') || Array.isArray(argData))
68
68
  argData = JSON.stringify(argData, null, 2);
69
69
 
70
70
  consoleData[item] = argData;
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  require('clone');
4
+ require('buffer');
4
5
 
5
6
  // @ts-nocheck
6
7
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var clone = require('clone');
4
- var objType = require('../../get/objType.cjs');
4
+ var objFilter = require('../../../v1/basics/objFilter.cjs');
5
5
 
6
6
  // @ts-nocheck
7
7
 
@@ -17,7 +17,7 @@ var objType = require('../../get/objType.cjs');
17
17
  */
18
18
  function sameUser(database, login) {
19
19
  // Validator
20
- if (typeof database === 'string' && objType(login, 'object') && objType(login.data, 'object')) {
20
+ if (typeof database === 'string' && objFilter.objType(login, 'object') && objFilter.objType(login.data, 'object')) {
21
21
  // Result
22
22
  const result = clone(login);
23
23
  result.data.database = database;
@@ -1,27 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var objType = require('./objType.cjs');
3
+ var objFilter = require('../../v1/basics/objFilter.cjs');
4
4
 
5
- // @ts-nocheck
6
5
 
7
6
 
8
- /**
9
- * Counts the number of elements or properties in an object or array.
10
- *
11
- * - If the input is an array, returns its length.
12
- * - If it's a plain object, returns the number of its own enumerable properties.
13
- * - Otherwise, returns 0.
14
- *
15
- * @param {*} obj - The input to count elements or properties from.
16
- * @returns {number} The count of elements (array) or properties (object), or 0 if not applicable.
17
- */
18
- function countObj(obj) {
19
- // Is Array
20
- if (Array.isArray(obj)) return obj.length;
21
- // Object
22
- else if (objType(obj, 'object')) return Object.keys(obj).length;
23
- // Nothing
24
- return 0;
25
- }
26
-
27
- module.exports = countObj;
7
+ module.exports = objFilter.countObj;
@@ -1,12 +1,3 @@
1
- /**
2
- * Counts the number of elements or properties in an object or array.
3
- *
4
- * - If the input is an array, returns its length.
5
- * - If it's a plain object, returns the number of its own enumerable properties.
6
- * - Otherwise, returns 0.
7
- *
8
- * @param {*} obj - The input to count elements or properties from.
9
- * @returns {number} The count of elements (array) or properties (object), or 0 if not applicable.
10
- */
11
- export default function countObj(obj: any): number;
1
+ export default countObj;
2
+ import { countObj } from '../../v1/basics/objFilter.mjs';
12
3
  //# sourceMappingURL=countObj.d.mts.map
@@ -1,22 +1,2 @@
1
- // @ts-nocheck
2
- import objType from './objType.mjs';
3
- /**
4
- * Counts the number of elements or properties in an object or array.
5
- *
6
- * - If the input is an array, returns its length.
7
- * - If it's a plain object, returns the number of its own enumerable properties.
8
- * - Otherwise, returns 0.
9
- *
10
- * @param {*} obj - The input to count elements or properties from.
11
- * @returns {number} The count of elements (array) or properties (object), or 0 if not applicable.
12
- */
13
- export default function countObj(obj) {
14
- // Is Array
15
- if (Array.isArray(obj))
16
- return obj.length;
17
- // Object
18
- else if (objType(obj, 'object'))
19
- return Object.keys(obj).length;
20
- // Nothing
21
- return 0;
22
- }
1
+ import { countObj } from '../../v1/basics/objFilter.mjs';
2
+ export default countObj;
@@ -2,9 +2,6 @@
2
2
 
3
3
  var tinycolor = require('tinycolor2');
4
4
 
5
- // @ts-nocheck
6
-
7
-
8
5
  /**
9
6
  * Combines RGB values into a single decimal color.
10
7
  *
@@ -30,34 +27,36 @@ function combineRGB(r, g, b) {
30
27
  * @returns {number} The decimal representation of the color, or 0 if invalid.
31
28
  */
32
29
  function decimalColor(color, errCallback) {
30
+ let newColor;
33
31
  // Is String
34
32
  if (typeof color === 'string') {
35
33
  // Prepare Color
36
34
  try {
37
35
  // Get Color Manager
38
- color = tinycolor(color);
36
+ newColor = tinycolor(color);
39
37
 
40
38
  // Validate
41
- if (color.isValid()) {
39
+ if (newColor.isValid()) {
42
40
  // Convert
43
- color = color.toRgb();
44
- color = combineRGB(color.r, color.g, color.b);
41
+ newColor = newColor.toRgb();
42
+ newColor = combineRGB(newColor.r, newColor.g, newColor.b);
45
43
  }
46
44
 
47
45
  // Nope
48
- else color = 0;
46
+ else newColor = 0;
49
47
  } catch (err) {
50
48
  // Error
51
49
  if (typeof errCallback === 'function') errCallback(err);
52
- color = 0;
50
+ newColor = 0;
53
51
  }
54
52
  }
55
53
 
56
54
  // Fix Color Number
57
- if (typeof color !== 'number' || isNaN(color) || !isFinite(color) || color < 0) color = 0;
55
+ if (typeof newColor !== 'number' || isNaN(newColor) || !isFinite(newColor) || newColor < 0)
56
+ newColor = 0;
58
57
 
59
58
  // Return the Color Value
60
- return color;
59
+ return newColor;
61
60
  }
62
61
 
63
62
  module.exports = decimalColor;
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import tinycolor from 'tinycolor2';
3
2
  /**
4
3
  * Combines RGB values into a single decimal color.
@@ -24,32 +23,33 @@ function combineRGB(r, g, b) {
24
23
  * @returns {number} The decimal representation of the color, or 0 if invalid.
25
24
  */
26
25
  export default function decimalColor(color, errCallback) {
26
+ let newColor;
27
27
  // Is String
28
28
  if (typeof color === 'string') {
29
29
  // Prepare Color
30
30
  try {
31
31
  // Get Color Manager
32
- color = tinycolor(color);
32
+ newColor = tinycolor(color);
33
33
  // Validate
34
- if (color.isValid()) {
34
+ if (newColor.isValid()) {
35
35
  // Convert
36
- color = color.toRgb();
37
- color = combineRGB(color.r, color.g, color.b);
36
+ newColor = newColor.toRgb();
37
+ newColor = combineRGB(newColor.r, newColor.g, newColor.b);
38
38
  }
39
39
  // Nope
40
40
  else
41
- color = 0;
41
+ newColor = 0;
42
42
  }
43
43
  catch (err) {
44
44
  // Error
45
45
  if (typeof errCallback === 'function')
46
46
  errCallback(err);
47
- color = 0;
47
+ newColor = 0;
48
48
  }
49
49
  }
50
50
  // Fix Color Number
51
- if (typeof color !== 'number' || isNaN(color) || !isFinite(color) || color < 0)
52
- color = 0;
51
+ if (typeof newColor !== 'number' || isNaN(newColor) || !isFinite(newColor) || newColor < 0)
52
+ newColor = 0;
53
53
  // Return the Color Value
54
- return color;
54
+ return newColor;
55
55
  }
@@ -1,45 +1,7 @@
1
1
  'use strict';
2
2
 
3
- // @ts-nocheck
3
+ var objFilter = require('../../v1/basics/objFilter.cjs');
4
4
 
5
- /**
6
- * Checks the internal type of an object using `Object.prototype.toString`.
7
- *
8
- * - If `type` is provided, returns `true` if it matches the object's internal type (case-insensitive).
9
- * - If `type` is omitted, returns the object's internal type as a lowercase string.
10
- *
11
- * Examples:
12
- * ```js
13
- * objType([], 'array'); // true
14
- * objType({}, 'object'); // true
15
- * objType('hello'); // "string"
16
- * objType(undefined); // null
17
- * ```
18
- *
19
- * @param {*} obj - The value to check the type of.
20
- * @param {string} [type] - Optional string to compare the object's type against.
21
- * @returns {boolean|string|null} Returns true/false if checking, or type string/null if querying.
22
- */
23
- function objType(obj, type) {
24
- // Is Defined
25
- if (typeof obj !== 'undefined') {
26
- // Check Obj Type
27
- if (typeof type === 'string') {
28
- if (Object.prototype.toString.call(obj).toLowerCase() === `[object ${type}]`) return true;
29
- else return false;
30
- }
31
5
 
32
- // Get Obj Type
33
- else {
34
- // Result
35
- const result = Object.prototype.toString.call(obj).toLowerCase();
36
- // Send Result
37
- return result.substring(8, result.length - 1);
38
- }
39
- }
40
6
 
41
- // Nope
42
- else return null;
43
- }
44
-
45
- module.exports = objType;
7
+ module.exports = objFilter.objType;
@@ -1,20 +1,3 @@
1
- /**
2
- * Checks the internal type of an object using `Object.prototype.toString`.
3
- *
4
- * - If `type` is provided, returns `true` if it matches the object's internal type (case-insensitive).
5
- * - If `type` is omitted, returns the object's internal type as a lowercase string.
6
- *
7
- * Examples:
8
- * ```js
9
- * objType([], 'array'); // true
10
- * objType({}, 'object'); // true
11
- * objType('hello'); // "string"
12
- * objType(undefined); // null
13
- * ```
14
- *
15
- * @param {*} obj - The value to check the type of.
16
- * @param {string} [type] - Optional string to compare the object's type against.
17
- * @returns {boolean|string|null} Returns true/false if checking, or type string/null if querying.
18
- */
19
- export default function objType(obj: any, type?: string): boolean | string | null;
1
+ export default objType;
2
+ import { objType } from '../../v1/basics/objFilter.mjs';
20
3
  //# sourceMappingURL=objType.d.mts.map