mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
nip27.find --> nip27.matchAll
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
/* eslint-env jest */
|
/* eslint-env jest */
|
||||||
const {nip27} = require('./lib/nostr.cjs')
|
const {nip27} = require('./lib/nostr.cjs')
|
||||||
|
|
||||||
test('find', () => {
|
test('matchAll', () => {
|
||||||
const result = nip27.find(
|
const result = nip27.matchAll(
|
||||||
'Hello nostr:npub108pv4cg5ag52nq082kd5leu9ffrn2gdg6g4xdwatn73y36uzplmq9uyev6!\n\nnostr:note1gmtnz6q2m55epmlpe3semjdcq987av3jvx4emmjsa8g3s9x7tg4sclreky'
|
'Hello nostr:npub108pv4cg5ag52nq082kd5leu9ffrn2gdg6g4xdwatn73y36uzplmq9uyev6!\n\nnostr:note1gmtnz6q2m55epmlpe3semjdcq987av3jvx4emmjsa8g3s9x7tg4sclreky'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
2
nip27.ts
2
nip27.ts
@@ -14,7 +14,7 @@ export interface NostrURIMatch extends nip21.NostrURI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Find and decode all NIP-21 URIs. */
|
/** Find and decode all NIP-21 URIs. */
|
||||||
export function find(content: string): NostrURIMatch[] {
|
export function matchAll(content: string): NostrURIMatch[] {
|
||||||
const matches = content.matchAll(regex())
|
const matches = content.matchAll(regex())
|
||||||
|
|
||||||
return [...matches].map(match => {
|
return [...matches].map(match => {
|
||||||
|
|||||||
Reference in New Issue
Block a user