import { map , share } from 'rxjs/operators' ; import emission from '../shared/emission' ; import createRandomTag from '../util/random-tag' ; import { Pipe } from './pipe' ; const _DefaultForkTagLength = 10 ; /**
 *
 * Represents [fork](https://connective.dev/docs/fork) pins.
 *
 */ export class Fork extends Pipe { constructor ( len = _DefaultForkTagLength ) { super ( [ map ( e => { let __fork = < string [ ] > [ ] . concat ( e . context . __fork || [ ] ) ; __fork . push ( Fork . _create_fork_tag ( len ) ) ; return emission ( e . value , Object . assign ( { } , e . context , { __fork } ) ) ; } ) , share ( ) , ] ) ; } private static _create_fork_tag ( len = _DefaultForkTagLength ) { return createRandomTag ( len ) ; } } param len export function fork ( len = _DefaultForkTagLength ) { return new Fork ( len ) ; } export default fork ;