Range
PackagesGitHub
Draft
Draft
  • Introduction
  • ❤ Benefits
  • General concepts
  • Getting started
    • Skeleton
    • Installation
      • npm
    • Public API
    • Basic concepts
  • Greater {}
    • Overview
    • Generic type variables
    • ★ Constructor
    • Accessors
      • get [Symbol.toStringTag]()
    • Methods
      • static create()
      • static isGreater()
      • than()
      • thanEvery()
      • thanSome()
      • valueOf()
  • Inequality {}
    • Overview
    • Generic type variables
    • Constructor
    • Accessors
      • get greater()
      • get less()
    • Properties
      • #greater
      • #less
    • Methods
      • greaterThan()
      • greaterThanEvery()
      • greaterThanSome()
      • lessThan()
      • lessThanEvery()
      • lessThanSome()
  • Less {}
    • Overview
    • Generic type variables
    • ★ Constructor
    • Accessors
      • get [Symbol.toStringTag]()
    • Methods
      • static create()
      • static isLess()
      • than()
      • thanEvery()
      • thanSome()
      • valueOf()
    • Example usage
  • Maximum {}
    • Overview
    • Generic type variables
    • ★ Constructor
    • Accessors
      • get [Symbol.toStringTag]()
    • Methods
      • static create()
      • static isMaximum()
      • valueOf()
  • Minimum {}
    • Overview
    • Generic type variables
    • ★ Constructor
    • Accessors
      • get [Symbol.toStringTag]()
    • Methods
      • static create()
      • static isMinimum()
      • valueOf()
  • Number {}
    • Overview
    • Generic type variables
    • ★ Constructor
    • Methods
      • static create()
      • static isNumber()
      • valueOf()
  • Range {}
    • Overview
    • Generic type variables
    • ★ Constructor
    • Accessors
      • get range()
      • get step()
      • get steps()
      • value()?
      • get [Symbol.toStringTag]()
    • Properties
      • max!
      • min!
      • #maximum
      • #minimum
      • #step
      • #value?
    • Methods
      • ↓ Static
      • static create()
      • static createFrom()
      • static createMaximum()
      • static createMinimum()
      • static isRange()
      • ↓ Instance
      • forEachStep()
      • getCurrentRange()
      • getCurrentStep()
      • ⚠ getMax()
      • ⚠ getMin()
      • getRange()
      • getRangeOfStep()
      • getValueOfStep()
      • has()
      • hasEvery()
      • hasSome()
      • isBetween()
      • isBetweenEvery()
      • isBetweenSome()
      • maxGreaterThan()
      • maxLessThan()
      • minGreaterThan()
      • minLessThan()
      • setValue()
      • setValueToStep()
      • stepByStep()
      • ⚠ toArray()
      • valueDown()
      • ⚠ valueOf()
      • valueUp()
  • Change log
    • Keep a changelog
    • CHANGELOG.md
    • v1.0.0-rc.0
    • v1.0.0-rc
    • v1.0.0-beta.0
  • GIT
    • Commit
    • Semantic Versioning
  • License
    • MIT
  • Social
    • Gettr
    • Twitter
    • YouTube
  • Contact
    • ⋯ Chat
    • @ Email
    • ✆ Phone
  • Donate
    • ฿ Cryptocurrency
    • $ Fiat
Powered by GitBook
On this page
  • Range.createFrom()
  • Generic type variables
  • Parameters
  • Return type
  • Returns
  • Example usage
Edit on GitHub
  1. Range {}
  2. Methods

static createFrom()

Creates the `Range` instance from the given random numbers and the step

Previousstatic create()Nextstatic createMaximum()

Last updated 3 years ago

Range.createFrom()

Creates the instance from the given random and the .

range.class.ts
public static createFrom<Step extends number = 1>(
  numbers: number[],
  step: Step = 1 as Step
): Range<number, number, Step> {
  return Range.create(
    Math.min.apply(0, numbers),
    Math.max.apply(0, numbers),
    step
  );
}

Generic type variables

Stepextends= 1

A generic type variable constrained by the , by default of the value equal to 1, optionally captured from the supplied indicates the range step type of a new instance.

Parameters

step:Step

Return type

Returns

Example usage

// Example usage.
import { Range } from '@angular-package/range';

// Returns Range {min: 4, max: 27} of type Range<number, number, 1>.
Range.createFrom([12, 14, 5, 23, 14, 27, 17, 4, 11, 12]);

// Returns Range {min: 4, max: 27} of type Range<number, number, 1.5>.
Range.createFrom([12, 14, 5, 23, 14, 27, 17, 4, 11, 12]);

numbers:[]

An of numbers to find a range and create a new instance.

Optional step of generic type variable to set with a new instance, by default 1.

<,,>

The return type is the object that takes generic type variable .

The return value is the instance created from the given required random and the optional .

number
Array
Range
number
number
Range
numbers
step
step
Range
Step
Range
number
number
Step
Range
Step
Range
numbers
step