From 835f0853192ca63366fdc66c816ad600be9cf88c Mon Sep 17 00:00:00 2001 From: CH Date: Sun, 28 Jul 2024 12:59:29 +0200 Subject: [PATCH] Docs --- .../classes/Collections.Maps.ExpiringMap.html | 85 ------------------- .../Collections.Maps.MapOfSimpleMutable.html | 69 --------------- .../Collections.Queues.QueueMutable.html | 66 -------------- .../Collections.Maps.expiringMap-1.html | 3 - ...Collections.Maps.mapOfSimpleMutable-1.html | 9 -- docs/functions/Geometry.Points.angle.html | 7 -- 6 files changed, 239 deletions(-) delete mode 100644 docs/classes/Collections.Maps.ExpiringMap.html delete mode 100644 docs/classes/Collections.Maps.MapOfSimpleMutable.html delete mode 100644 docs/classes/Collections.Queues.QueueMutable.html delete mode 100644 docs/functions/Collections.Maps.expiringMap-1.html delete mode 100644 docs/functions/Collections.Maps.mapOfSimpleMutable-1.html delete mode 100644 docs/functions/Geometry.Points.angle.html diff --git a/docs/classes/Collections.Maps.ExpiringMap.html b/docs/classes/Collections.Maps.ExpiringMap.html deleted file mode 100644 index bb618e9c2..000000000 --- a/docs/classes/Collections.Maps.ExpiringMap.html +++ /dev/null @@ -1,85 +0,0 @@ -ExpiringMap | ixfx

Class ExpiringMap<K, V>

A map that can have a capacity limit. The elapsed time for each get/set -operation is maintained allowing for items to be automatically removed. -has() does not affect the last access time.

-

By default, it uses the none eviction policy, meaning that when full -an error will be thrown if attempting to add new keys.

-

Eviction policies: -oldestGet removes the item that hasn't been accessed the longest, -oldestSet removes the item that hasn't been updated the longest.

-
const map = new ExpiringMap();
map.set(`fruit`, `apple`);

// Remove all entries that were set more than 100ms ago
map.deleteWithElapsed(100, `set`);
// Remove all entries that were last accessed more than 100ms ago
map.deleteWithElapsed(100, `get`);
// Returns the elapsed time since `fruit` was last accessed
map.elapsedGet(`fruit`);
// Returns the elapsed time since `fruit` was last set
map.elapsedSet(`fruit`); -
- -

Last set/get time for a key can be manually reset using touch(key).

-

Events:

-
    -
  • expired: when an item is automatically removed.
  • -
  • removed: when an item is manually or automatically removed.
  • -
  • newKey: when a new key is added
  • -
-
map.addEventListener(`expired`, evt => {
const { key, value } = evt;
}); -
- -

The map can automatically remove items based on elapsed intervals.

-
const map = new ExpiringMap({
autoDeleteElapsed: 1000,
autoDeletePolicy: `get`
}); -
- -
const map = new ExpiringMap({
capacity: 5,
evictPolicy: `oldestSet`
}); -
- -

Type Parameters

  • K
  • V

Hierarchy (view full)

Constructors

Accessors

  • get isDisposed(): boolean
  • Returns boolean

  • get keyLength(): number
  • Returns the number of keys being stored.

    -

    Returns number

Methods

  • Clears the contents of the map. -Note: does not fire removed event

    -

    Returns void

  • Deletes the value under key, if present.

    -

    Returns true if something was removed.

    -

    Parameters

    • key: K

    Returns boolean

  • Deletes all values where elapsed time has past -for get/set or either.

    -
    // Delete all keys (and associated values) not accessed for a minute
    em.deleteWithElapsed({mins:1}, `get`);
    // Delete things that were set 1s ago
    em.deleteWithElapsed(1000, `set`); -
    - -

    Parameters

    • interval: Interval

      Interval

      -
    • property: "set" | "get" | "either"

      Basis for deletion 'get','set' or 'either'

      -

    Returns [k: K, v: V][]

    Items removed

    -
  • Returns the elapsed time since key -was accessed. Returns undefined if key -does not exist

    -

    Parameters

    • key: K

    Returns undefined | number

  • Returns the elapsed time since key -was set. Returns undefined if key -does not exist

    -

    Parameters

    • key: K

    Returns undefined | number

  • Returns IterableIterator<[k: K, v: V]>

  • Gets an item from the map by key, returning -undefined if not present

    -

    Parameters

    • key: K

      Key

      -

    Returns undefined | V

    Value, or undefined

    -
  • Returns true if key is stored. -Does not affect the key's last access time.

    -

    Parameters

    • key: K

    Returns boolean

  • Returns IterableIterator<K>

  • Sets the key to be value.

    -

    If the key already exists, it is updated.

    -

    If the map is full, according to its capacity, -another value is selected for removal.

    -

    Parameters

    • key: K
    • value: V

    Returns void

  • Updates the lastSet/lastGet time for a value -under k.

    -

    Returns false if key was not found

    -

    Parameters

    • key: K

    Returns boolean

  • Returns IterableIterator<V>

diff --git a/docs/classes/Collections.Maps.MapOfSimpleMutable.html b/docs/classes/Collections.Maps.MapOfSimpleMutable.html deleted file mode 100644 index 387c1cf59..000000000 --- a/docs/classes/Collections.Maps.MapOfSimpleMutable.html +++ /dev/null @@ -1,69 +0,0 @@ -MapOfSimpleMutable | ixfx

Class MapOfSimpleMutable<V>

A simple mutable map of arrays, without events. It can store multiple values -under the same key.

-

For a fancier approaches, consider ofArrayMutable, ofCircularMutable or ofSetMutable.

-
const m = mapOfSimpleMutable();
m.add(`hello`, 1, 2, 3); // Adds numbers under key `hello`
m.delete(`hello`); // Deletes everything under `hello`

const hellos = m.get(`hello`); // Get list of items under `hello` -
- -

Constructor takes a groupBy parameter, which yields a string key for a value. This is the -basis by which values are keyed when using addValues.

-

Constructor takes a valueEq parameter, which compares values. This is used when checking -if a value exists under a key, for example.

-

Type Parameters

  • V

    Type of items

    -

Hierarchy

  • MapOfSimpleBase<V>
    • MapOfSimpleMutable

Implements

Constructors

  • Constructor

    -

    Type Parameters

    • V

    Parameters

    • groupBy: ((value: V) => string) = defaultKeyer

      Creates keys for values when using addValue. By default uses JSON.stringify

      -
        • (value): string
        • Parameters

          • value: V

          Returns string

    • valueEq: IsEqual<V> = ...

      Compare values. By default uses JS logic for equality

      -
    • initial: [string, readonly V[]][] = []

    Returns MapOfSimpleMutable<V>

Properties

groupBy: ((value: V) => string)
map: Map<string, readonly V[]>
valueEq: IsEqual<V>

Accessors

  • get isEmpty(): boolean
  • True if empty

    -

    Returns boolean

  • get lengthKeys(): number
  • Returns the number of keys

    -

    Returns number

Methods

  • Adds several values under the same key. Duplicate values are permitted, depending on implementation.

    -

    Parameters

    • key: string
    • Rest...values: readonly V[]

    Returns void

  • Adds a value, automatically extracting a key via the -groupBy function assigned in the constructor options.

    -

    Parameters

    • Rest...values: readonly V[]

      Adds several values

      -

    Returns void

  • Return number of values stored under key. -Returns 0 if key is not found.

    -

    Parameters

    • key: string

    Returns number

  • Debug dump of contents

    -

    Returns string

  • Deletes all values under key,

    -

    Parameters

    • key: string

    Returns boolean

    True if key was found and values stored

    -
  • Deletes value regardless of key.

    -

    Uses the constructor-defined equality function.

    -

    Parameters

    • value: V

      Value to delete

      -

    Returns boolean

  • Delete value under a particular key

    -

    Parameters

    • key: string
    • value: V

    Returns boolean

    True if value was found under key

    -
  • Returns IterableIterator<[key: string, value: V[]]>

  • Iterate over all entries

    -

    Returns IterableIterator<[key: string, value: V]>

  • Finds the first key where value is stored. -Note: value could be stored in multiple keys

    -

    Parameters

    • value: V

      Value to seek

      -
    • eq: IsEqual<V> = isEqualDefault

    Returns undefined | string

    Key, or undefined if value not found

    -
  • Get all values under key

    -

    Parameters

    • key: string

    Returns IterableIterator<V>

  • Returns true if key exists

    -

    Parameters

    • key: string

    Returns boolean

  • Returns true if value exists under key.

    -

    Parameters

    • key: string

      Key

      -
    • value: V

      Value to seek under key

      -

    Returns boolean

    True if value exists under key.

    -
  • Iterate over all keys

    -

    Returns IterableIterator<string>

  • Iterate over keys and length of values stored under keys

    -

    Returns IterableIterator<[string, number]>

  • Iterate over all values (regardless of key)

    -

    Returns IterableIterator<V>

diff --git a/docs/classes/Collections.Queues.QueueMutable.html b/docs/classes/Collections.Queues.QueueMutable.html deleted file mode 100644 index 06c011283..000000000 --- a/docs/classes/Collections.Queues.QueueMutable.html +++ /dev/null @@ -1,66 +0,0 @@ -QueueMutable | ixfx

Mutable queue that fires events when manipulated.

-

Queues are useful if you want to treat 'older' or 'newer' -items differently. Enqueing adds items at the back of the queue, while -dequeing removes items from the front (ie. the oldest).

-
const q = Queues.mutable();       // Create
q.enqueue(`a`, `b`); // Add two strings
const front = q.dequeue(); // `a` is at the front of queue (oldest) -
- -
const q = Queues.mutable({capacity: 5, discardPolicy: `newer`});
-
- -

Events can be used to monitor data flows.

-
    -
  • 'enqueue': fires when item(s) are added
  • -
  • 'dequeue': fires when an item is dequeued from front
  • -
  • 'removed': fires when an item is dequeued, queue is cleared or .removeWhere is used to trim queue
  • -
-

Each of the event handlers return the state of the queue as the 'finalData' -field.

-
q.addEventListener(`enqueue`, e => {
// e.added, e.finalData
});
q.addEventListener(`removed`, e => {
// e.removed, e.finalData
});
q.addEventListener(`dequeue`, e=> {
// e.removed, e.finalData
}) -
- -

Type Parameters

  • V

    Data type of items

    -

Hierarchy (view full)

Implements

Constructors

Properties

data: readonly V[]
eq: IsEqual<V>
options: QueueOpts<V>

Accessors

  • get isDisposed(): boolean
  • Returns boolean

  • get isEmpty(): boolean
  • Returns true if queue is empty

    -

    Returns boolean

  • get isFull(): boolean
  • Is queue full? Returns false if no capacity has been set

    -

    Returns boolean

  • get length(): number
  • Number of items in queue

    -

    Returns number

  • get peek(): undefined | V
  • Returns front of queue (oldest item), or undefined if queue is empty

    -

    Returns undefined | V

Methods

  • Returns the item at given rank (0 being front of queue)

    -

    Parameters

    • index: number

    Returns V

  • Dequeues (removes oldest item / item at front of queue)

    -

    Use peek to look at the item at front of queue without removing it.

    -

    Returns undefined | V

    Item, or undefined if queue is empty

    -
  • Enqueues (adds items to back of queue). -If a capacity is set, not all items might be added.

    -

    Parameters

    • Rest...toAdd: readonly V[]

    Returns number

    How many items were added

    -
  • Called when all data is cleared

    -

    Returns void

  • Parameters

    • result: readonly V[]
    • attemptedToAdd: readonly V[]

    Returns void

  • Parameters

    • removed: readonly V[]
    • finalData: readonly V[]

    Returns void

  • Removes values that match predicate.

    -

    Parameters

    • predicate: ((item: V) => boolean)
        • (item): boolean
        • Parameters

          • item: V

          Returns boolean

    Returns number

    Returns number of items removed.

    -
diff --git a/docs/functions/Collections.Maps.expiringMap-1.html b/docs/functions/Collections.Maps.expiringMap-1.html deleted file mode 100644 index 8d33af14d..000000000 --- a/docs/functions/Collections.Maps.expiringMap-1.html +++ /dev/null @@ -1,3 +0,0 @@ -expiringMap | ixfx

Function expiringMap

Create a ExpiringMap instance

-
diff --git a/docs/functions/Collections.Maps.mapOfSimpleMutable-1.html b/docs/functions/Collections.Maps.mapOfSimpleMutable-1.html deleted file mode 100644 index d81ab876c..000000000 --- a/docs/functions/Collections.Maps.mapOfSimpleMutable-1.html +++ /dev/null @@ -1,9 +0,0 @@ -mapOfSimpleMutable | ixfx

Function mapOfSimpleMutable

A simple mutable map of arrays, without events. It can store multiple values -under the same key.

-

For a fancier approaches, consider ofArrayMutable, ofCircularMutable or ofSetMutable.

-
const m = mapOfSimpleMutable();
m.add(`hello`, 1, 2, 3); // Adds numbers under key `hello`
m.delete(`hello`); // Deletes everything under `hello`

const hellos = m.get(`hello`); // Get list of items under `hello` -
- -
  • Type Parameters

    • V

      Type of items

      -

    Parameters

    • groupBy: ((value: V) => string) = defaultKeyer
        • (value): string
        • Parameters

          • value: V

          Returns string

    • valueEq: IsEqual<V> = ...

    Returns IMapOfMutable<V>

    New instance

    -
diff --git a/docs/functions/Geometry.Points.angle.html b/docs/functions/Geometry.Points.angle.html deleted file mode 100644 index 6dba5c735..000000000 --- a/docs/functions/Geometry.Points.angle.html +++ /dev/null @@ -1,7 +0,0 @@ -angle | ixfx

Returns the angle in radians between a and b.

-

Eg if a is the origin, and b is another point, -in degrees one would get 0 to -180 when b was above a. --180 would be b in line with a. -Same for under a.

-

Providing a third point c gives the interior angle, where b is the middle point.

-
  • Parameters

    Returns number