@yookue/ts-lang-utils
    Preparing search index...

    Function toInteger

    • Returns an integer value from the given source

      Parameters

      • Optionalsource: null | string | number

        the source value to inspect

      • OptionaldefaultValue: number

        the default value if the source cannot be converted

      • floorValue: boolean = true

        Whether to floor the source, otherwise to ceil

      Returns undefined | number

      an integer value from the given source

      David Hsing

      toInteger('1');    // 1
      toInteger(1.3); // 1
      toInteger('1.7', undefined, false); // 2