Skip to content

Commit ae0fad0

Browse files
authored
Merge pull request #1 from BackendStack21/fixing-examples-in-docs
fix: update examples in README and BigIntCoercion class for accurate values
2 parents dfb9ed4 + 701eb0d commit ae0fad0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ import { stringToBigInt } from "k-number-utils"
296296
// Basic ASCII string - returns BigIntCoercion instance
297297
const hello = stringToBigInt("hello")
298298
hello.toBigInt() // 448378203247n
299-
hello.toInt32() // 1818522991
299+
hello.toInt32() // 1701604463
300300
hello.toUint8() // 111 (lower 8 bits)
301301

302302
// Single character
@@ -312,8 +312,8 @@ stringToBigInt("🚀").toBigInt() // 4036991616n
312312
stringToBigInt("🚀").toInt32() // -257975680
313313

314314
// Chinese characters
315-
stringToBigInt("你好").toBigInt() // 15060223084n
316-
stringToBigInt("你好").toChar() // '' (lower 16 bits)
315+
stringToBigInt("你好").toBigInt() // 251503099356605n
316+
stringToBigInt("你好").toChar() // '' (lower 16 bits)
317317

318318
// Mixed content
319319
const mixed = stringToBigInt("Hello 🌍")

src/bigint-coercion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* const bn = new BigIntCoercion(123456789n);
1111
* bn.toInt32(); // 123456789
1212
* bn.toUint8(); // 21 (truncated to 8 bits)
13-
* bn.toChar(); // 'Í' (Unicode character from lower 16 bits)
13+
* bn.toChar(); // '' (Unicode character from lower 16 bits)
1414
*
1515
* @example
1616
* // Collision example - large values wrap around
@@ -242,7 +242,7 @@ export class BigIntCoercion {
242242
* @example
243243
* new BigIntCoercion(65n).toChar(); // 'A'
244244
* new BigIntCoercion(8364n).toChar(); // '€' (Euro sign)
245-
* new BigIntCoercion(128512n).toChar(); // '😀' (would wrap to 16 bits)
245+
* new BigIntCoercion(128512n).toChar(); // '' (wraps to 16 bits: 62976)
246246
*/
247247
toChar(): string {
248248
const codePoint = this.toUint16()

0 commit comments

Comments
 (0)