import { List , Expression , Ruleset } from 'jess' ; import forEach from 'lodash/forEach' ; example import let mixin include export function each ( list , mixin ) { let collection ; let rules = new Ruleset ( [ ] ) ; if ( list instanceof List || list instanceof Expression ) { collection = list . toArray ( ) ; } else { collection = list ; } forEach ( collection , ( value , key ) => { rules . value . push ( mixin ( value , key ) ) ; } ) ; return rules ; }