Answers for "rxjs map"

1

rxswift map

func transformUsingMap() -> Observable<String> {
    return Observable.of(1, 2, 3)
        .map { String("\($0)") }
}

func arrayToNewObject(items: [Item]) -> [Data] {
   return items.map({ item in 
                   return Data(item)
       })
}
Posted by: Guest on September-17-2020
0

rxjs map

// RxJS v6+
import { from } from 'rxjs';
import { map } from 'rxjs/operators';

//emit (1,2,3,4,5)
const source = from([1, 2, 3, 4, 5]);
//add 10 to each value
const example = source.pipe(map(val => val + 10));
//output: 11,12,13,14,15
const subscribe = example.subscribe(val => console.log(val));
Posted by: Guest on June-12-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language