main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
738 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { _Negate } from './Negate';
|
---|
| 2 | import { _IsNegative } from './IsNegative';
|
---|
| 3 | import { IterationOf } from '../Iteration/IterationOf';
|
---|
| 4 | import { Iteration } from '../Iteration/Iteration';
|
---|
| 5 | /**
|
---|
| 6 | * @hidden
|
---|
| 7 | */
|
---|
| 8 | export declare type _Absolute<N extends Iteration> = {
|
---|
| 9 | 0: N;
|
---|
| 10 | 1: _Negate<N>;
|
---|
| 11 | }[_IsNegative<N>];
|
---|
| 12 | /**
|
---|
| 13 | * Get the absolute value of a [[Number]]
|
---|
| 14 | * @param N to absolute
|
---|
| 15 | * @returns `string | number | boolean`
|
---|
| 16 | * @example
|
---|
| 17 | * ```ts
|
---|
| 18 | * import {N} from 'ts-toolbelt'
|
---|
| 19 | *
|
---|
| 20 | * type test0 = N.Absolute<'-20'> // '20'
|
---|
| 21 | *
|
---|
| 22 | * type test1 = N.Absolute<'-20', 's'> // '20'
|
---|
| 23 | * type test2 = N.Absolute<'-20', 'n'> // 20
|
---|
| 24 | * ```
|
---|
| 25 | */
|
---|
| 26 | export declare type Absolute<N extends number> = N extends unknown ? _Absolute<IterationOf<N>>[0] : never;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.