@vexify-org/yaggs 6.17.0 → 6.18.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/index.js +16 -0
- package/lib/parser.js +17 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -217,6 +217,22 @@ class Yaggs {
|
|
|
217
217
|
return this.parser.truncate(str, maxLength, suffix);
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
hash(str, algorithm = 'sha256') {
|
|
221
|
+
return this.parser.hash(str, algorithm);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
md5(str) {
|
|
225
|
+
return this.parser.md5(str);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
sha256(str) {
|
|
229
|
+
return this.parser.sha256(str);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
sha512(str) {
|
|
233
|
+
return this.parser.sha512(str);
|
|
234
|
+
}
|
|
235
|
+
|
|
220
236
|
check(fn) {
|
|
221
237
|
this.middleware(fn);
|
|
222
238
|
return this;
|
package/lib/parser.js
CHANGED
|
@@ -1202,6 +1202,23 @@ complete -c ${this.scriptName} `;
|
|
|
1202
1202
|
return str.length > maxLength ? str.slice(0, maxLength) + suffix : str;
|
|
1203
1203
|
}
|
|
1204
1204
|
|
|
1205
|
+
hash(str, algorithm = 'sha256') {
|
|
1206
|
+
const crypto = require('crypto');
|
|
1207
|
+
return crypto.createHash(algorithm).update(str).digest('hex');
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
md5(str) {
|
|
1211
|
+
return this.hash(str, 'md5');
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
sha256(str) {
|
|
1215
|
+
return this.hash(str, 'sha256');
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
sha512(str) {
|
|
1219
|
+
return this.hash(str, 'sha512');
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1205
1222
|
getHelp() {
|
|
1206
1223
|
let help = `\u001b[36m${this.scriptName}\u001b[0m`;
|
|
1207
1224
|
|