distype - v3.0.1
    Preparing search index...

    Class ExtendedMap<K, V>

    A Map with additional methods. Similar to that of discord.js's collection

    Type Parameters

    • K
    • V

    Hierarchy

    • Map<K, V>
      • ExtendedMap
    Index

    Constructors

    • Type Parameters

      • K
      • V

      Parameters

      • Optionalentries: null | readonly (readonly [K, V])[]

      Returns ExtendedMap<K, V>

    • Type Parameters

      • K
      • V

      Parameters

      • Optionaliterable: null | Iterable<readonly [K, V], any, any>

      Returns ExtendedMap<K, V>

    Properties

    "[toStringTag]": string
    constructor: ExtendedMapConstructor

    The initial value of Object.prototype.constructor is the standard built-in Object constructor.

    "[species]": MapConstructor

    Accessors

    Methods

    • Returns an iterable of entries in the map.

      Returns MapIterator<[K, V]>

    • Returns the element of the element at an index of the map. Similar to Array#at().

      Parameters

      • index: number

        The index of the element.

      Returns undefined | V

      The found element, or undefined if no element matches the index.

    • Removes all elements from the map. Derived from the Map#clear() method, however this is returned instead of void.

      Returns this

      The map.

    • Removes a specified element from the map. Derived from the Map#delete() method.

      Parameters

      • key: K

        The key of the element to remove.

      Returns boolean

      If the element was removed, false if it does not exist.

    • Returns a new iterator object that contains key value pairs for each element in the map. Derived from the Map#entries() method.

      Returns MapIterator<[K, V]>

      The new iterator object.

    • Tests if all elements in the map satisfy a test specified in the callback. Similar to Array#every().

      Parameters

      • callbackfn: (value: V, key: K, map: this) => boolean

        A function to test every element of the map.

      • OptionalthisArg: any

        A value to use as this when executing callbackfn.

      Returns boolean

      true if all elements pass the callback test, false otherwise.

    • Sets every element of the map to the specified value. Similar to Array#fill().

      Parameters

      • value: V

        The value to set all elements of the map to.

      Returns this

      The map.

    • Creates a new map with all elements that pass a test specified in the callback. Similar to Array#filter().

      Parameters

      • callbackfn: (value: V, key: K, map: this) => boolean

        A function to test every element of the map.

      • OptionalthisArg: any

        A value to use as this when executing callbackfn.

      Returns ExtendedMap<K, V>

      A map with elements that passed the provided test.

    • Returns the first element in the map that satisfies the provided test. Similar to Array#find().

      Parameters

      • callbackfn: (value: V, key: K, map: this) => boolean

        A function to test every element of the map.

      • OptionalthisArg: any

        A value to use as this when executing callbackfn.

      Returns undefined | V

      The first element that satisfies the test. If no element is found, undefined is returned.

    • Returns the first key in the map that satisfies the provided test. Similar to Array#findIndex().

      Parameters

      • callbackfn: (value: V, key: K, map: this) => boolean

        A function to test every element of the map.

      • OptionalthisArg: any

        A value to use as this when executing callbackfn.

      Returns undefined | K

      The first key that satisfies the test. If no element is found, undefined is returned.

    • Returns the first value(s) of the map.

      Returns undefined | V

      The first value if no amount is specified, else an array of the first values.

    • Returns the first value(s) of the map.

      Parameters

      • amount: number

        The number of items to retrieve from the start of the map.

      Returns V[]

      The first value if no amount is specified, else an array of the first values.

    • Returns a new map created by applying a specified callback function to each element of the map, then flattening the result by 1 level. Identical to ExtendedMap#map() followed by flattening by a depth of 1. Similar to Array#flatMap().

      Type Parameters

      • T

      Parameters

      • callbackfn: (value: V, key: K, map: this) => ExtendedMap<K, T>

        A function to apply to every element of the map.

      • OptionalthisArg: any

        A value to use as this when executing callbackfn.

      Returns ExtendedMap<K, T>

      The new map.

    • Executes the provided function once for each element in the map. Derived from the Map#forEach() method, however this is returned instead of void.

      Parameters

      • callbackfn: (value: V, key: K, map: Map<K, V>) => void

        The function to execute for each element in the map.

      • OptionalthisArg: any

        A value to use as this when executing callbackfn.

      Returns this

      The map.

    • Returns a specified element from the map. Derived from the Map#get() method.

      Parameters

      • key: K

        The key of the element.

      Returns undefined | V

      The element with the specified key, or undefined if no element matches the key.

    • Checks if the map has an element with the specified key. Derived from the Map#has() method.

      Parameters

      • key: K

        The key to test.

      Returns boolean

      true if an element is found, false otherwise.

    • Creates a string by concatenating the values of all elements of the map.

      Parameters

      • separator: string = ...

        A string to separate values by. Defaults to ,.

      Returns string

      The created strings.

    • Creates a string by concatenating the keys of all elements of the map.

      Parameters

      • separator: string = ...

        A string to separate keys by. Defaults to ,.

      Returns string

      The created strings.

    • Returns a new iterator object that contains keys for each element in the map. Derived from the Map#keys() method.

      Returns MapIterator<K>

      The new iterator object.

    • Creates an array filled with the results from calling a specified callback function on each element of the map. Similar to Array#map().

      Type Parameters

      • T

      Parameters

      • callbackfn: (value: V, key: K, map: this) => T

        A function to apply to every element of the map.

      • OptionalthisArg: any

        A value to use as this when executing callbackfn.

      Returns T[]

      The array.

    • Executes a specified reducer callback function on each element of the map to produce a single value. Similar to Array#reduce().

      Type Parameters

      • T

      Parameters

      • callbackfn: (previousValue: T, currentValue: V, currentIndex: K, map: this) => T

        A reducer function to apply to every element of the map.

      • OptionalinitialValue: T

        A value to initialize previousValue in the callback function with.

      Returns T

      The result of the reducer.

    • Adds or modifies an element with the specified key. Derived from the Map#set() method.

      Parameters

      • key: K

        The key of the element to add / modify.

      • value: V

        The new value of the specified element.

      Returns this

      The map.

    • Tests if any element in the map satisfies a test specified in the callback. Similar to Array#some().

      Parameters

      • callbackfn: (value: V, key: K, map: this) => boolean

        A function to test every element of the map.

      • OptionalthisArg: any

        A value to use as this when executing callbackfn.

      Returns boolean

      true if a single element passes the callback test, false otherwise.

    • Removes all elements in the map that satisfy a specified test.

      Parameters

      • callbackfn: (value: V, key: K, map: this) => boolean

        A function to test every element of the map.

      • OptionalthisArg: any

        A value to use as this when executing callbackfn.

      Returns ExtendedMap<K, V>

      A map containing the removed elements.

    • Returns a new iterator object that contains values for each element in the map. Derived from the Map#values() method.

      Returns MapIterator<V>

      The new iterator object.

    • Determines if a value is a map.

      Parameters

      • value: any

        The value to test.

      Returns value is Map<any, any>