nl_tokens: @module filter - source Filter out single bad source objects or multiple source objects in an array . Also flattens nested source object arrays into a 1 dimensional array of source objects .
pl_tokens: function filterSource ( src ) { // traverse array if ( Array . isArray ( src ) ) { var newsrc = [ ] ; src . forEach ( function ( srcobj ) { srcobj = filterSource ( srcobj ) ; if ( <mask> . isArray ( srcobj ) ) { newsrc = newsrc . concat ( srcobj ) ; } else if ( isObject ( srcobj ) ) { newsrc . push ( srcobj ) ; } } ) ; src = newsrc ; } else if ( typeof src === 'string' && src . trim ( ) ) { // convert string into object src = [ { src : src } ] ; } else if ( isObject ( src ) && typeof src . src === 'string' && src . src && src . src . trim ( ) ) { // src is already valid src = [ src ] ; } else { // invalid source, turn it into an empty array src = [ ] ; } return src ; }