@skele/classic
Version:
Skele is an architectural framework that assists with building data-driven apps with React or React Native.
23 lines (17 loc) • 537 B
JavaScript
import * as R from 'ramda'
import { data } from '@skele/core'
export const actionMetaProperty = '@@skele/actionMeta'
/**
* gets the action meadata from the action
*/
export const actionMeta = R.prop(actionMetaProperty)
/**
* Sets the action's metadata to reflect the element (cursor) at which the
* the action was fired.
*/
export const atCursor = R.curry((cursor, action) => {
const keyPath = cursor._keyPath
const kind = data.kindOf(cursor)
return { ...action, [actionMetaProperty]: { keyPath, kind } }
})