API Docs for:
Show:

utils.nf.graph-event Class

Extends Graph-position
Module: utils/nf/array-helpers

Event object for graph events

Methods

identity

(
  • x
)
Any private

returns whatever you pass into it.

Parameters:

  • x Any

Returns:

Any:

x

natualSort

(
  • arr
)

Sorts the array "naturally". Meaning taking into account both alphabetical and numeric sorting within strings.

Parameters:

  • arr Array

    the array to sort

naturalCompare

(
  • a
  • b
)
Number

A JavaScript sorting predicate for natural sorting.

Parameters:

  • a Any

    the value to compare to b

  • b Any

    the value to compare to a

Returns:

Number:

-1, 0 or 1 if a is less than, equal to, or greater than b, respectively.

naturalTokenize

(
  • item
)
Array private

breaks a string into an array of tokens in preparation for natural comparison and sorting.

Parameters:

  • item String

    the value to tokenize

Returns:

Array:

an array of tokens found in the item

nearestIndexTo

(
  • arr
  • val
  • mappingFn
)

Performs a binary search on the array and finds the nearest index to the value passed.

Parameters:

  • arr Array

    the sorted array to search.

  • val Number

    the value to find the nearest index to.

  • mappingFn Function

    an optional function for pulling values out of the array items.

Properties

data

Any

A data value passed with the event

Default: null

originalEvent

Event

The original event that triggered this event or action

Default: null