This package has been deprecated

Author message:

This package is now deprecated. Please use @atproto/syntax, which provides the same interfaces.

@atproto/nsid
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @atproto/nsid

Weekly Downloads

3,994

Version

0.1.1

License

MIT

Unpacked Size

12.6 kB

Total Files

13

Last publish

Collaborators

  • devinivy
  • dholms
  • estrattonbailey
  • pfrazee