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

@ilteoood/re-flusso

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ilteoood/re-flusso

Utility library to operate with JavaScript Streams API

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

image

re-flusso

re-flusso is an utility library to operate with JavaScript Streams API.

It aims to support browsers, Node.js and Edge Runtime.

Installation

NPM
npm install @ilteoood/re-flusso
PNPM
pnpm install @ilteoood/re-flusso

Usage

CommonJS

const { fromArray } = require('@ilteoood/re-flusso/fromArray');

Module

import { fromArray } from '@ilteoood/re-flusso/fromArray';

APIs

accumulator
import { accumulator } from '@ilteoood/re-flusso/accumulator';

const chunkSize = 3;

.pipeThrough(
    accumulator(chunkSize)
)
concat
import { concat } from '@ilteoood/re-flusso/concat';

concat(
    fromIterable([1]),
    fromIterable([2]),
    fromIterable([3])
)
defaultTo
import { defaultTo } from '@ilteoood/re-flusso/defaultTo';

await pipeline(
    fromIterable([null, undefined]),
    defaultTo(1),
    toIterable([])
)
text
import { text } from '@ilteoood/re-flusso/fetch/text';

const response = await fetch('...')

text(response)
filter
import { filter } from '@ilteoood/re-flusso/filter';

.pipeThrough(
    filter((value, index) => value % index === 0)
)
first
import { first } from '@ilteoood/re-flusso/first';

const firstItemsToKeep = 3;

.pipeThrough(
    first(firstItemsToKeep)
)
fromIterable
import { fromIterable } from '@ilteoood/re-flusso/fromIterable';

// With an array
fromIterable([1, 2, 3])

// With a set
fromIterable(new Set([1, 2, 3]))
last
import { last } from '@ilteoood/re-flusso/last';

const lastItemsToKeep = 3;

.pipeThrough(
    last(lastItemsToKeep)
)
map
import { map } from '@ilteoood/re-flusso/map';

.pipeThrough(
    map((value, index) => value + index)   
)
merge
import { merge } from '@ilteoood/re-flusso/merge';

merge(
    fromIterable([1]),
    fromIterable([2]),
    fromIterable([3])
)
ndJson
    parse
import { parse } from '@ilteoood/re-flusso/ndJson/parse';

.pipeThrough(
    parse()
)
    stringify
import { stringify } from '@ilteoood/re-flusso/ndJson/stringify';

.pipeThrough(
    stringify()
)
notEmpty
import { notEmpty } from '@ilteoood/re-flusso/notEmpty';

const errorToThrow = new Error('Stream is empty');

.pipeThrough(
    notEmpty(errorToThrow)
)
numbers
    fromRange
import { fromRange } from '@ilteoood/re-flusso/numbers/fromRange';

fromRange(1, 3)
    greaterThan
import { greaterThan } from '@ilteoood/re-flusso/numbers/greaterThan';

greaterThan(3)
    greaterThanEqual
import { greaterThanEqual } from '@ilteoood/re-flusso/numbers/greaterThanEqual';

greaterThanEqual(3)
    lessThan
import { lessThan } from '@ilteoood/re-flusso/numbers/lessThan';

lessThan(3)
    lessThan
import { lessThanEqual } from '@ilteoood/re-flusso/numbers/lessThanEqual';

lessThanEqual(3)
pipeline
import { pipeline } from '@ilteoood/re-flusso/pipeline';

const destinationArray = [];

await pipeline(
    fromIterable([1, 2, 3]),
    map((value) => value * 2),
    toArray(destinationArray),
);
reduce
import { reduce } from '@ilteoood/re-flusso/reduce';

const destinationArray = [];

await pipeline(
    fromIterable([1, 2, 3]),
    reduce((accumulator, value) => accumulator + value, 0),
    toArray(destinationArray),
);
repeat
import { repeat } from '@ilteoood/re-flusso/repeat';

repeat('1', 3)
skip
import { skip } from '@ilteoood/re-flusso/skip';

const itemsToSkip = 2;

.pipeTo(
    skip(itemsToSkip)
)
strings
    join
import { join } from '@ilteoood/re-flusso/strings/join';

const separator = ',';

.pipeThrough(
    join(separator)
)

    split
import { split } from '@ilteoood/re-flusso/strings/split';

const separator = ',';

.pipeTo(
    split(separator)
)
    toLowerCase
import { toLowerCase } from '@ilteoood/re-flusso/strings/toLowerCase';

.pipeThrough(
    toLowerCase(separator)
)

    toUpperCase
import { toUpperCase } from '@ilteoood/re-flusso/strings/toUpperCase';

.pipeThrough(
    toUpperCase(separator)
)

toArray
import { toArray } from '@ilteoood/re-flusso/toArray';

const destinationArray = [];

.pipeTo(
    toArray(destinationArray)
)

Acknowledgements

This project was kindly sponsored by Nearform.

Keywords

FAQs

Package last updated on 31 May 2024

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