Daniel Holmgren 7e0201d4d6
Bump package versions ()
* v0.3.0

* bump common-web to 0.2.0

* v0.2.0

* v0.2.0

* v0.1.0

* v0.1.0

* v0.1.0

* v0.2.0

* v0.4.0

* v0.1.0

* v0.2.0

* v0.2.0

* v0.3.0

* v0.2.0
2023-07-05 20:54:26 -05:00
..
2023-05-31 16:56:08 -07:00
2023-05-31 16:56:08 -07:00
2022-09-19 15:53:39 -05:00
2022-09-19 15:53:39 -05:00
2023-07-05 20:54:26 -05:00
2022-09-19 15:53:39 -05:00
2022-09-19 15:53:39 -05:00

NameSpaced IDs (NSID) API

Usage

import { NSID } from '@atproto/nsid'

const id1 = NSID.parse('com.example.foo')
id1.authority  // => 'example.com'
id1.name       // => 'foo'
id1.toString() // => 'com.example.foo'

const id2 = NSID.create('example.com', 'foo')
id2.authority  // => 'example.com'
id2.name       // => 'foo'
id2.toString() // => 'com.example.foo'

const id3 = NSID.create('example.com', 'someRecord')
id3.authority  // => 'example.com'
id3.name       // => 'someRecord'
id3.toString() // => 'com.example.someRecord'

NSID.isValid('com.example.foo') // => true
NSID.isValid('com.example.someRecord') // => true
NSID.isValid('example.com/foo') // => false
NSID.isValid('foo') // => false

License

MIT