index.d.ts 778 B

123456789101112131415161718192021222324252627282930313233
  1. declare class OrderedMap<T = any> {
  2. private constructor(content: Array<string | T>)
  3. get(key: string): T | undefined
  4. update(key: string, value: T, newKey?: string): OrderedMap<T>
  5. remove(key: string): OrderedMap<T>
  6. addToStart(key: string, value: T): OrderedMap<T>
  7. addToEnd(key: string, value: T): OrderedMap<T>
  8. addBefore(place: string, key: string, value: T): OrderedMap<T>
  9. forEach(fn: (key: string, value: T) => any): void
  10. prepend(map: MapLike<T>): OrderedMap<T>
  11. append(map: MapLike<T>): OrderedMap<T>
  12. subtract(map: MapLike<T>): OrderedMap<T>
  13. toObject(): Record<string, T>;
  14. readonly size: number
  15. static from<T>(map: MapLike<T>): OrderedMap<T>
  16. }
  17. export type MapLike<T = any> = Record<string, T> | OrderedMap<T>
  18. export default OrderedMap