-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
featureNew functionality or improvementNew functionality or improvement
Description
I am currently using the following to type @hapi/nigel. It would be nice if this module exported its own types. I d'ont have the time or resources to make a PR. Sorry about that.
// types.d.ts
declare module '@hapi/nigel' {
import { Writable } from 'node:stream'
export interface Haystack {
readonly length: number
readUInt8: (pos: number) => number | undefined
startsWith?: (value: Buffer, pos?: number, length?: number) => boolean
}
export interface Needle {
readonly value: Buffer
readonly lastPos: number
readonly last: number
readonly length: number
readonly badCharShift: Buffer
}
export function compile(needle: Buffer): Needle
export function horspool(haystack: Haystack, needle: Needle | Buffer, start?: number): number
export function all(haystack: Haystack, needle: Needle | Buffer, start?: number): number[]
export class Stream extends Writable {
constructor(needle: Buffer)
needle(needle: Buffer): void
flush(): void
}
}Metadata
Metadata
Assignees
Labels
featureNew functionality or improvementNew functionality or improvement