@alwatr/djb2-hash 1.1.2 โ 1.1.4
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/CHANGELOG.md +16 -0
- package/dist/main.cjs +2 -1
- package/dist/main.cjs.map +1 -1
- package/dist/main.mjs +2 -1
- package/dist/main.mjs.map +1 -1
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.1.4](https://github.com/Alwatr/nanolib/compare/@alwatr/djb2-hash@1.1.3...@alwatr/djb2-hash@1.1.4) (2025-09-21)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @alwatr/djb2-hash
|
|
9
|
+
|
|
10
|
+
## [1.1.3](https://github.com/Alwatr/nanolib/compare/@alwatr/djb2-hash@1.1.2...@alwatr/djb2-hash@1.1.3) (2025-09-20)
|
|
11
|
+
|
|
12
|
+
### ๐ Bug Fixes
|
|
13
|
+
|
|
14
|
+
* add sideEffects property to package.json files for better tree-shaking ([c7b9e74](https://github.com/Alwatr/nanolib/commit/c7b9e74e1920c8e35b438742de61883ca62da58c))
|
|
15
|
+
* add sideEffects property to package.json files for better tree-shaking ([e8402c4](https://github.com/Alwatr/nanolib/commit/e8402c481a14a1f807a37aaa862a936713d26176))
|
|
16
|
+
|
|
17
|
+
### ๐งน Miscellaneous Chores
|
|
18
|
+
|
|
19
|
+
* remove duplicate sideEffects property from multiple package.json files ([b123f86](https://github.com/Alwatr/nanolib/commit/b123f86be81481de2314aae9bb2eeb629743d24c))
|
|
20
|
+
* reorder keywords in package.json for consistency ([095b9c9](https://github.com/Alwatr/nanolib/commit/095b9c9c2d79d3a8bf3ebff7315a3becb8580ea1))
|
|
21
|
+
|
|
6
22
|
## [1.1.2](https://github.com/Alwatr/nanolib/compare/@alwatr/djb2-hash@1.1.1...@alwatr/djb2-hash@1.1.2) (2025-09-19)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @alwatr/djb2-hash
|
package/dist/main.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/** ๐ฆ @alwatr/djb2-hash v1.1.4 */
|
|
2
|
+
__dev_mode__: console.debug("๐ฆ @alwatr/djb2-hash v1.1.4");
|
|
2
3
|
"use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var main_exports={};__export(main_exports,{djb2Hash:()=>djb2Hash});module.exports=__toCommonJS(main_exports);function djb2Hash(str){let hashValue=5381;for(let i=str.length-1;i>=0;i--){hashValue=(hashValue<<5)+hashValue^str.charCodeAt(i)}return hashValue>>>0}0&&(module.exports={djb2Hash});
|
|
3
4
|
//# sourceMappingURL=main.cjs.map
|
package/dist/main.cjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * DJB2 hash algorithm but faster!\n *\n * This implementation is based on Daniel J. Bernstein's popular 'times 33' hash algorithm,\n * commonly known as DJB2. It's known for its simplicity, speed, and good distribution properties\n * for short strings, making it suitable for general purpose hashing needs.\n *\n * Performance improvements in this version:\n * - Uses right-to-left iteration to avoid repeated length lookups\n * - Employs bit shifting operations for faster computation\n * - Final right shift ensures unsigned 32-bit integer output\n *\n * @param {string} str - The input string to be hashed\n * @returns {number} A 32-bit unsigned integer hash value\n *\n * @example\n * // Returns a numeric hash value\n * const hashValue = djb2Hash(\"hello world\");\n */\nexport function djb2Hash(str: string): number {\n // 5381 is a prime number used as initial value in the DJB2 algorithm\n let hashValue = 5381;\n\n // Reverse loop for better performance - avoids repeated length property lookup\n for (let i = str.length - 1; i >= 0; i--) {\n // Using left shift (*2) and addition instead of multiplication by 33\n // (hash * 33) is equivalent to ((hash << 5) + hash)\n hashValue = ((hashValue << 5) + hashValue) ^ str.charCodeAt(i);\n }\n\n return hashValue >>> 0;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;qqBAAA,6GAmBO,SAAS,SAAS,IAAqB,CAE5C,IAAI,UAAY,KAGhB,QAAS,EAAI,IAAI,OAAS,EAAG,GAAK,EAAG,IAAK,CAGxC,WAAc,WAAa,GAAK,UAAa,IAAI,WAAW,CAAC,CAC/D,CAEA,OAAO,YAAc,CACvB",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/main.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/** ๐ฆ @alwatr/djb2-hash v1.1.4 */
|
|
2
|
+
__dev_mode__: console.debug("๐ฆ @alwatr/djb2-hash v1.1.4");
|
|
2
3
|
function djb2Hash(str){let hashValue=5381;for(let i=str.length-1;i>=0;i--){hashValue=(hashValue<<5)+hashValue^str.charCodeAt(i)}return hashValue>>>0}export{djb2Hash};
|
|
3
4
|
//# sourceMappingURL=main.mjs.map
|
package/dist/main.mjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * DJB2 hash algorithm but faster!\n *\n * This implementation is based on Daniel J. Bernstein's popular 'times 33' hash algorithm,\n * commonly known as DJB2. It's known for its simplicity, speed, and good distribution properties\n * for short strings, making it suitable for general purpose hashing needs.\n *\n * Performance improvements in this version:\n * - Uses right-to-left iteration to avoid repeated length lookups\n * - Employs bit shifting operations for faster computation\n * - Final right shift ensures unsigned 32-bit integer output\n *\n * @param {string} str - The input string to be hashed\n * @returns {number} A 32-bit unsigned integer hash value\n *\n * @example\n * // Returns a numeric hash value\n * const hashValue = djb2Hash(\"hello world\");\n */\nexport function djb2Hash(str: string): number {\n // 5381 is a prime number used as initial value in the DJB2 algorithm\n let hashValue = 5381;\n\n // Reverse loop for better performance - avoids repeated length property lookup\n for (let i = str.length - 1; i >= 0; i--) {\n // Using left shift (*2) and addition instead of multiplication by 33\n // (hash * 33) is equivalent to ((hash << 5) + hash)\n hashValue = ((hashValue << 5) + hashValue) ^ str.charCodeAt(i);\n }\n\n return hashValue >>> 0;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;AAmBO,SAAS,SAAS,IAAqB,CAE5C,IAAI,UAAY,KAGhB,QAAS,EAAI,IAAI,OAAS,EAAG,GAAK,EAAG,IAAK,CAGxC,WAAc,WAAa,GAAK,UAAa,IAAI,WAAW,CAAC,CAC/D,CAEA,OAAO,YAAc,CACvB",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwatr/djb2-hash",
|
|
3
3
|
"description": "A fast, non-cryptographic hash function based on DJB2.",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.4",
|
|
5
5
|
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
|
|
6
6
|
"bugs": "https://github.com/Alwatr/nanolib/issues",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@alwatr/nano-build": "6.
|
|
9
|
-
"@alwatr/prettier-config": "5.0.
|
|
10
|
-
"@alwatr/tsconfig-base": "6.0.
|
|
8
|
+
"@alwatr/nano-build": "6.3.1",
|
|
9
|
+
"@alwatr/prettier-config": "5.0.4",
|
|
10
|
+
"@alwatr/tsconfig-base": "6.0.2",
|
|
11
11
|
"jest": "^30.1.3",
|
|
12
12
|
"typescript": "^5.9.2"
|
|
13
13
|
},
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"keywords": [
|
|
28
28
|
"alwatr",
|
|
29
29
|
"browser",
|
|
30
|
-
"esm",
|
|
31
|
-
"hash",
|
|
32
30
|
"djb2",
|
|
33
31
|
"djb2-hash",
|
|
32
|
+
"esm",
|
|
33
|
+
"hash",
|
|
34
34
|
"hash-string",
|
|
35
35
|
"javascript",
|
|
36
36
|
"module",
|
|
@@ -71,7 +71,8 @@
|
|
|
71
71
|
"watch:es": "yarn run build:es --watch",
|
|
72
72
|
"watch:ts": "yarn run build:ts --watch --preserveWatchOutput"
|
|
73
73
|
},
|
|
74
|
+
"sideEffects": false,
|
|
74
75
|
"type": "module",
|
|
75
76
|
"types": "./dist/main.d.ts",
|
|
76
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "912cbccc4aae450a2cd2bbb401b898e00af05386"
|
|
77
78
|
}
|