The StringStream is a Stream that provides string-related methods.
Returns a StringStream that trims the produced output. (Mdn Docs)
import {text} from '@fluentfixture/core';
const stream = text(' text ').trim();
console.log(stream.single());
// 'text'Returns a StringStream that trims (from the start) the produced output. (Mdn Docs)
import {text} from '@fluentfixture/core';
const stream = text(' text ').trimStart();
console.log(stream.single());
// 'text 'Returns a StringStream that trims (from the end) the produced output. (Mdn Docs)
import {text} from '@fluentfixture/core';
const stream = text(' text ').trimEnd();
console.log(stream.single());
// ' text'Returns a StringStream that add pads (from the start) to the produced output. (Mdn Docs)
| Parameter | Type | Default | Description |
|---|---|---|---|
length |
Integer |
target length | |
char |
String |
' ' |
pad string |
import {text} from '@fluentfixture/core';
const stream = text('text').padStart(7, '#');
console.log(stream.single());
// '###text'Returns a StringStream that add pads (from the end) to the produced output. (Mdn Docs)
| Parameter | Type | Default | Description |
|---|---|---|---|
length |
Integer |
target length | |
char |
String |
' ' |
pad string |
import {text} from '@fluentfixture/core';
const stream = text('text').padEnd(7, '#');
console.log(stream.single());
// 'text###'Returns an ArrayStream that produces the split output. (Mdn Docs)
| Parameter | Type | Default | Description |
|---|---|---|---|
separator |
String or RegExp |
separator | |
limit |
Integer |
0 |
split limit |
import { text } from '@fluentfixture/core';
const stream = text('1,2,3')
.split(',')
.map(i => `#${i}`)
console.log(stream.single());
// ['#1', '#2', '#3']Returns a StringStream that converts the produced output to the lower case. (Mdn Docs)
import { text } from '@fluentfixture/core';
const stream = text('HELLO').lowerCase();
console.log(stream.single());
// 'hello'Returns a StringStream that converts the produced output to the upper case. (Mdn Docs)
import { text } from '@fluentfixture/core';
const stream = text('hello').upperCase();
console.log(stream.single());
// 'HELLO'Returns a StringStream that converts the produced output to the camel case. (Library Docs)
import { text } from '@fluentfixture/core';
const stream = text('hello world').camelCase();
console.log(stream.single());
// 'helloWorld'Returns a StringStream that converts the produced output to the capital case. (Library Docs)
import { text } from '@fluentfixture/core';
const stream = text('hello world').capitalCase();
console.log(stream.single());
// 'Hello World'Returns a StringStream that converts the produced output to the constant case. (Library Docs)
import { text } from '@fluentfixture/core';
const stream = text('hello world').constantCase();
console.log(stream.single());
// 'HELLO_WORLD'Returns a StringStream that converts the produced output to the path case. (Library Docs)
import { text } from '@fluentfixture/core';
const stream = text('hello world').pathCase();
console.log(stream.single());
// 'hello/world'Returns a StringStream that converts the produced output to the dot case. (Library Docs)
import { text } from '@fluentfixture/core';
const stream = text('hello world').dotCase();
console.log(stream.single());
// 'hello.world'Returns a StringStream that converts the produced output to the header case. (Library Docs)
import { text } from '@fluentfixture/core';
const stream = text('hello world').headerCase();
console.log(stream.single());
// 'Hello-World'Returns a StringStream that converts the produced output to the param case. (Library Docs)
import { text } from '@fluentfixture/core';
const stream = text('hello world').paramCase();
console.log(stream.single());
// 'hello-world'Returns a StringStream that converts the produced output to the pascal case. (Library Docs)
import { text } from '@fluentfixture/core';
const stream = text('hello world').pascalCase();
console.log(stream.single());
// 'HelloWorld'Returns a StringStream that converts the produced output to the snake case. (Library Docs)
import { text } from '@fluentfixture/core';
const stream = text('hello world').snakeCase();
console.log(stream.single());
// 'hello_world'