Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

Functions

Const addProp

  • addProp<T>(prop: keysWithType<T, number> | keysWithType<T, number>[], defaultValue: number, startValue: number, ...inputs: (T | Readonly<T>)[]): number
  • description

    Add multiple properties togethor to calculate a number. inputs is a sweeper.

    example

    import { addProp } from 'tyvn';

    addProp<{ one: number, two: number }>(['one', 'two'], 5, { one: 1, two: 2 }); // 3 addProp<{ one: number, two: number }>('one', 5, { one: 1, two: 2 }); // 1 addProp<{ one: number, two: number }>(['one', 'two'], 5, { one: 1, two: 'Hello world!' }); // 6 addProp<{ one: number; two: number }>(['one', 'two'], 5, 0, { one: 6, two: 3 }, { one: 9, two: 12 }); // 30

    Type parameters

    • T

    Parameters

    • prop: keysWithType<T, number> | keysWithType<T, number>[]

      The property that should be called on the object. Can be an array.

    • defaultValue: number

      The default value it'll fallback to if one of the properties doesn't exist.

    • startValue: number

      The base value.

    • Rest ...inputs: (T | Readonly<T>)[]

      Objects that'll be inputted. It is a sweeper functions so you can add in however much you'd like.

    Returns number

Legend

  • Interface
  • Interface with type parameter
  • Function with type parameter

Generated using TypeDoc, the 2/8/2021 at 8:46:57 AM