@types/array-polar
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Installation

npm install --save @types/array-polar

Summary

This package contains type definitions for array-polar (https://github.com/dfcreative/array-polar#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/array-polar.

index.d.ts

export = toPolar;

/**
 * Convert array with cartesian coordinates to polar.
 *
 * `array` is modified in-place, so do slice if you need immutable behaviour.
 *
 * @param array A 2-dimensional array with `[x, y, x, y, ...]` layout.
 * @param [center=[0,0]] The center point to convert the `array`, so that result is `[r, θ, r, θ, ...]` `array`.
 * You may want to calculate `center` as average or median of data.
 *
 * @example
 * import polar = require('array-polar')
 *
 * const polarCoords = polar([0,1, 1,0]) // [1,0, 1,Math.PI/2]
 */
declare function toPolar<TArr extends MutableArrayLike<number>>(array: TArr, center?: readonly [number, number]): TArr;

declare namespace toPolar {
    const polar: typeof toPolar;
    /**
     * Convert array with polar coordinates to cartesian.
     *
     * `array` is modified in-place, so do slice if you need immutable behaviour.
     *
     * @param array A 2-dimensional array with `[x, y, x, y, ...]` layout.
     * @param [center=[0,0]] The center point to convert the `array`, so that result is `[r, θ, r, θ, ...]` `array`.
     * You may want to calculate `center` as average or median of data.
     *
     * @example
     * import polar = require('array-polar')
     *
     * const cartesianCoords = polar.cartesian([1,0, 1,Math.PI/2]) // [0,1, 1,0]
     */
    function cartesian<TArr extends MutableArrayLike<number>>(array: TArr, center?: readonly [number, number]): TArr;
}

interface MutableArrayLike<T> {
    length: number;
    [n: number]: T;
}

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:04 GMT
  • Dependencies: none

Credits

These definitions were written by BendingBender.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/array-polar

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

5.6 kB

Total Files

5

Last publish

Collaborators

  • types