-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from mstar-kk/master
Add type definitions file index.d.ts
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.idea | ||
coverage/ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Type definitions for biguint-format | ||
// Project: biguint-format https://github.com/T-PWK/flake-idgen | ||
// Definitions by: m-star https://github.com/mstar-kk | ||
|
||
/// <reference types="node" /> | ||
|
||
interface FORMATS { | ||
dec: typeof toDecimalString; | ||
hex: typeof toHexString; | ||
bin: typeof toBinaryString; | ||
oct: typeof toOctetString; | ||
} | ||
|
||
interface formatOption { | ||
format?: string; | ||
groupsize?: number; | ||
delimiter?: string; | ||
padstr?: string; | ||
size?: number; | ||
trim?: boolean; | ||
prefix?: string; | ||
} | ||
|
||
export default function ( | ||
buffer: Buffer, | ||
base: 'dec' | 'hex' | 'bin' | 'oct', | ||
options?: formatOption | ||
): string; | ||
|
||
export function createBuffer(size: number): Buffer; | ||
|
||
export function createBufferFrom(object: object): Buffer; | ||
|
||
export function toDecimalString(buffer: Buffer, options?: formatOption): string; | ||
|
||
export function toBinaryString(buffer: Buffer, options?: formatOption): string; | ||
|
||
/* | ||
* Converts given input (node Buffer or array of bytes) to hexadecimal string 0xDDDD where D is [0-9a-f]. | ||
* All leading 0's are stripped out i.e. [0x00, 0x00, 0x00, 0x01] -> '0x1' | ||
*/ | ||
export function toHexString(buffer: Buffer, options?: formatOption): string; | ||
|
||
export function toOctetString(buffer: Buffer, options?: formatOption): string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters