JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q23646F
  • License MIT

EMCAScript Standard Template Library

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (es-stl) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    es-stl

    EMCAScript Standard Template Library

    Install

    npm:

    $ npm install --save es-stl

    yarn:

    $ yarn add es-stl

    Usage

    Using es5

    const binarySearch = require('ts-stl/algm/binarySearch');
    
    binarySearch([1, 3, 5], 3);// => 1

    Using es6 or typescript

    import binarySearch from 'ts-stl/algm/binarySearch';
    
    binarySearch([1, 3, 5], 3);// => 1

    Reference

    lodash

    jquery

    Modules

    algm/binarySearchnumber

    Binary Search

    algm/binarySearchByRangenumber

    Binary search by range.

    algm/binarySearchInRangenumber

    Binary search in range [a, b).

    algm/exponentialSearchnumber

    Exponential Search

    algm/interpolationSearchnumber

    Interpolation Search

    algm/mergeSortArrArray.<T>

    To combine two sorted arrays into an array sorted by original rules

    algm/mergeSortSingleArray.<T>

    Inserts an element into an sorted array, keeping the original order

    algm/unique

    Array Unique

    ds/BinarySortTree

    Binary Sort Tree

    ds/Graph

    Graph

    ds/Heap

    Heap

    ds/Queue

    Queue

    ds/Set

    Set

    ds/Stack

    Stack

    utils/clampnumber

    Clamps number within the inclusive lower and upper bounds.

    utils/Compare

    Compare

    utils/debouncefunction

    debounce

    utils/ellipsisstring

    String abbreviation with ellipsis

    utils/error

    Throw error

    utils/formatstring

    String format, just support %s, it's simple, but useful.

    utils/formatsstring

    String format, just support %s, it's simple, but useful.

    utils/getClassstring

    Determine the internal JavaScript [[Class]] of an object.

    utils/hashCodenumber

    Get hash code from number or string.

    utils/inRangeboolean

    Checks if num is between start and end, such as start <= num <= end

    utils/isArrayLikeboolean

    Checks if value is array-like. A value is considered array-like if it's not a function and not a window and has a value.length that's an integer greater than or equal to 0 and less than or equal to Number.MAX_SAFE_INTEGER.

    utils/isBoolboolean

    Checks if value is classified as a boolean primitive or object.

    utils/isClassboolean

    Checks if value is classified as a Class primitive or object.

    utils/isFuncboolean

    Checks if value is classified as a Function object.

    utils/isIntboolean

    Checks if value is an integer.

    utils/isLengthboolean

    Checks if value is a valid array-like length.

    Note: This method is loosely based on ToLength.

    utils/isNumboolean

    Checks if value is classified as a Number primitive or object.

    utils/isObjboolean

    Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))

    utils/isObjLikeboolean

    Checks if value is object-like. A value is object-like if it's not null and has a typeof result of "object".

    utils/isPlainObjboolean

    Checks if value is a plain object, that is, an object created by the Object constructor or one with a [[Prototype]] of null.

    utils/isStrboolean

    Checks if value is classified as a String primitive or object.

    utils/mergeT

    Merge the contents of a object into the first object.

    utils/mergeWithT

    Merge the contents of a object into the first object by customizer.

    utils/noop

    This method returns undefined.

    utils/randomnumber

    Produces a random number between the inclusive lower and upper bounds.

    utils/repeatstring

    Repeats the given string n times.

    utils/throttlefunction

    throttle

    utils/toFixednumber

    Returns a number in fixed-point notation.

    Classes

    CycleLinkList
    Dictionary
    DoubleLinkNode

    DoubleLinkNode

    DoubleLinkList
    LinkNode

    LinkNode

    LinkList
    List
    Map
    Iterator

    Functions

    arraySwap(arr, i, j)

    Array elements swap.

    giveBackCb(args)*

    giveBackCb

    iterate(obj, reverse)Iterator.<V, K>

    iterate

    algm/binarySearch ⇒ number

    Binary Search

    Param Type Default Description
    arr Array.<T> an array after sort from small to large
    searchVal number
    [cb] ISearchCb.<T> giveBackCb
    [left] number 0
    [right] number arr.length - 1

    algm/binarySearchByRange ⇒ number

    Binary search by range.

    Param Type Description
    arr Array.<T> an object array after sort from small to large
    searchVal number
    cb ISearchRangeCb.<T>

    Example

    const dataList = [{s:0, e: 5}, {s:6, e: 18}, {s:19, e: 30}, ...];
    binarySearchByRange(dataList, 10, (range: number[], data: {s: number, e: number}) => {
        range[0] = data.s;
        range[1] = data.e;
    });
    // => 1
    
    const dataList = [{s:0, e: 5}, {s:5, e: 18}, {s:18, e: 30}, ...];
    binarySearchByRange(dataList, 10, (range: number[], data: {s: number, e: number}) => {
        range[0] = data.s;
        range[1] = data.e - 1;
    });
    // => 1

    algm/binarySearchInRange ⇒ number

    Binary search in range [a, b).

    Param Type Description
    arr Array.<T> an object array after sort from small to large
    searchVal number
    cb ISearchCb.<T>

    Example

    const dataList = [{num: 0}, {num: 100}, {num: 300}, {num: 700}, {num: 1000}];
    binarySearchInRange(dataList, 125, (data: { num: number }) => data.num);
    // => 1
    
    i = binarySearchInRange(dataList, -10, (data: { num: number }) => data.num);
    // => -1
    
    i = binarySearchInRange(dataList, 0, (data: { num: number }) => data.num);
    // => 0
    
    i = binarySearchInRange(dataList, 100, (data: { num: number }) => data.num);
    // => 1
    
    i = binarySearchInRange(dataList, 300, (data: { num: number }) => data.num);
    // => 2
    
    i = binarySearchInRange(dataList, 350, (data: { num: number }) => data.num);
    // => 2
    
    i = binarySearchInRange(dataList, 800, (data: { num: number }) => data.num);
    // => 3
    
    i = binarySearchInRange(dataList, 1000, (data: { num: number }) => data.num);
    // => 4
    
    i = binarySearchInRange(dataList, 2000, (data: { num: number }) => data.num);
    // => 4

    algm/exponentialSearch ⇒ number

    Exponential Search

    Param Type Default Description
    arr Array.<T> an array after sort from small to large
    searchVal number
    [cb] ISearchCb.<T> giveBackCb

    algm/interpolationSearch ⇒ number

    Interpolation Search

    Param Type Default Description
    arr Array.<T> an array after sort from small to large
    searchVal number
    [cb] ISearchCb.<T> giveBackCb

    algm/mergeSortArr ⇒ Array.<T>

    To combine two sorted arrays into an array sorted by original rules

    Returns: Array.<T> - new array

    Param Type Description
    arr1 Array.<T> an array after sort
    arr2 Array.<T> an array after sort
    cb ISortCb.<T>

    algm/mergeSortSingle ⇒ Array.<T>

    Inserts an element into an sorted array, keeping the original order

    Param Type Description
    arr Array.<T> an array after sort
    el T
    cb ISortCb.<T>

    algm/unique

    Array Unique

    ds/BinarySortTree

    Binary Sort Tree

    ds/BinarySortTree~BinarySortNode

    Binary sort tree node

    Kind: inner class of ds/BinarySortTree

    ds/BinarySortTree~BinarySortTree

    Kind: inner class of ds/BinarySortTree

    binarySortTree.root ⇒ BinarySortNode.<V>

    root

    Kind: instance property of BinarySortTree

    binarySortTree.isEmpty() ⇒ boolean

    isEmpty

    Kind: instance method of BinarySortTree

    binarySortTree.insert(key, value) ⇒ boolean

    insert

    Kind: instance method of BinarySortTree

    Param Type
    key number
    value V

    binarySortTree.remove(key) ⇒ V | null

    remove

    Kind: instance method of BinarySortTree

    Param Type
    key number

    binarySortTree.search(key, node) ⇒ BinarySortNode.<V> | null

    search

    Kind: instance method of BinarySortTree

    Param Type
    key number
    node BinarySortNode.<V>

    binarySortTree.getMinNode(node) ⇒ BinarySortNode.<V> | null

    getMinNode

    Kind: instance method of BinarySortTree

    Param Type
    node BinarySortNode.<V>

    binarySortTree.getMaxNode(node) ⇒ BinarySortNode.<V> | null

    getMaxNode

    Kind: instance method of BinarySortTree

    Param Type
    node BinarySortNode.<V>

    binarySortTree.preOrder(cb)

    preOrder

    Kind: instance method of BinarySortTree

    Param Type
    cb IOrderCb.<V>

    binarySortTree.inOrder(cb)

    inOrder

    Kind: instance method of BinarySortTree

    Param Type
    cb IOrderCb.<V>

    binarySortTree.postOrder(cb)

    postOrder

    Kind: instance method of BinarySortTree

    Param Type
    cb IOrderCb.<V>

    binarySortTree.clear()

    clear

    Kind: instance method of BinarySortTree

    ds/Graph

    Graph

    ds/Graph~Vertex

    Vertex

    Kind: inner class of ds/Graph

    ds/Graph~Edge

    Edge

    Kind: inner class of ds/Graph

    ds/Graph~Graph

    Kind: inner class of ds/Graph

    new Graph(_isDirected)

    Param Type Default
    _isDirected boolean false

    graph.vertexSize ⇒ number

    vertexSize

    Kind: instance property of Graph

    graph.edgeSize ⇒ number

    edgeSize

    Kind: instance property of Graph

    graph.isEmpty() ⇒ boolean

    isEmpty

    Kind: instance method of Graph

    graph.isDirected() ⇒ boolean

    isDirected

    Kind: instance method of Graph

    graph.getVertex(key) ⇒ Vertex.<K, V, E> | undefined

    getVertex

    Kind: instance method of Graph

    Param Type
    key K

    graph.setVertex(key, value) ⇒ Vertex.<K, V, E>

    setVertex

    Kind: instance method of Graph

    Param Type
    key K
    value V

    graph.removeVertex(key) ⇒ Vertex.<K, V, E> | undefined

    removeVertex

    Kind: instance method of Graph

    Param Type
    key K

    graph.getEdge(fromKey, toKey) ⇒ Edge.<K, V, E> | undefined

    getEdge

    Kind: instance method of Graph

    Param Type
    fromKey K
    toKey K

    graph.setEdge(fromKey, toKey, value) ⇒ Edge.<K, V, E> | undefined

    setEdge

    Kind: instance method of Graph

    Param Type
    fromKey K
    toKey K
    value E

    graph.removeEdge(fromKey, toKey) ⇒ Edge.<K, V, E> | undefined

    removeEdge

    Kind: instance method of Graph

    Param Type
    fromKey K
    toKey K

    graph.dfs(key, cb)

    dfs

    Kind: instance method of Graph

    Param Type
    key K
    cb IIterateCb.<K, V, E>

    graph.bfs(key, cb)

    bfs

    Kind: instance method of Graph

    Param Type
    key K
    cb IIterateCb.<K, V, E>

    graph.dijkstra(key, getWeight) ⇒ Dictionary.<K, number>

    dijkstra

    Kind: instance method of Graph

    Param Type
    key K
    getWeight IGetWeightCb.<E>

    graph.clear()

    clear

    Kind: instance method of Graph

    ds/Heap

    Heap

    ds/Heap~Heap

    Kind: inner class of ds/Heap

    heap.size ⇒ number

    size

    Kind: instance property of Heap

    heap.isEmpty() ⇒ boolean

    isEmpty

    Kind: instance method of Heap

    heap.push(value, priority)

    push

    Kind: instance method of Heap

    Param Type
    value T
    priority number

    heap.pop() ⇒ T | undefined

    pop

    Kind: instance method of Heap

    heap.top() ⇒ T | undefined

    top

    Kind: instance method of Heap

    heap.fit()

    fit

    Kind: instance method of Heap

    heap.clear()

    Clear the heap

    Kind: instance method of Heap

    ds/Queue

    Queue

    ds/Queue~Queue

    Kind: inner class of ds/Queue

    new Queue([arr])

    Param Type Default
    [arr] Array.<T> []

    queue.size ⇒ number

    size

    Kind: instance property of Queue

    queue.isEmpty() ⇒ boolean

    isEmpty

    Kind: instance method of Queue

    queue.enqueue(el) ⇒ this

    enqueue

    Kind: instance method of Queue

    Param Type
    el T

    queue.dequeue() ⇒ T | undefined

    dequeue

    Kind: instance method of Queue

    queue.first() ⇒ T | undefined

    Return the first element

    Kind: instance method of Queue

    queue.last() ⇒ T | undefined

    Return the last element

    Kind: instance method of Queue

    queue.clear()

    Clear the queue

    Kind: instance method of Queue

    ds/Set

    Set

    ds/Set~Set

    Kind: inner class of ds/Set

    new Set([arr])

    Param Type Default
    [arr] Array.<T> []

    set.size ⇒ number

    size

    Kind: instance property of Set

    set.isEmpty() ⇒ boolean

    isEmpty

    Kind: instance method of Set

    set.has(value) ⇒ boolean

    has

    Kind: instance method of Set

    Param Type
    value T

    set.add(value) ⇒ boolean

    add

    Kind: instance method of Set

    Param Type
    value T

    set.delete(value) ⇒ boolean

    delete

    Kind: instance method of Set

    Param Type
    value T

    set.values() ⇒ Array.<T>

    values Note: Return value is Set inner array

    Kind: instance method of Set

    set.clear()

    clear

    Kind: instance method of Set

    set.union(tar) ⇒ Set.<T>

    union

    Kind: instance method of Set

    Param Type
    tar Set.<T>

    set.intersect(tar) ⇒ Set.<T>

    intersect

    Kind: instance method of Set

    Param Type
    tar Set.<T>

    set.contain(tar) ⇒ boolean

    contain

    Kind: instance method of Set

    Param Type
    tar Set.<T>

    set.difference(tar) ⇒ Set.<T>

    difference

    Kind: instance method of Set

    Param Type
    tar Set.<T>

    ds/Stack

    Stack

    ds/Stack~Stack

    Kind: inner class of ds/Stack

    new Stack([arr])

    Param Type Default
    [arr] Array.<T> []

    stack.size ⇒ number

    size

    Kind: instance property of Stack

    stack.isEmpty() ⇒ boolean

    isEmpty

    Kind: instance method of Stack

    stack.push(value) ⇒ this

    push

    Kind: instance method of Stack

    Param Type
    value T

    stack.pop() ⇒ T | undefined

    pop

    Kind: instance method of Stack

    stack.top() ⇒ T | undefined

    Return the top element of the stack

    Kind: instance method of Stack

    stack.clear()

    Clear the stack

    Kind: instance method of Stack

    utils/clamp ⇒ number

    Clamps number within the inclusive lower and upper bounds.

    Returns: number - Returns the clamped number.

    Param Type Description
    num number The number to clamp.
    [lower] number The lower bound.
    upper number The upper bound.

    Example

    clamp(-10, -5, 5);
    // => -5
    
    clamp(10, -5, 5);
    // => 5

    utils/Compare

    Compare

    utils/Compare~Compare

    Kind: inner class of utils/Compare

    Compare.start([cb]) ⇒ TCompare

    Start compare, The method must be called at first

    Kind: static method of Compare

    Param Type Description
    [cb] ICompareCb If compare number array, You can not pass this parameter

    Compare.then([cb]) ⇒ TCompare

    Then compare

    Kind: static method of Compare

    Param Type Default
    [cb] ICompareCb giveBackCb

    Compare.reverse() ⇒ TCompare

    Reverse

    Kind: static method of Compare

    Compare.end() ⇒ ISortCb.<any>

    End compare, The method must be called at last

    Kind: static method of Compare

    utils/debounce ⇒ function

    debounce

    Param Type
    cb function
    delay number

    Example

    const d = debounce(console.log), 1000);
    d(1);d(1);d(1);
    // => 1

    utils/ellipsis ⇒ string

    String abbreviation with ellipsis

    Param Type Default
    str string
    num number
    [template] string "'...'"

    Example

    ellipsis('0123456789', 4);
    // => 0123...
    
    ellipsis('012', 4);
    // => 012

    utils/error

    Throw error

    Param Type
    msg string

    utils/format ⇒ string

    String format, just support %s, it's simple, but useful.

    Returns: string - Returns the formatted string.

    Param Type Description
    template string Text with placeholders for data.
    data * Data to interpolate into template.

    Example

    formats('The %s is %s.', 'code', 123);
    => The code is 123.

    utils/formats ⇒ string

    String format, just support %s, it's simple, but useful.

    Returns: string - Returns the formatted string.

    Param Type Description
    template string Text with placeholders for data.
    data Array.<any> Data to interpolate into template.

    Example

    formats('I like %s and %s.', ['swimming', 'skiing']);
    => I like swimming and skiing.

    utils/getClass ⇒ string

    Determine the internal JavaScript [[Class]] of an object.

    Returns: string - Object to get the internal JavaScript [[Class]] of.

    Param Type Description
    value * value The value to check.

    Example

    class Foo {
            private f: number = 1;
    }
    getClass(new Foo()) === Foo;
    // => true
    
    getClass(undefined) === undefined;
    // => true
    
    getClass(null) === null;
    // => true
    
    getClass(true) === Boolean;
    // => true
    
    getClass(new Boolean()) === Boolean;
    // => true
    
    getClass(3) === Number;
    // => true
    
    getClass("test") === String;
    // => true
    
    getClass(new String("test")) === String;
    // => true
    
    getClass(function(){}) === Function;
    // => true
    
    getClass([]) === Array;
    // => true
    
    getClass(new Array()) === Array;
    // => true
    
    getClass(new Date()) === Date;
    // => true
    
    getClass(new Error()) === Error;
    // => true
    
    getClass(Symbol()) === Symbol;
    // => true
    
    getClass(Object(Symbol())) === Symbol;
    // => true
    
    getClass(/test/) === RegExp;
    // => true
    
    getClass(Date) === Function;
    // => true
    
    getClass(Date) === Date;
    // => false

    utils/hashCode ⇒ number

    Get hash code from number or string.

    Param Type
    key NumOrStr

    Example

    hashCode(1001);
    // => 1507424
    
    hashCode('book');
    // => 3029737

    utils/inRange ⇒ boolean

    Checks if num is between start and end, such as start <= num <= end

    Returns: boolean - Returns true if number is in the range, else false.

    Param Type Description
    num number The number to check.
    start number The start of the range.
    end number The end of the range.

    Example

    inRange(3, 2, 4);
    // => true
    
    inRange(4.5, 2, 4.5);
    // => true
    
    inRange(-3, -6, -2);
    // => true

    utils/isArrayLike ⇒ boolean

    Checks if value is array-like. A value is considered array-like if it's not a function and not a window and has a value.length that's an integer greater than or equal to 0 and less than or equal to Number.MAX_SAFE_INTEGER.

    Returns: boolean - Returns true if value is array-like, else false.

    Param Type Description
    value * The value to check.

    Example

    isArrayLike([1, 2, 3]);
    // => true
    
    isArrayLike(document.body.children);
    // => true
    
    isArrayLike('abc');
    // => true
    
    isArrayLike(noop);
    // => false
    
    isArrayLike(window);
    // => false

    utils/isBool ⇒ boolean

    Checks if value is classified as a boolean primitive or object.

    Returns: boolean - Returns true if value is a boolean, else false.

    Param Type Description
    value * The value to check.

    Example

    isBool(false);
    // => true
    
    isBool(null);
    // => false

    utils/isClass ⇒ boolean

    Checks if value is classified as a Class primitive or object.

    Param Type Description
    value * The value to check.
    Class function Which class.

    Example

    isClass(Date, Function);
    // => true
    
    isClass(Date, Date);
    // => false
    
    isClass("test", String);
    // => true
    
    isClass(3, Number);
    // => true
    
    isClass(true, Boolean);
    // => true

    utils/isFunc ⇒ boolean

    Checks if value is classified as a Function object.

    Returns: boolean - Returns true if value is a function, else false.

    Param Type Description
    value * The value to check.

    Example

    isFunc(noop);
    // => true
    
    isFunc(/abc/);
    // => false

    utils/isInt ⇒ boolean

    Checks if value is an integer.

    Returns: boolean - Returns true if value is an integer, else false.

    Param Type Description
    value * The value to check.

    Example

    isInt(3);
    // => true
    
    isInt(3.3);
    // => false
    
    isInt(Number.MAX_VALUE);
    // => true
    
    isInt(Number.MIN_VALUE);
    // => false
    
    isInt(Infinity);
    // => false
    
    isInt('3');
    // => true

    utils/isLength ⇒ boolean

    Checks if value is a valid array-like length.

    Note: This method is loosely based on ToLength.

    Returns: boolean - Returns true if value is a valid length, else false.

    Param Type Description
    value * The value to check.

    Example

    isLength(3);
    // => true
    
    isLength(Number.MIN_VALUE);
    // => false
    
    isLength(Infinity);
    // => false
    
    isLength('3');
    // => false

    utils/isNum ⇒ boolean

    Checks if value is classified as a Number primitive or object.

    Returns: boolean - Returns true if value is a number, else false.

    Param Type Description
    value * The value to check.

    Example

    isNum(3);
    // => true
    
    isNum(Number.MIN_VALUE);
    // => true
    
    isNum(Infinity);
    // => true
    
    isNum('3');
    // => false

    utils/isObj ⇒ boolean

    Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))

    Returns: boolean - Returns true if value is an object, else false.

    Param Type Description
    value * The value to check.

    Example

    isObj({});
    // => true
    
    isObj([1, 2, 3]);
    // => true
    
    isObj(noop);
    // => true
    
    isObj(null);
    // => false

    utils/isObjLike ⇒ boolean

    Checks if value is object-like. A value is object-like if it's not null and has a typeof result of "object".

    Returns: boolean - Returns true if value is object-like, else false.

    Param Type Description
    value * The value to check.

    Example

    isObjLike({});
    // => true
    
    isObjLike([1, 2, 3]);
    // => true
    
    isObjLike(function(){});
    // => false
    
    isObjLike(null);
    // => false

    utils/isPlainObj ⇒ boolean

    Checks if value is a plain object, that is, an object created by the Object constructor or one with a [[Prototype]] of null.

    Returns: boolean - Returns true if value is a plain object, else false.

    Param Type Description
    value * The value to check.

    Example

    function Foo() {
      this.a = 1;
    }
    
    isPlainObj(new Foo);
    // => false
    
    isPlainObj([1, 2, 3]);
    // => false
    
    isPlainObj({ 'x': 0, 'y': 0 });
    // => true
    
    isPlainObj(Object.create(null));
    // => true

    utils/isStr ⇒ boolean

    Checks if value is classified as a String primitive or object.

    Returns: boolean - Returns true if value is a string, else false.

    Param Type Description
    value * The value to check.

    Example

    isStr('abc');
    // => true
    
    isStr(1);
    // => false

    utils/merge ⇒ T

    Merge the contents of a object into the first object.

    Returns: T - Returns object.

    Param Type Description
    tar T An object that will receive the new properties.
    src S An object containing additional properties to merge in.
    deep boolean If true, the merge becomes recursive (aka. deep copy). passing false for this argument is not supported, default is true.

    Example

    var object = {
      'a': [{ 'b': 2 }, { 'd': 4 }]
    };
    
    var other = {
      'a': [{ 'c': 3 }, { 'e': 5 }]
    };
    
    merge(object, other);
    // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }

    utils/mergeWith ⇒ T

    Merge the contents of a object into the first object by customizer.

    Returns: T - Returns object.

    Param Type Description
    tar T An object that will receive the new properties.
    src S An object containing additional properties to merge in.
    cb IMergeCb Customizer the function to customize assigned values, the prop will be skip when return value is undefined,
    deep boolean If true, the merge becomes recursive (aka. deep copy). passing false for this argument is not supported.

    Example

    function customizer(srcValue, tarValue) {
      if (Array.isArray(tarValue)) {
        return tarValue.concat(srcValue);
      }
    }
    
    var object = { 'a': [1], 'b': [2] };
    var other = { 'a': [3], 'b': [4] };
    
    mergeWith(object, other, customizer);
    // => { 'a': [1, 3], 'b': [2, 4] }

    utils/noop

    This method returns undefined.

    Example

    btn.onclick = fn || noop;
    // => undefined

    utils/random ⇒ number

    Produces a random number between the inclusive lower and upper bounds.

    Returns: number - Returns the random floating-point number.

    Param Type Description
    lower number The lower bound.
    upper number The upper bound.

    Example

    random(1, 5);
    // => a floating-point number between 1 and 5

    utils/repeat ⇒ string

    Repeats the given string n times.

    Returns: string - Returns the repeated string.

    Param Type Description
    str string The string to repeat.
    n number The number of times to repeat the string.

    Example

    repeat('*', 3);
    // => '***'
    
    repeat('abc', 2);
    // => 'abcabc'
    
    repeat('abc', 0);
    // => ''

    utils/throttle ⇒ function

    throttle

    Param Type
    cb function
    interval number

    Example

    const t = throttle(console.log, 1000);
    t(1);t(1);...a second...t(1);
    // => 1

    utils/toFixed ⇒ number

    Returns a number in fixed-point notation.

    Returns: number - Returns a number in fixed-point notation.

    Param Type Default Description
    num number The number to fixed.
    [fixed] number 0 Number of digits after the decimal point.

    Example

    toFixed(3.14);
    // => 3
    
    toFixed(3.1415926, 2);
    // => 3.14
    
    toFixed(3.1415926, 4);
    // => 3.1415

    Kind: global class

    cycleLinkList.addLast(value)

    addLast

    Kind: instance method of CycleLinkList

    Param Type
    value T

    cycleLinkList.remove(value) ⇒ number

    remove

    Kind: instance method of CycleLinkList

    Param Type
    value T

    cycleLinkList.insertAt(value, index) ⇒ boolean

    insertAt

    Kind: instance method of CycleLinkList

    Param Type
    value T
    index number

    cycleLinkList.removeAt(index) ⇒ T | null

    removeAt

    Kind: instance method of CycleLinkList

    Param Type
    index number

    Dictionary

    Kind: global class

    new Dictionary([obj])

    Param Type Default
    [obj] IKeyValue.<V> {}

    dictionary.size ⇒ number

    size

    Kind: instance property of Dictionary

    dictionary.fromObject(obj) ⇒ this

    Object transform to Dictionary

    Kind: instance method of Dictionary

    Param Type
    obj IKeyValue.<V>

    dictionary.toObject() ⇒ IKeyValue.<V>

    Dictionary transform to object Note: Return value is Dictionary inner object

    Kind: instance method of Dictionary

    dictionary.isEmpty() ⇒ boolean

    isEmpty

    Kind: instance method of Dictionary

    dictionary.has(key) ⇒ boolean

    has

    Kind: instance method of Dictionary

    Param Type
    key K

    dictionary.get(key) ⇒ V | undefined

    get

    Kind: instance method of Dictionary

    Param Type
    key K

    dictionary.set(key, value) ⇒ this

    set

    Kind: instance method of Dictionary

    Param Type
    key K
    value V

    dictionary.delete(key) ⇒ boolean

    delete

    Kind: instance method of Dictionary

    Param Type
    key K

    dictionary.keys() ⇒ Array.<string>

    keys

    Kind: instance method of Dictionary

    dictionary.values([values]) ⇒ Array.<V>

    values

    Kind: instance method of Dictionary

    Param Type Default
    [values] Array.<V> []

    dictionary.toString() ⇒ string

    toString

    Kind: instance method of Dictionary

    dictionary.clear()

    Clear the dictionary

    Kind: instance method of Dictionary

    DoubleLinkNode

    DoubleLinkNode

    Kind: global class

    Kind: global class

    doubleLinkList.size ⇒ number

    size

    Kind: instance property of DoubleLinkList

    doubleLinkList.isEmpty() ⇒ boolean

    isEmpty

    Kind: instance method of DoubleLinkList

    doubleLinkList.head() ⇒ DoubleLinkNode.<T> | null

    head

    Kind: instance method of DoubleLinkList

    doubleLinkList.tail() ⇒ DoubleLinkNode.<T> | null

    tail

    Kind: instance method of DoubleLinkList

    doubleLinkList.clear()

    clear

    Kind: instance method of DoubleLinkList

    doubleLinkList.addFirst(value)

    addFirst

    Kind: instance method of DoubleLinkList

    Param Type
    value T

    doubleLinkList.addLast(value)

    addLast

    Kind: instance method of DoubleLinkList

    Param Type
    value T

    doubleLinkList.insertAfter(value, curValue) ⇒ number

    insertAfter

    Kind: instance method of DoubleLinkList

    Param Type
    value T
    curValue T

    doubleLinkList.insertBefore(value, curValue) ⇒ number

    insertBefore

    Kind: instance method of DoubleLinkList

    Param Type
    value T
    curValue T

    doubleLinkList.remove(value) ⇒ number

    remove

    Kind: instance method of DoubleLinkList

    Param Type
    value T

    doubleLinkList.insertAt(value, index) ⇒ boolean

    insertAt

    Kind: instance method of DoubleLinkList

    Param Type
    value T
    index number

    doubleLinkList.removeAt(index) ⇒ T | null

    removeAt

    Kind: instance method of DoubleLinkList

    Param Type
    index number

    doubleLinkList.indexOf(value) ⇒ number

    indexOf

    Kind: instance method of DoubleLinkList

    Param Type
    value T

    doubleLinkList.includes(value) ⇒ boolean

    includes

    Kind: instance method of DoubleLinkList

    Param Type
    value T

    doubleLinkList.get(index) ⇒ T | null

    get

    Kind: instance method of DoubleLinkList

    Param Type
    index number

    LinkNode

    LinkNode

    Kind: global class

    Kind: global class

    linkList.size ⇒ number

    size

    Kind: instance property of LinkList

    linkList.isEmpty() ⇒ boolean

    isEmpty

    Kind: instance method of LinkList

    linkList.head() ⇒ LinkNode.<T> | null

    head

    Kind: instance method of LinkList

    linkList.clear()

    clear

    Kind: instance method of LinkList

    linkList.addFirst(value)

    addFirst

    Kind: instance method of LinkList

    Param Type
    value T

    linkList.addLast(value)

    addLast

    Kind: instance method of LinkList

    Param Type
    value T

    linkList.insert(value, preValue) ⇒ number

    insert

    Kind: instance method of LinkList

    Param Type
    value T
    preValue T

    linkList.remove(value) ⇒ number

    remove

    Kind: instance method of LinkList

    Param Type
    value T

    linkList.insertAt(value, index) ⇒ boolean

    insertAt

    Kind: instance method of LinkList

    Param Type
    value T
    index number

    linkList.removeAt(index) ⇒ T | null

    removeAt

    Kind: instance method of LinkList

    Param Type
    index number

    linkList.indexOf(value) ⇒ number

    indexOf

    Kind: instance method of LinkList

    Param Type
    value T

    linkList.includes(value) ⇒ boolean

    includes

    Kind: instance method of LinkList

    Param Type
    value T

    linkList.get(index) ⇒ T | null

    get

    Kind: instance method of LinkList

    Param Type
    index number

    List

    Kind: global class

    new List([arr])

    Param Type Default
    [arr] Array.<T> []

    list.size ⇒ number

    size

    Kind: instance property of List

    list.isEmpty() ⇒ boolean

    isEmpty

    Kind: instance method of List

    list.pos() ⇒ number

    pos

    Kind: instance method of List

    list.move(pos) ⇒ boolean

    move

    Kind: instance method of List

    Param Type
    pos number

    list.prev() ⇒ number | undefined

    prev

    Kind: instance method of List

    list.next() ⇒ number | undefined

    next

    Kind: instance method of List

    list.find(value) ⇒ number

    find

    Kind: instance method of List

    Param Type
    value T

    list.has(value) ⇒ boolean

    has

    Kind: instance method of List

    Param Type
    value T

    list.get(pos) ⇒ T | undefined

    get

    Kind: instance method of List

    Param Type
    pos number

    list.value() ⇒ T

    value

    Kind: instance method of List

    list.append(value)

    append

    Kind: instance method of List

    Param Type
    value T

    list.insertAt(pos, value) ⇒ boolean

    insertAt

    Kind: instance method of List

    Param Type
    pos number
    value T

    list.insert(value, curValue, insertAfter) ⇒ boolean

    insert

    Kind: instance method of List

    Param Type Default
    value T
    curValue T
    insertAfter boolean false

    list.removeAt(pos, howMany) ⇒ Array.<T>

    removeAt

    Kind: instance method of List

    Param Type Default
    pos number
    howMany number 1

    list.remove(value) ⇒ number

    remove

    Kind: instance method of List

    Param Type
    value T

    list.clear()

    clear

    Kind: instance method of List

    Map

    Kind: global class

    map.size ⇒ number

    size

    Kind: instance property of Map

    map.isEmpty() ⇒ boolean

    isEmpty

    Kind: instance method of Map

    map.keys() ⇒ Array.<K>

    keys

    Kind: instance method of Map

    map.values() ⇒ Array.<V>

    values

    Kind: instance method of Map

    map.has(key) ⇒ boolean

    has

    Kind: instance method of Map

    Param Type
    key K

    map.get(key) ⇒ V | undefined

    get

    Kind: instance method of Map

    Param Type
    key K

    map.set(key, value) ⇒ this

    set

    Kind: instance method of Map

    Param Type
    key K
    value V

    map.indexOf(key) ⇒ number

    indexOf

    Kind: instance method of Map

    Param Type
    key K

    map.delete(key) ⇒ boolean

    delete

    Kind: instance method of Map

    Param Type
    key K

    map.sortByKey(cb) ⇒ this

    sortByKey

    Kind: instance method of Map

    Param Type
    cb ISortCb.<K>

    map.sortByValue(cb) ⇒ this

    sortByValue

    Kind: instance method of Map

    Param Type
    cb ISortCb.<V>

    map.clear()

    Clear the map

    Kind: instance method of Map

    Iterator

    Kind: global class

    iterator.bind(owner, reverse) ⇒ this

    bind

    Kind: instance method of Iterator

    Param Type Default
    owner IIterator.<V, K>
    reverse boolean false

    iterator.reverse() ⇒ this

    reverse

    Kind: instance method of Iterator

    iterator.every(cb) ⇒ boolean

    every

    Kind: instance method of Iterator
    Returns: boolean - Returns true if all elements pass the predicate check, else false

    Param Type
    cb IFilterCb.<V, K>

    iterator.some(cb) ⇒ boolean

    some

    Kind: instance method of Iterator
    Returns: boolean - Returns true if any element passes the predicate check, else false

    Param Type
    cb IFilterCb.<V, K>

    iterator.forEach(cb)

    forEach

    Kind: instance method of Iterator

    Param Type Description
    cb IIterateCb.<V, K> Iteratee functions may exit iteration early by explicitly returning false

    iterator.map(cb) ⇒ Array.<T>

    map

    Kind: instance method of Iterator

    Param Type
    cb IMapCb.<V, K, T>

    iterator.filter(cb) ⇒ Array.<V>

    filter

    Kind: instance method of Iterator

    Param Type
    cb IFilterCb.<V, K>

    iterator.find(cb) ⇒ V | undefined

    find

    Kind: instance method of Iterator

    Param Type
    cb IFilterCb.<V, K>

    iterator.findIndex(cb) ⇒ number

    findIndex

    Kind: instance method of Iterator

    Param Type
    cb IFilterCb.<V, K>

    iterator.reduce(cb, init) ⇒ V | undefined

    reduce

    Kind: instance method of Iterator

    Param Type
    cb IReduceCb.<V, K, V>
    init V

    arraySwap(arr, i, j)

    Array elements swap.

    Kind: global function

    Param Type
    arr Array.<T>
    i number
    j number

    giveBackCb(args) ⇒ *

    giveBackCb

    Kind: global function

    Param Type
    args *

    iterate(obj, reverse) ⇒ Iterator.<V, K>

    iterate

    Kind: global function

    Param Type
    obj IIterator.<V, K>
    reverse boolean