-
Notifications
You must be signed in to change notification settings - Fork 21
Helpers.relation()
Javi Jiménez edited this page Jun 26, 2016
·
4 revisions
Extract the relation value of a determinate array key list:
import { relation } from 'ava-ia/lib/helpers'
const { location, when } = relation(['when', 'location'], state);
'use strict';
export default (keys, state) => {
const relations = state.relations || {};
let found = {};
keys.filter(key => relations[key] ? found[key] = relations[key].text : null)
return found;
}
Feel free to offer new features, improvements or anything you can think of. This project makes sense with your participation and experience using Ava.