@ewanc26/tid 1.0.0 → 1.0.2

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 +6 -6
  2. package/package.json +13 -9
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @malachite/tid
1
+ # @ewanc26/tid
2
2
 
3
3
  Zero-dependency [AT Protocol](https://atproto.com/) TID (Timestamp Identifier) generation for Node.js and browsers.
4
4
 
@@ -23,7 +23,7 @@ pnpm add @ewanc26/tid
23
23
  Pass an ISO 8601 string or a `Date` object. The clock is monotonic — if records arrive out of order, the timestamp is bumped forward so every call produces a strictly increasing TID within the same JS context.
24
24
 
25
25
  ```ts
26
- import { generateTID } from '@malachite/tid';
26
+ import { generateTID } from '@ewanc26/tid';
27
27
 
28
28
  // From an ISO string (e.g. a Last.fm scrobble timestamp)
29
29
  const tid = generateTID('2023-11-01T12:00:00Z');
@@ -35,7 +35,7 @@ const tid2 = generateTID(new Date('2024-03-15T09:30:00Z'));
35
35
  ### Generate a TID for right now
36
36
 
37
37
  ```ts
38
- import { generateNextTID } from '@malachite/tid';
38
+ import { generateNextTID } from '@ewanc26/tid';
39
39
 
40
40
  const tid = generateNextTID();
41
41
  ```
@@ -43,7 +43,7 @@ const tid = generateNextTID();
43
43
  ### Validate a TID
44
44
 
45
45
  ```ts
46
- import { validateTid } from '@malachite/tid';
46
+ import { validateTid } from '@ewanc26/tid';
47
47
 
48
48
  validateTid('3jzfcijpj2z2a'); // true
49
49
  validateTid('not-a-tid'); // false
@@ -52,7 +52,7 @@ validateTid('not-a-tid'); // false
52
52
  ### Decode a TID
53
53
 
54
54
  ```ts
55
- import { decodeTid } from '@malachite/tid';
55
+ import { decodeTid } from '@ewanc26/tid';
56
56
 
57
57
  const { timestampUs, clockId, date } = decodeTid('3jzfcijpj2z2a');
58
58
  // timestampUs — microseconds since Unix epoch
@@ -65,7 +65,7 @@ const { timestampUs, clockId, date } = decodeTid('3jzfcijpj2z2a');
65
65
  Because the AT Protocol base-32 alphabet is ordered by timestamp, lexicographic string comparison is correct. `compareTids` returns `-1 | 0 | 1` for use as a `sort` comparator.
66
66
 
67
67
  ```ts
68
- import { compareTids } from '@malachite/tid';
68
+ import { compareTids } from '@ewanc26/tid';
69
69
 
70
70
  const tids = ['3jzfcijpj2z2a', '3jzfabc000022', '3jzfzzzzzzz2a'];
71
71
  tids.sort(compareTids);
package/package.json CHANGED
@@ -1,24 +1,28 @@
1
1
  {
2
2
  "name": "@ewanc26/tid",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Zero-dependency AT Protocol TID generation for Node.js and browsers",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
8
- "types": "./dist/index.d.ts",
9
- "import": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js",
10
10
  "require": "./dist/index.cjs"
11
11
  }
12
12
  },
13
- "main": "./dist/index.cjs",
13
+ "main": "./dist/index.cjs",
14
14
  "module": "./dist/index.js",
15
15
  "types": "./dist/index.d.ts",
16
- "files": ["dist", "README.md", "LICENCE"],
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "LICENCE"
20
+ ],
17
21
  "scripts": {
18
- "build": "tsup src/index.ts --format esm,cjs --dts --clean",
19
- "dev": "tsup src/index.ts --format esm,cjs --dts --watch",
22
+ "build": "tsup src/index.ts --format esm,cjs --dts --clean",
23
+ "dev": "tsup src/index.ts --format esm,cjs --dts --watch",
20
24
  "type-check": "tsc --noEmit",
21
- "test": "node --test dist/index.test.js"
25
+ "test": "node --test dist/index.test.js"
22
26
  },
23
27
  "keywords": [
24
28
  "atproto",
@@ -28,7 +32,7 @@
28
32
  "identifier",
29
33
  "lexicon"
30
34
  ],
31
- "author": "",
35
+ "author": "Ewan Croft",
32
36
  "license": "AGPL-3.0-only",
33
37
  "devDependencies": {
34
38
  "tsup": "^8.5.0",