react-native-xxhash 0.1.2 → 0.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.
Files changed (2) hide show
  1. package/README.md +74 -12
  2. package/package.json +4 -3
package/README.md CHANGED
@@ -1,9 +1,18 @@
1
1
  # react-native-xxhash
2
2
 
3
- react-native-xxhash
3
+ A React Native library for hashing strings using the fast and deterministic xxHash algorithm. This library provides support for both 64-bit and 128-bit hashing.
4
+
5
+ ## Features
6
+
7
+ - **High Performance**: xxHash is one of the fastest non-cryptographic hash functions.
8
+ - **Deterministic Hashing**: Ensures consistent results for the same input.
9
+ - **128-bit and 64-bit Support**: Choose between 128-bit and 64-bit hash outputs based on your use case.
10
+ - **Cross-Platform**: Supports both iOS and Android in React Native projects.
4
11
 
5
12
  ## Installation
6
13
 
14
+ To install the library, use either `npm` or `yarn`:
15
+
7
16
  ```sh
8
17
  npm install react-native-xxhash
9
18
  ```
@@ -12,30 +21,83 @@ npm install react-native-xxhash
12
21
  yarn add react-native-xxhash
13
22
  ```
14
23
 
24
+ ## iOS
25
+ ```sh
26
+ pod install
27
+ ```
28
+
29
+ ---
30
+
15
31
  ## Usage
16
32
 
33
+ Here’s how to use the `react-native-xxhash` library in your React Native project:
17
34
 
18
- ```js
35
+ ### Import the Functions
36
+ ```javascript
19
37
  import { hash128, hash64 } from 'react-native-xxhash';
38
+ ```
20
39
 
21
- // ...
40
+ ### Hash a String (128-bit)
41
+ This function generates a fast and deterministic 128-bit hash for a given string input.
42
+
43
+ ```javascript
44
+ const resultHash128 = hash128("hello world");
45
+ console.log('128-bit hash:', resultHash128);
46
+ // Output: A 128-bit hash string
47
+ ```
22
48
 
23
- //This function provides a fast and deterministic 128-bit hash for a given string input.
24
- const result_hash_128_bits = hash128("hello world");
49
+ ### Hash a String (64-bit)
50
+ This function generates a fast and deterministic 64-bit hash for a given string input.
25
51
 
26
- //This function provides a fast and deterministic 64-bit hash for a given string input.
27
- const result_hash_64_bits = hash64("hello world");
52
+ ```javascript
53
+ const resultHash64 = hash64("hello world");
54
+ console.log('64-bit hash:', resultHash64);
55
+ // Output: A 64-bit hash string
28
56
  ```
29
57
 
58
+ ### Example Usage in a Component
59
+ ```javascript
60
+ import React, { useEffect } from 'react';
61
+ import { Text, View } from 'react-native';
62
+ import { hash128, hash64 } from 'react-native-xxhash';
30
63
 
31
- ## Contributing
64
+ const App = () => {
65
+ useEffect(() => {
66
+ const hash128Result = hash128("react-native");
67
+ const hash64Result = hash64("react-native");
32
68
 
33
- See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
69
+ console.log("128-bit hash:", hash128Result);
70
+ console.log("64-bit hash:", hash64Result);
71
+ }, []);
34
72
 
35
- ## License
73
+ return (
74
+ <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
75
+ <Text>Check your console for hash results!</Text>
76
+ </View>
77
+ );
78
+ };
79
+
80
+ export default App;
81
+ ```
82
+
83
+ ---
84
+
85
+ ## API Reference
86
+
87
+ ### `hash128(input: string): string`
88
+ - **Description**: Generates a 128-bit hash for the given string input.
89
+ - **Parameters**:
90
+ - `input` (string): The string to hash.
91
+ - **Returns**: A 128-bit hash as a string.
36
92
 
37
- MIT
93
+ ### `hash64(input: string): string`
94
+ - **Description**: Generates a 64-bit hash for the given string input.
95
+ - **Parameters**:
96
+ - `input` (string): The string to hash.
97
+ - **Returns**: A 64-bit hash as a string.
38
98
 
39
99
  ---
40
100
 
41
- Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
101
+ ## License
102
+
103
+ `react-native-xxhash` is released under the MIT License. See the [LICENSE](LICENSE) file for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-xxhash",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Fast xxHash implementation for React Native",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -66,6 +66,8 @@
66
66
  "@semantic-release/release-notes-generator": "^14.0.3",
67
67
  "@types/jest": "^29.5.5",
68
68
  "@types/react": "^18.2.44",
69
+ "@types/react-native": "^0.65.5",
70
+ "@typescript-eslint/eslint-plugin": "^4.33.0",
69
71
  "commitlint": "^17.0.2",
70
72
  "del-cli": "^5.1.0",
71
73
  "eslint": "^8.51.0",
@@ -77,8 +79,7 @@
77
79
  "react-native": "0.76.6",
78
80
  "react-native-builder-bob": "^0.35.2",
79
81
  "release-it": "^17.10.0",
80
- "turbo": "^1.10.7",
81
- "typescript": "^5.2.2"
82
+ "typescript": "5.0.4"
82
83
  },
83
84
  "resolutions": {
84
85
  "@types/react": "^18.2.44"