melperjs 14.0.0 → 14.1.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/lib/cjs/index.js CHANGED
@@ -8,6 +8,7 @@ exports.Exception = Exception;
8
8
  exports.checkEmpty = checkEmpty;
9
9
  exports.cookieDict = cookieDict;
10
10
  exports.cookieHeader = cookieHeader;
11
+ exports.cookieStringToObject = cookieStringToObject;
11
12
  exports.findKeyNode = findKeyNode;
12
13
  exports.flipObject = flipObject;
13
14
  exports.forever = forever;
@@ -356,6 +357,17 @@ function cookieDict(res, decodeValues = false) {
356
357
  function cookieHeader(cookieDict) {
357
358
  return Object.entries(cookieDict).map(([key, value]) => `${key}=${value}`).join(';');
358
359
  }
360
+ function cookieStringToObject(cookieString) {
361
+ const cookies = {};
362
+ if (!cookieString) return cookies;
363
+ cookieString.split(';').forEach(cookie => {
364
+ const [key, ...valueParts] = cookie.trim().split('=');
365
+ if (key) {
366
+ cookies[key.trim()] = valueParts.join('=').trim();
367
+ }
368
+ });
369
+ return cookies;
370
+ }
359
371
  function isIntlHttpCode(httpCode) {
360
372
  return httpCode === undefined || httpCode === null || isNaN(httpCode) || httpCode === 0 || httpCode === 100 || httpCode === 402 || httpCode === 407 || httpCode === 417 || 460 <= httpCode && httpCode < 470 || 500 <= httpCode;
361
373
  }
package/lib/cjs/node.js CHANGED
@@ -137,8 +137,8 @@ function md5(data) {
137
137
  function sha256(data) {
138
138
  return hash("sha256", data);
139
139
  }
140
- function hashBcrypt(plainText, encryptionKey = "") {
141
- return _bcryptjs.default.hashSync(plainText + encryptionKey, _bcryptjs.default.genSaltSync(10));
140
+ function hashBcrypt(plainText, encryptionKey = "", rounds = 12) {
141
+ return _bcryptjs.default.hashSync(plainText + encryptionKey, _bcryptjs.default.genSaltSync(rounds));
142
142
  }
143
143
  function verifyBcrypt(plainText, hash, encryptionKey = "") {
144
144
  return _bcryptjs.default.compareSync(plainText + encryptionKey, hash);
package/lib/esm/index.js CHANGED
@@ -312,6 +312,17 @@ export function cookieDict(res, decodeValues = false) {
312
312
  export function cookieHeader(cookieDict) {
313
313
  return Object.entries(cookieDict).map(([key, value]) => `${key}=${value}`).join(';');
314
314
  }
315
+ export function cookieStringToObject(cookieString) {
316
+ const cookies = {};
317
+ if (!cookieString) return cookies;
318
+ cookieString.split(';').forEach(cookie => {
319
+ const [key, ...valueParts] = cookie.trim().split('=');
320
+ if (key) {
321
+ cookies[key.trim()] = valueParts.join('=').trim();
322
+ }
323
+ });
324
+ return cookies;
325
+ }
315
326
  export function isIntlHttpCode(httpCode) {
316
327
  return httpCode === undefined || httpCode === null || isNaN(httpCode) || httpCode === 0 || httpCode === 100 || httpCode === 402 || httpCode === 407 || httpCode === 417 || 460 <= httpCode && httpCode < 470 || 500 <= httpCode;
317
328
  }
package/lib/esm/node.js CHANGED
@@ -108,8 +108,8 @@ export function md5(data) {
108
108
  export function sha256(data) {
109
109
  return hash("sha256", data);
110
110
  }
111
- export function hashBcrypt(plainText, encryptionKey = "") {
112
- return bcrypt.hashSync(plainText + encryptionKey, bcrypt.genSaltSync(10));
111
+ export function hashBcrypt(plainText, encryptionKey = "", rounds = 12) {
112
+ return bcrypt.hashSync(plainText + encryptionKey, bcrypt.genSaltSync(rounds));
113
113
  }
114
114
  export function verifyBcrypt(plainText, hash, encryptionKey = "") {
115
115
  return bcrypt.compareSync(plainText + encryptionKey, hash);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "melperjs",
3
- "version": "14.0.0",
3
+ "version": "14.1.0",
4
4
  "description": "Javascript module to use predefined common functions and utilities",
5
5
  "keywords": [
6
6
  "melperjs",
@@ -41,15 +41,15 @@
41
41
  "dependencies": {
42
42
  "bcryptjs": "^3.0.2",
43
43
  "hpagent": "^1.2.0",
44
- "lodash": "^4.17.21",
45
- "set-cookie-parser": "^2.7.1",
44
+ "lodash": "4.17.23",
45
+ "set-cookie-parser": "^3.0.1",
46
46
  "xss": "^1.0.15"
47
47
  },
48
48
  "devDependencies": {
49
- "@babel/cli": "^7.27.2",
50
- "@babel/core": "^7.27.1",
51
- "@babel/preset-env": "^7.27.2",
52
- "axios": "^1.9.0",
53
- "cross-env": "^7.0.3"
49
+ "@babel/cli": "^7.28.6",
50
+ "@babel/core": "^7.29.0",
51
+ "@babel/preset-env": "^7.29.0",
52
+ "axios": "1.13.5",
53
+ "cross-env": "^10.1.0"
54
54
  }
55
55
  }