extra-bit 2.4.0 → 2.4.1

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 (4) hide show
  1. package/README.md +17 -17
  2. package/package.json +1 -1
  3. package/TODO +0 -33
  4. package/build.ts +0 -43
package/README.md CHANGED
@@ -2,7 +2,7 @@ The [bit] is a basic unit of information in information theory, computing.<br>
2
2
 
3
3
  ▌
4
4
  📦 [JSR](https://jsr.io/@nodef/extra-bit),
5
- 📦 [NPM](https://www.npmjs.com/package/extra-bit),
5
+ 📦 [NPM](https://www.npmjs.com/package/@nodef/extra-bit),
6
6
  📰 [Docs](https://jsr.io/@nodef/extra-bit/doc).
7
7
 
8
8
  The concept of a **bit**, which stands for *binary digit*, has been a
@@ -82,19 +82,19 @@ xbit.signExtend(15, 4);
82
82
  ![](https://ga-beacon.deno.dev/G-RC63DPBH3P:SH3Eq-NoQ9mwgYeHWxu7cw/github.com/nodef/extra-bit)
83
83
 
84
84
 
85
- [get]: https://jsr.io/@nodef/extra-version/doc/~/get
86
- [getAs]: https://jsr.io/@nodef/extra-version/doc/~/getAs
87
- [set]: https://jsr.io/@nodef/extra-version/doc/~/set
88
- [setAs]: https://jsr.io/@nodef/extra-version/doc/~/setAs
89
- [toggle]: https://jsr.io/@nodef/extra-version/doc/~/toggle
90
- [toggleAs]: https://jsr.io/@nodef/extra-version/doc/~/toggleAs
91
- [swap]: https://jsr.io/@nodef/extra-version/doc/~/swap
92
- [scan]: https://jsr.io/@nodef/extra-version/doc/~/scan
93
- [scanReverse]: https://jsr.io/@nodef/extra-version/doc/~/scanReverse
94
- [count]: https://jsr.io/@nodef/extra-version/doc/~/count
95
- [parity]: https://jsr.io/@nodef/extra-version/doc/~/parity
96
- [rotate]: https://jsr.io/@nodef/extra-version/doc/~/rotate
97
- [reverse]: https://jsr.io/@nodef/extra-version/doc/~/reverse
98
- [merge]: https://jsr.io/@nodef/extra-version/doc/~/merge
99
- [interleave]: https://jsr.io/@nodef/extra-version/doc/~/interleave
100
- [signExtend]: https://jsr.io/@nodef/extra-version/doc/~/signExtend
85
+ [get]: https://jsr.io/@nodef/extra-bit/doc/~/get
86
+ [getAs]: https://jsr.io/@nodef/extra-bit/doc/~/getAs
87
+ [set]: https://jsr.io/@nodef/extra-bit/doc/~/set
88
+ [setAs]: https://jsr.io/@nodef/extra-bit/doc/~/setAs
89
+ [toggle]: https://jsr.io/@nodef/extra-bit/doc/~/toggle
90
+ [toggleAs]: https://jsr.io/@nodef/extra-bit/doc/~/toggleAs
91
+ [swap]: https://jsr.io/@nodef/extra-bit/doc/~/swap
92
+ [scan]: https://jsr.io/@nodef/extra-bit/doc/~/scan
93
+ [scanReverse]: https://jsr.io/@nodef/extra-bit/doc/~/scanReverse
94
+ [count]: https://jsr.io/@nodef/extra-bit/doc/~/count
95
+ [parity]: https://jsr.io/@nodef/extra-bit/doc/~/parity
96
+ [rotate]: https://jsr.io/@nodef/extra-bit/doc/~/rotate
97
+ [reverse]: https://jsr.io/@nodef/extra-bit/doc/~/reverse
98
+ [merge]: https://jsr.io/@nodef/extra-bit/doc/~/merge
99
+ [interleave]: https://jsr.io/@nodef/extra-bit/doc/~/interleave
100
+ [signExtend]: https://jsr.io/@nodef/extra-bit/doc/~/signExtend
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extra-bit",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./index.js",
package/TODO DELETED
@@ -1,33 +0,0 @@
1
- NIBBLES?
2
- STRINGIFY
3
- OTHERS
4
- - fromInt64
5
- - fromDouble
6
- - fromSingle
7
- - slice / getPart(x, i, n)
8
- - deinterleave
9
- - split
10
- - reduce
11
-
12
-
13
- https://www.npmjs.com/package/uupaa.bit.js
14
-
15
- // count the number of contiguous 1 bits from Left-side or Right-side
16
- Bit.cnl(0b11001110) // -> 2
17
- Bit.cnr(0b11001110) // -> 3
18
-
19
- // Number(Count) of Leading Zero
20
- Bit.nlz(0x6) // -> 29
21
- Bit.clz(0x6) // -> 29 (this function is an alias of Bit.nlz)
22
-
23
- // Number(Count) of Training Zero
24
- Bit.ntz(0x6) // -> 1
25
- Bit.ctz(0x6) // -> 1 (this function is an alias of Bit.ntz)
26
-
27
- // binary dump
28
- Bit.dump(0x12345678, [4,4,8,4,4,8]);
29
- // -> "0001, 0010, 00110100, 0101, 0110, 01111000"
30
-
31
- // verbose dump
32
- Bit.dump(0x12345678, bitPattern, true);
33
- // -> "00010010001101000101011001111000(0x12345678), 0001(1,0x1), 0010(2,0x2), 00110100(52,0x34), 0101(5,0x5), 0110(6,0x6), 01111000(120,0x78)"
package/build.ts DELETED
@@ -1,43 +0,0 @@
1
- import {parseArgs} from "@std/cli/parse-args";
2
-
3
-
4
- // Run a command in a subprocess, with inherited stdio.
5
- async function run(command: string, args: string[], cwd?: string) {
6
- const cmd = new Deno.Command(command, {
7
- args: args,
8
- cwd: cwd,
9
- stdin: 'inherit',
10
- stdout: 'inherit',
11
- stderr: 'inherit'
12
- });
13
- return await cmd.spawn().status;
14
- }
15
-
16
-
17
- // Publish core package to npm.
18
- async function publishCoreToNpm() {
19
- const name = JSON.parse(await Deno.readTextFile('deno.json')).name.replace(/^@nodef\//, '');
20
- console.log(`Publishing the ${name} package to npm...`);
21
- await run('deno', ['pack', '--output', `${name}.tgz`, '--allow-dirty']);
22
- Deno.mkdirSync('.temp-pack', {recursive: true});
23
- await run('tar', ['-xzf', `${name}.tgz`, '-C', '.temp-pack']);
24
- Deno.removeSync(`${name}.tgz`);
25
- const meta = JSON.parse(await Deno.readTextFile('.temp-pack/package/package.json'));
26
- meta.name = name;
27
- await Deno.writeTextFile('.temp-pack/package/package.json', JSON.stringify(meta, null, 2));
28
- await run('npm', ['publish', '--access', 'public'], '.temp-pack/package');
29
- await Deno.remove('.temp-pack', {recursive: true});
30
- }
31
-
32
-
33
- // Main function, of course.
34
- async function main() {
35
- const args = parseArgs(Deno.args, {
36
- boolean: ['publish-core'],
37
- default: {'publish-core': false}
38
- });
39
- if (args['publish-core']) {
40
- await publishCoreToNpm();
41
- }
42
- }
43
- main();