qsu 1.0.0 → 1.0.3

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/dist/index.js CHANGED
@@ -158,8 +158,8 @@ export default class Qsu {
158
158
  const totalStrLength = currentStr.length;
159
159
  while ((hideCount < blindLength) && (currentStrLength < totalStrLength)) {
160
160
  tempIdx = this.numRandom(0, totalStrLength);
161
- if (/[a-zA-Z가-힣]/.test(currentStr.substr(tempIdx, 1))) {
162
- currentStr = `${currentStr.substr(0, tempIdx)}${blindStr}${currentStr.substr(tempIdx + 1)}`;
161
+ if (/[a-zA-Z가-힣]/.test(currentStr.substring(tempIdx, tempIdx + 1))) {
162
+ currentStr = `${currentStr.substring(0, tempIdx + 1)}${blindStr}${currentStr.substring(tempIdx + 2)}`;
163
163
  hideCount += 1;
164
164
  }
165
165
  currentStrLength += 1;
@@ -174,6 +174,9 @@ export default class Qsu {
174
174
  return convStr;
175
175
  }
176
176
  static encrypt(str, secret, algorithm = 'aes-256-cbc', ivSize = 16) {
177
+ if (!str || str.length < 1) {
178
+ return '';
179
+ }
177
180
  const iv = crypto.randomBytes(ivSize);
178
181
  const cipher = crypto.createCipheriv(algorithm, secret, iv);
179
182
  let enc = cipher.update(str);
@@ -181,6 +184,9 @@ export default class Qsu {
181
184
  return `${iv.toString('hex')}:${enc.toString('hex')}`;
182
185
  }
183
186
  static decrypt(str, secret, algorithm = 'aes-256-cbc') {
187
+ if (!str || str.length < 1) {
188
+ return '';
189
+ }
184
190
  const arrStr = str.split(':');
185
191
  const decipher = crypto.createDecipheriv(algorithm, secret, Buffer.from(arrStr.shift(), 'hex'));
186
192
  let decrypted = decipher.update(Buffer.from(arrStr.join(':'), 'hex'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qsu",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "description": "Quick and Simple Utility for javascript",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",
@@ -36,17 +36,21 @@
36
36
  "tool",
37
37
  "underscore",
38
38
  "website",
39
- "helper"
39
+ "helper",
40
+ "array",
41
+ "string",
42
+ "date",
43
+ "math"
40
44
  ],
41
45
  "devDependencies": {
42
- "@types/node": "^17.0.31",
43
- "@typescript-eslint/eslint-plugin": "^5.22.0",
44
- "@typescript-eslint/parser": "^5.22.0",
45
- "eslint": "^8.15.0",
46
+ "@types/node": "^17.0.35",
47
+ "@typescript-eslint/eslint-plugin": "^5.25.0",
48
+ "@typescript-eslint/parser": "^5.25.0",
49
+ "eslint": "^8.16.0",
46
50
  "eslint-config-airbnb": "^19.0.4",
47
51
  "eslint-plugin-import": "^2.26.0",
48
52
  "mocha": "^10.0.0",
49
- "ts-node": "^10.7.0",
53
+ "ts-node": "^10.8.0",
50
54
  "typescript": "^4.6.4"
51
55
  },
52
56
  "dependencies": {
@@ -1,15 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="GitToolBoxProjectSettings">
4
- <option name="commitMessageIssueKeyValidationOverride">
5
- <BoolValueOverride>
6
- <option name="enabled" value="true" />
7
- </BoolValueOverride>
8
- </option>
9
- <option name="commitMessageValidationEnabledOverride">
10
- <BoolValueOverride>
11
- <option name="enabled" value="true" />
12
- </BoolValueOverride>
13
- </option>
14
- </component>
15
- </project>
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
- </profile>
6
- </component>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="EslintConfiguration">
4
- <option name="fix-on-save" value="true" />
5
- </component>
6
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/qsu.iml" filepath="$PROJECT_DIR$/.idea/qsu.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/.idea/qsu.iml DELETED
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/temp" />
6
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>