@alwatr/djb2-hash 1.1.5 โ†’ 1.1.7

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 CHANGED
@@ -3,6 +3,16 @@
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.7](https://github.com/Alwatr/nanolib/compare/@alwatr/djb2-hash@1.1.6...@alwatr/djb2-hash@1.1.7) (2025-09-27)
7
+
8
+ ### ๐Ÿงน Miscellaneous Chores
9
+
10
+ * exclude test files from package distribution ([86f4f2f](https://github.com/Alwatr/nanolib/commit/86f4f2f5985845c5cf3a3a9398de7b2f98ce53e7))
11
+
12
+ ## [1.1.6](https://github.com/Alwatr/nanolib/compare/@alwatr/djb2-hash@1.1.5...@alwatr/djb2-hash@1.1.6) (2025-09-22)
13
+
14
+ **Note:** Version bump only for package @alwatr/djb2-hash
15
+
6
16
  ## [1.1.5](https://github.com/Alwatr/nanolib/compare/@alwatr/djb2-hash@1.1.4...@alwatr/djb2-hash@1.1.5) (2025-09-22)
7
17
 
8
18
  **Note:** Version bump only for package @alwatr/djb2-hash
package/dist/main.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /** ๐Ÿ“ฆ @alwatr/djb2-hash v1.1.5 */
2
- __dev_mode__: console.debug("๐Ÿ“ฆ @alwatr/djb2-hash v1.1.5");
1
+ /** ๐Ÿ“ฆ @alwatr/djb2-hash v1.1.7 */
2
+ __dev_mode__: console.debug("๐Ÿ“ฆ @alwatr/djb2-hash v1.1.7");
3
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});
4
4
  //# sourceMappingURL=main.cjs.map
package/dist/main.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /** ๐Ÿ“ฆ @alwatr/djb2-hash v1.1.5 */
2
- __dev_mode__: console.debug("๐Ÿ“ฆ @alwatr/djb2-hash v1.1.5");
1
+ /** ๐Ÿ“ฆ @alwatr/djb2-hash v1.1.7 */
2
+ __dev_mode__: console.debug("๐Ÿ“ฆ @alwatr/djb2-hash v1.1.7");
3
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};
4
4
  //# sourceMappingURL=main.mjs.map
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.5",
4
+ "version": "1.1.7",
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.3.2",
9
- "@alwatr/prettier-config": "5.0.4",
10
- "@alwatr/tsconfig-base": "6.0.2",
8
+ "@alwatr/nano-build": "6.3.4",
9
+ "@alwatr/prettier-config": "5.0.5",
10
+ "@alwatr/tsconfig-base": "6.0.3",
11
11
  "jest": "^30.1.3",
12
12
  "typescript": "^5.9.2"
13
13
  },
@@ -21,7 +21,8 @@
21
21
  "files": [
22
22
  "**/*.{js,mjs,cjs,map,d.ts,html,md,LEGAL.txt}",
23
23
  "LICENSE",
24
- "!demo/**/*"
24
+ "!demo/**/*",
25
+ "!**/*.test.js"
25
26
  ],
26
27
  "homepage": "https://github.com/Alwatr/nanolib/tree/next/packages/djb2-hash#readme",
27
28
  "keywords": [
@@ -74,5 +75,5 @@
74
75
  "sideEffects": false,
75
76
  "type": "module",
76
77
  "types": "./dist/main.d.ts",
77
- "gitHead": "8e3b59b7a2d9b9ab28f1ee9da21849e60f7eeb07"
78
+ "gitHead": "c013ded43aff3937cf347de4e99125ab807d99e1"
78
79
  }
package/src/main.test.js DELETED
@@ -1,72 +0,0 @@
1
- import {djb2Hash} from '@alwatr/djb2-hash';
2
-
3
- describe('djb2Hash', () => {
4
- it('should generate numeric hash values for string inputs', () => {
5
- const result = djb2Hash('test');
6
- expect(typeof result).toBe('number');
7
- expect(Number.isInteger(result)).toBe(true);
8
- });
9
-
10
- it('should return different hashes for different inputs', () => {
11
- const hash1 = djb2Hash('test1');
12
- const hash2 = djb2Hash('test2');
13
- expect(hash1).not.toBe(hash2);
14
- });
15
-
16
- it('should generate consistent hashes for the same input', () => {
17
- const input = 'consistencyTest';
18
- const hash1 = djb2Hash(input);
19
- const hash2 = djb2Hash(input);
20
- expect(hash1).toBe(hash2);
21
- });
22
-
23
- it('should handle empty strings', () => {
24
- const result = djb2Hash('');
25
- expect(typeof result).toBe('number');
26
- // The hash for an empty string should be the initial value right-shifted by 0
27
- expect(result).toBe(5381 >>> 0);
28
- });
29
-
30
- it('should handle special characters', () => {
31
- const result = djb2Hash('!@#$%^&*()');
32
- expect(typeof result).toBe('number');
33
- expect(Number.isInteger(result)).toBe(true);
34
- });
35
-
36
- it('should handle long strings', () => {
37
- const longString = 'a'.repeat(1000);
38
- const result = djb2Hash(longString);
39
- expect(typeof result).toBe('number');
40
- expect(Number.isInteger(result)).toBe(true);
41
- });
42
-
43
- it('should handle Unicode characters', () => {
44
- const unicodeString = '๐Ÿ˜€๐ŸŒ๐Ÿš€';
45
- const result = djb2Hash(unicodeString);
46
- expect(typeof result).toBe('number');
47
- expect(Number.isInteger(result)).toBe(true);
48
- });
49
-
50
- it('should produce 32-bit unsigned integer outputs', () => {
51
- const inputs = ['test', 'hello world', 'unicode ๐Ÿ˜€', 'a'.repeat(1000)];
52
-
53
- for (const input of inputs) {
54
- const result = djb2Hash(input);
55
- expect(result).toBeLessThanOrEqual(0xffffffff); // Max 32-bit unsigned int
56
- expect(result).toBeGreaterThanOrEqual(0);
57
- }
58
- });
59
-
60
- it('should produce deterministic results', () => {
61
- // Test with known hash values
62
- expect(djb2Hash('hello')).toBe(181380007);
63
- expect(djb2Hash('world')).toBe(164394279);
64
- expect(djb2Hash('hello world')).toBe(2616892229);
65
- expect(djb2Hash('')).toBe(5381);
66
- });
67
-
68
- it('should handle case sensitivity', () => {
69
- expect(djb2Hash('Hello')).not.toBe(djb2Hash('hello'));
70
- expect(djb2Hash('WORLD')).not.toBe(djb2Hash('world'));
71
- });
72
- });