tstosc
Version:
A transpiler that convert TypeScript to SuperCollider's SCLang.
63 lines (60 loc) • 2.84 kB
text/typescript
import ts from 'typescript';
/**
* @param n Number to be shown in binary form.
* @returns Binary expression of `n` in string, starting with `0b`.
*/
declare function bin(n: number): string;
declare enum ZipOption {
/** Take the shortest length of two arrays. */
minimal_zip = "minimal_zip",
/** Based on the length of accepting side (`a1`). */
accepting_side_length = "accepting_side_length",
/** Based on the length of donating side (`a2`). */
donating_side_length = "donating_side_length"
}
/**
*
* @param a1 The array accepting incoming element.
* @param a2 The array donating element.
* @returns The zipped array, length based on accepting side.
*/
declare function zip<A1ElemType, A2ElemType>(a1: ArrayLike<A1ElemType>, a2: ArrayLike<A2ElemType>): [A1ElemType, A2ElemType | undefined][];
/**
*
* @param a1 The array accepting incoming element.
* @param a2 The array donating element.
* @returns The zipped array.
*/
declare function zip<A1ElemType, A2ElemType>(a1: ArrayLike<A1ElemType>, a2: ArrayLike<A2ElemType>, option: ZipOption.accepting_side_length): [
A1ElemType,
A2ElemType | undefined
][];
/**
*
* @param a1 The array accepting incoming element.
* @param a2 The array donating element.
* @returns The zipped array.
*/
declare function zip<A1ElemType, A2ElemType>(a1: ArrayLike<A1ElemType>, a2: ArrayLike<A2ElemType>, option: ZipOption.donating_side_length): [
A1ElemType | undefined,
A2ElemType
][];
/**
*
* @param a1 The array accepting incoming element.
* @param a2 The array donating element.
* @returns The zipped array.
*/
declare function zip<A1ElemType, A2ElemType>(a1: ArrayLike<A1ElemType>, a2: ArrayLike<A2ElemType>, option: ZipOption.minimal_zip): [
A1ElemType,
A2ElemType
][];
declare function bifilter<ElemType, SubElemType extends ElemType>(arr: ArrayLike<ElemType>, predicate: (element: ElemType, index: number, arr: ArrayLike<ElemType>) => element is SubElemType): [SubElemType[], ElemType[]];
declare function bifilter<ElemType, SubElemType extends ElemType>(arr: ArrayLike<ElemType>, predicate: (element: ElemType, index: number, arr: ArrayLike<ElemType>) => unknown): [ElemType[], ElemType[]];
declare function memorised<FunctionType extends (...args: any[]) => any>(f: FunctionType, makeKey?: (...args: Parameters<FunctionType>) => any): (...args: Parameters<FunctionType>) => ReturnType<FunctionType>;
declare function hash(e: ts.Node): string;
declare function isArrayLike(obj: Object): obj is ArrayLike<any>;
declare function isArrayLike<EleType>(obj: Array<EleType>): obj is EleType[];
declare function isArrayLike<EleType>(obj: ReadonlyArray<EleType>): obj is EleType[];
declare function isArrayLike<EleType>(obj: ArrayLike<EleType>): obj is ArrayLike<EleType>;
export { ZipOption, bifilter, bin, hash, isArrayLike, memorised, zip };