Skip to content

Helpers

applesauce-core and other packages export helper methods for working with events.

WARNING

Some helper methods may throw errors. make sure your app can handle errors correctly.

Core helpers

The applesauce-core package contains the majority of the helper methods

Events

Profiles

Mailboxes

Comments

Event relays

  • addSeenRelay Adds a relay to the list of relay the event was seen on
  • getSeenRelays Get the list of relays this event was seen on

Zaps

Lightning

Pointers

Delete events

Emojis

URLs

  • getURLFilename returns the filename part fo the path in a URL
  • isAudioURL Checks if the URL ends with a audio file extension
  • isVideoURL Checks if the URL ends with a video file extension
  • isImageURL Checks if the URL ends with a image file extension
  • isStreamURL Checks if the URL ends with a stream file extension

Tags

  • isETag Checks if tag is an "e" tag and has at least one value
  • isATag Checks if tag is an "a" tag and has at least one value
  • isPTag Checks if tag is an "p" tag and has at least one value
  • isDTag Checks if tag is an "d" tag and has at least one value
  • isRTag Checks if tag is an "r" tag and has at least one value
  • isTTag Checks if tag is an "t" tag and has at least one value

Hidden Tags

Hidden tags are used in NIP-51 lists and NIP-60 wallets

Filters

Time

  • unixNow Returns the current unix timestamp

Factory Helpers

The applesauce-factory package exports some helpers for building events and tags

Some of the most useful ones are