JSPM

@rxjs-ninja/rxjs-string

5.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 20
  • Score
    100M100P100Q55465F
  • License MIT

Operators for handling RxJS Observable of string

Package Exports

  • @rxjs-ninja/rxjs-string
  • @rxjs-ninja/rxjs-string/rxjs-string.esm.js
  • @rxjs-ninja/rxjs-string/rxjs-string.umd.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@rxjs-ninja/rxjs-string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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`