All files iterable.js

100% Statements 12/12
66.67% Branches 4/6
100% Functions 6/6
100% Lines 6/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24    302x       301x       12x       54x       12x       54x  
// **isIterable** `:: obj -> bool`
// checks if an object is iterable
export const isIterable = o => !!o[Symbol.iterator];
 
// **iterify** `:: obj -> iterable`
// returns the object or an Iterable<a> containging the object
export const iterify = o => isIterable(o) ? o : [ o, ];
 
// ** isRemovable **`:: obj -> bool`
// checks if an object has the delete method
export const isRemovable = c => !!c.delete;
 
// ** isHasable **`:: obj -> bool`
// checks if an object has the 'has' method
export const isHasable = c => !!c.has;
 
// ** removify **`:: obj -> [map|set] `
// returns the object or an Iterable<a> containging the object
export const removify = c => isRemovable(c) ? c : new Set(iterify(c));
 
// ** hasify ** `:: obj -> [map|set] `
// returns the object or an Iterable<a> containging the object
export const hasify = c => isHasable(c) ? c : new Set(iterify(c));