UNPKG

@skele/classic

Version:

Skele is an architectural framework that assists with building data-driven apps with React or React Native.

42 lines (29 loc) 819 B
# Data Utility functions for easier handling and processing of data. ## `flow(value, ...fns)` Executes a function composition on a given value. ### Usage ```javascript import { effect, data } from '@skele/classic' import { pushScene } from './navigation' effect.register('app', '.pushScene', async (context, action) => data.flow(action.scene, pushScene, context.dispatch) ) ``` ## `when(predicate, fn)` A helper for easier reduce with zippers. ### Usage ```javascript import { zip, data } from '@skele/classic' import I from 'immutable' import { initData } from './app' const elementZipper = zip.elementZipper({})(initData) const sceneTitles = zip.reduce( data.when( el => el.get('kind') === 'scene', (acc, el) => acc.push(el.getIn(['metadata', 'title'])) ), I.List(), elementZipper ) ```