New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@rxjs-ninja/rxjs-string

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rxjs-ninja/rxjs-string

Operators for handling RxJS Observable of string

latest
Source
npmnpm
Version
5.0.3
Version published
Maintainers
1
Created
Source

RxJS Ninja - Strings

The RXJS Ninja Logo

rxjs-string

Website | API Documentation | Changelog

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

Function and Operator categories

Convert

Convert between String and Array values

// Split comma-seperated list into tab seperated list
of('Jane,Rod,Freddy,George').pipe(split(','), join('\t')).subscribe();
// Output: `'Jane\tRod\tFreddy\tGeorge'`

Create

Functions to create strings from various input

// Create a string from an array of codepoints
fromCodePoint([9731, 9733, 9842]).subscribe();
// Output: `'☃★♲'`

Filter

Operators for filtering string based on passed conditions

const source$ = from(['RxJS', 'TypeScript', 'Angular', 'HorseJS', 'JS Weekly']);

// Get items from the source that only end in `JS`
source$.pipe(filterStartsWith('JS')).subscribe();
// Output: `'JS Weekly'`

// Get items from the source that only end in `JS`
source$.pipe(filterEndsWith('JS')).subscribe();
// Output: `'RxJS', 'HorseJS'`

Mapping

Operators for mapping codes to String values

// Get the string character for a code point
from([9731, 9733, 9842]).pipe(mapCodePoint()).subscribe();
// Output: `'☃', '★', '♲'`

Modify

Operators for modifying String values

const source$ = from(['RxJS', 'Angular', 'TypeScript', 'jQuery']);

// Concat to an string
source$.pipe(concat(' is cool')).subscribe();
// Output: `'RxJS is cool', 'Angular is cool', 'TypeScript is cool', 'jQuery is cool'`

source$.pipe(reverse()).subscribe();
// Output: `'SJxR', 'ralugnA', 'tpircSepyT`, 'yreuQj'`

Query

Operators for querying String values and returning a value based on a boolean check

  • Query - Operators that return non-string values based on querying string values
const source$ = from(['RxJS', 'TypeScript', 'Angular', 'HorseJS', 'JS Weekly']);

// Check the string starts with `JS`
source$.pipe(startWith('JS')).subscribe();
// Output: `false, false, false, false, true`

// Check the string ends with `JS`
source$.pipe(endsWith('JS')).subscribe();
// Output: `true, false, false, true, false`

Keywords

Rx

FAQs

Package last updated on 18 Nov 2022

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