nip27.find --> nip27.matchAll

This commit is contained in:
Alex Gleason
2023-04-22 19:06:53 -05:00
parent dcf101c6c2
commit 6a037d1658
2 changed files with 3 additions and 3 deletions

View File

@@ -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'
) )

View File

@@ -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 => {