@rxjs-ninja/rxjs-boolean
@rxjs-ninja/rxjs-boolean
npm i @rxjs-ninja/rxjs-boolean
@rxjs-ninja/rxjs-boolean

@rxjs-ninja/rxjs-boolean

RxJS Operators for handling Observable strings, numbers, booleans and more

by rxjs-ninja

4.0.3 (see all)License:MITTypeScript:Built-In
npm i @rxjs-ninja/rxjs-boolean
Readme

RxJS Ninja - Booleans

The RXJS Ninja Logo

rxjs-boolean

Website | API Documentation | Changelog

@rxjs-ninja/rxjs-boolean provides operators for querying, filtering and modifying boolean values, and Observable for generating boolean emitters.

Function and Operator categories

Create

Functions and Operators for creating Observable boolean values

const numbers = [0, 1, 0, 0, 1, 0, 1];
const strings = ['RxJS', '', '', 'Ninja', 'TypeScript'];

// Generate a boolean array from numbers
fromBoolean(numbers).subscribe();
// Output: `false, true, false, false, true, false, true`

// Generate a boolean array from numbers
fromBoolean(strings).subscribe();
// Output: `true, false, false, true, true`

Filter

Operators for filtering Observable sources for truthy values

const strings$ = from(['RxJS', '', '', 'Ninja', 'TypeScript', '', 'Angular']);

// Get the first truthy value
strings$.pipe(firstTruthy()).subscribe();
// Output: `RxJS`

// Get the first truthy value that is over length of 6
strings$.pipe(firstTruthy((v) => v.length > 5)).subscribe();
// Output: `TypeScript`

// Get the last truthy value
strings$.pipe(lastTruthy()).subscribe();
// Output: `Angular`

// Get the last truthy value of less than 5 characters
strings$.pipe(lastTruthy((v) => v.length < 5)).subscribe();
// Output: `RxJS`

Modify

Operators for modifying boolean values

const source$ = from([false, true, true, false]);

// Flip the boolean value
source$.pipe(flip()).subscribe();
// Output: `true, false, false, true`

Validation

Operators that provide boolean output based on checks against source values

const input = ['4485275742308327', '1111222233334444', '111133332224444'];
from(input).pipe(luhnCheck()).subscribe();
// Output: `[true, true, false]`

Downloads/wk

52

GitHub Stars

72

LAST COMMIT

10mos ago

MAINTAINERS

1

CONTRIBUTORS

3

OPEN ISSUES

2

OPEN PRs

0
VersionTagPublished
4.0.3
latest
16d ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate