0.0.1-alpha.6 • Published 2 years ago
unsplash-ts-fp v0.0.1-alpha.6
Unsplash FP
Functional Unasplash api client
Playground
You can build the example via the build:example
NPM script.
Then run via node example/build
Example Snippet
View more in the examples folder
import { pipe } from 'fp-ts/lib/function'; import * as E from 'fp-ts/Either' import * as TE from 'fp-ts/TaskEither' import * as A from 'fp-ts/Array'
import Unsplash from '@rawnly/unsplash-fp-ts';
const unsplash = new Unsplash( '' )
const getRandomIds = pipe( { count: 5 }, unsplash.photos.random, TE.map(A.map(photo => photo.id)) )
;(async () => { const result = await getRandomIds();
if ( E.isRight(result) ) {
const { right: ids } = result;
console.log(ids) // => string[]
} else {
console.error('Error', result.left)
}
})()
0.0.1-alpha.6
2 years ago
0.0.1-alpha.5
3 years ago
0.0.1-alpha.4
3 years ago
0.0.1-alpha.3
3 years ago
0.0.1-alpha.2
3 years ago
0.0.1-alpha.1
3 years ago