/*! * collection-visit <https://github.com/jonschlinkert/collection-visit> * * Copyright (c) 2015, 2017, Jon Schlinkert. * Released under the MIT License. */'use strict';varvisit=require('object-visit');varmapVisit=require('map-visit');module.exports=function(collection,method,val){varresult;if(typeofval==='string'&&(methodincollection)){varargs=[].slice.call(arguments,2);result=collection[method].apply(collection,args);}elseif(Array.isArray(val)){result=mapVisit.apply(null,arguments);}else{result=visit.apply(null,arguments);}if(typeofresult!=='undefined'){returnresult;}returncollection;};