All files add_method.js

100% Statements 6/6
100% Branches 2/2
100% Functions 2/2
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 11 12 13      2x 2x   2x 2x   1x      
import {isUndefined} from 'lodash';
 
export default function(csrf, method){
  let hidden = {_method: method};
  hidden[csrf.param] = csrf.token;
 
  return function(data){
    if (isUndefined(data)) return hidden;
 
    return Object.assign(data, hidden);
  };
};