Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

extra-generator

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extra-generator

```sh npm install --save extra-generator # or yarn add extra-generator ```

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
275
decreased by-87.29%
Maintainers
1
Weekly downloads
 
Created
Source

extra-generator

Install

npm install --save extra-generator
# or
yarn add extra-generator

API

handleYieldedValues

function handleYieldedValues<T, Return, Next>(
  generator: Generator<T, Return, Next>
, fn: (value: T, index: number) => Next
): Return

handleYieldedValuesAsync

function handleYieldedValuesAsync<T, Return, Next>(
  generator: Generator<T, Return, Next>
, fn: (value: T, index: number) => PromiseLike<Next>
): Promise<Return>
function handleYieldedValuesAsync<T, Return, Next>(
  generator: AsyncGenerator<T, Return, Next>
, fn: (value: T, index: number) => Awaitable<Next>
): Promise<Return>

of

function of<T>(val: T): IterableIterator<T>
of(1) // [1]

repeat

function repeat<T>(val: T, times: number = Infinity): IterableIterator<T>
repeat(1) // [1, 1, 1, ...]
repeat(1, 3) // [1, 1, 1]
repeat(1, 0) // []

countdown

function countdown(begin: number, end: number): IterableIterator<number>
countdown(2, -2) // [2, 1, 0, -1, -2]
countdown(1, 1) // [1]
countdown(0, 1) // []

countup

function countup(begin: number, end: number): IterableIterator<number>
countup(-2, 2) // [-2, -1, 0, 1, 2]
countup(1, 1) // [1]
countup(1, 0) // []

range

function range(start: number, end: number, step: number = 1): IterableIterator<number>
// assert(step > 0)
range(1, 1) // []
range(-2, 2) // [-2, -1, 0, 1]
range(2, -2) // [2, 1, 0, -1]
range(1, -1, 0.5) // [1, 0.5, 0, -0.5]
range(2, -2, 0) // throw Error
range(2, -2, -0.5) // throw Error

stringifyJSONStream

function stringifyJSONStream<T>(iterable: Iterable<T>): Iterable<string>

stringifyJSONStreamAsync

function stringifyNDJSONStreamAsync<T>(iterable: AsyncIterable<T>): AsyncIterable<string>

stringifyNDJSONStream

function stringifyNDJSONStream<T>(iterable: Iterable<T>): Iterable<string>

stringifyNDJSONStreamAsync

function stringifyNDJSONStreamAsync<T>(iterable: AsyncIterable<T>): AsyncIterable<string>

sse

interface IMessage {
  event?: string
  data: string
  id?: string
  retry?: number
}

function sse(message: IMessage): Iterable<string>

timestampBasedId

function timestampBasedId(): Iterator<[timestamp: number, num: number]>

ReusableIterable

interface IReusableIterable<T> extends Iterable<T> {
  close(): void
}

class ReusableIterable<T> implements IReusableIterable<T> {
  get done(): boolean | undefined

  constructor(iterable: Iterable<T>)

  close(): void
}

ReusableAsyncIterable

interface IReusableAsyncIterable<T> extends AsyncIterable<T> {
  close(): Promise<void>
}

class ReusableAsyncIterable<T> implements IReusableAsyncIterable<T> {
  get done(): boolean | undefined

  constructor(iterable: AsyncIterable<T>)

  close(): Promise<void>
}

ngrams

function ngrams(text: string, n: number): IterableIterator<string>

allNgrams

function allNgrams(text: string): IterableIterator<string>

Keywords

FAQs

Package last updated on 18 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc