defy.tools

Function uniqueNotesBySenderAndDate

  • Array.filter predicate that removes duplicate Notes with the same pubkey and created_at values.

    Parameters

    Returns boolean

    Remarks

    In groups with more than 2 participants, sent messages will appear as duplicates with the same ownerPubKey and created_at values, but encrypted for a different index.

    Example

    [
    { ownerPubKey: 'a' , nostrEvent: { created_at: 123456789 }},
    { ownerPubKey: 'a' , nostrEvent: { created_at: 123456789 }}
    ].filter(uniqueNotesBySenderAndDate)

    See

    https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/filter