json2csv.js 149 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["json2csv"] = factory();
  8. else
  9. root["json2csv"] = factory();
  10. })(this, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/ // The require function
  15. /******/ function __webpack_require__(moduleId) {
  16. /******/ // Check if module is in cache
  17. /******/ if(installedModules[moduleId])
  18. /******/ return installedModules[moduleId].exports;
  19. /******/ // Create a new module (and put it into the cache)
  20. /******/ var module = installedModules[moduleId] = {
  21. /******/ exports: {},
  22. /******/ id: moduleId,
  23. /******/ loaded: false
  24. /******/ };
  25. /******/ // Execute the module function
  26. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  27. /******/ // Flag the module as loaded
  28. /******/ module.loaded = true;
  29. /******/ // Return the exports of the module
  30. /******/ return module.exports;
  31. /******/ }
  32. /******/ // expose the modules object (__webpack_modules__)
  33. /******/ __webpack_require__.m = modules;
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/ // __webpack_public_path__
  37. /******/ __webpack_require__.p = "";
  38. /******/ // Load entry module and return exports
  39. /******/ return __webpack_require__(0);
  40. /******/ })
  41. /************************************************************************/
  42. /******/ ([
  43. /* 0 */
  44. /***/ (function(module, exports, __webpack_require__) {
  45. /* WEBPACK VAR INJECTION */(function(process) {/**
  46. * Module dependencies.
  47. */
  48. var os = __webpack_require__(2);
  49. var lodashGet = __webpack_require__(3);
  50. var lodashFlatten = __webpack_require__(4);
  51. var lodashUniq = __webpack_require__(5);
  52. var lodashSet = __webpack_require__(6);
  53. var lodashCloneDeep = __webpack_require__(7);
  54. var flatten = __webpack_require__(9);
  55. /**
  56. * @name Json2CsvParams
  57. * @typedef {Object}
  58. * @property {Array} data - array of JSON objects
  59. * @property {Array} [fields] - see documentation for details
  60. * @property {String[]} [fieldNames] - names for fields at the same indexes. Must be same length as fields array
  61. * (Optional. Maintained for backwards compatibility. Use fields config object for more features)
  62. * @property {String} [del=","] - delimiter of columns
  63. * @property {String} [defaultValue="<empty>"] - default value to use when missing data
  64. * @property {String} [quotes='"'] - quotes around cell values and column names
  65. * @property {String} [doubleQuotes='""'] - the value to replace double quotes in strings
  66. * @property {Boolean} [hasCSVColumnTitle=true] - determines whether or not CSV file will contain a title column
  67. * @property {String} [eol=''] - it gets added to each row of data
  68. * @property {String} [newLine] - overrides the default OS line ending (\n on Unix \r\n on Windows)
  69. * @property {Boolean} [flatten=false] - flattens nested JSON using flat (https://www.npmjs.com/package/flat)
  70. * @property {String} [unwindPath] - similar to MongoDB's $unwind, Deconstructs an array field from the input JSON to output a row for each element
  71. * @property {Boolean} [excelStrings] - converts string data into normalized Excel style data
  72. * @property {Boolean} [includeEmptyRows=false] - includes empty rows
  73. */
  74. /**
  75. * Main function that converts json to csv.
  76. *
  77. * @param {Json2CsvParams} params Function parameters containing data, fields,
  78. * delimiter (default is ','), hasCSVColumnTitle (default is true)
  79. * and default value (default is '')
  80. * @param {Function} [callback] Callback function
  81. * if error, returning error in call back.
  82. * if csv is created successfully, returning csv output to callback.
  83. */
  84. module.exports = function (params, callback) {
  85. var hasCallback = typeof callback === 'function';
  86. var err;
  87. try {
  88. checkParams(params);
  89. } catch (err) {
  90. if (hasCallback) {
  91. return process.nextTick(function () {
  92. callback(err);
  93. });
  94. } else {
  95. throw err;
  96. }
  97. }
  98. var titles = createColumnTitles(params);
  99. var csv = createColumnContent(params, titles);
  100. if (hasCallback) {
  101. return process.nextTick(function () {
  102. callback(null, csv);
  103. });
  104. } else {
  105. return csv;
  106. }
  107. };
  108. /**
  109. * Check passing params.
  110. *
  111. * Note that this modifies params.
  112. *
  113. * @param {Json2CsvParams} params Function parameters containing data, fields,
  114. * delimiter, default value, mark quotes and hasCSVColumnTitle
  115. */
  116. function checkParams(params) {
  117. params.data = params.data || [];
  118. // if data is an Object, not in array [{}], then just create 1 item array.
  119. // So from now all data in array of object format.
  120. if (!Array.isArray(params.data)) {
  121. params.data = [params.data];
  122. }
  123. if (params.flatten) {
  124. params.data = params.data.map(flatten);
  125. }
  126. // Set params.fields default to first data element's keys
  127. if (!params.fields && (params.data.length === 0 || typeof params.data[0] !== 'object')) {
  128. throw new Error('params should include "fields" and/or non-empty "data" array of objects');
  129. }
  130. if (!params.fields) {
  131. var dataFields = params.data.map(function (item) {
  132. return Object.keys(item);
  133. });
  134. dataFields = lodashFlatten(dataFields);
  135. params.fields = lodashUniq(dataFields);
  136. }
  137. //#check fieldNames
  138. if (params.fieldNames && params.fieldNames.length !== params.fields.length) {
  139. throw new Error('fieldNames and fields should be of the same length, if fieldNames is provided.');
  140. }
  141. // Get fieldNames from fields
  142. params.fieldNames = params.fields.map(function (field, i) {
  143. if (params.fieldNames && typeof field === 'string') {
  144. return params.fieldNames[i];
  145. }
  146. return (typeof field === 'string') ? field : (field.label || field.value);
  147. });
  148. //#check delimiter
  149. params.del = params.del || ',';
  150. //#check end of line character
  151. params.eol = params.eol || '';
  152. //#check quotation mark
  153. params.quotes = typeof params.quotes === 'string' ? params.quotes : '"';
  154. //#check double quotes
  155. params.doubleQuotes = typeof params.doubleQuotes === 'string' ? params.doubleQuotes : Array(3).join(params.quotes);
  156. //#check default value
  157. params.defaultValue = params.defaultValue;
  158. //#check hasCSVColumnTitle, if it is not explicitly set to false then true.
  159. params.hasCSVColumnTitle = params.hasCSVColumnTitle !== false;
  160. //#check include empty rows, defaults to false
  161. params.includeEmptyRows = params.includeEmptyRows || false;
  162. }
  163. /**
  164. * Create the title row with all the provided fields as column headings
  165. *
  166. * @param {Json2CsvParams} params Function parameters containing data, fields and delimiter
  167. * @returns {String} titles as a string
  168. */
  169. function createColumnTitles(params) {
  170. var str = '';
  171. //if CSV has column title, then create it
  172. if (params.hasCSVColumnTitle) {
  173. params.fieldNames.forEach(function (element) {
  174. if (str !== '') {
  175. str += params.del;
  176. }
  177. str += JSON.stringify(element).replace(/\"/g, params.quotes);
  178. });
  179. }
  180. return str;
  181. }
  182. /**
  183. * Replace the quotation marks of the field element if needed (can be a not string-like item)
  184. *
  185. * @param {string} stringifiedElement The field element after JSON.stringify()
  186. * @param {string} quotes The params.quotes value. At this point we know that is not equal to double (")
  187. */
  188. function replaceQuotationMarks(stringifiedElement, quotes) {
  189. var lastCharIndex = stringifiedElement.length - 1;
  190. //check if it's an string-like element
  191. if (stringifiedElement[0] === '"' && stringifiedElement[lastCharIndex] === '"') {
  192. //split the stringified field element because Strings are immutable
  193. var splitElement = stringifiedElement.split('');
  194. //replace the quotation marks
  195. splitElement[0] = quotes;
  196. splitElement[lastCharIndex] = quotes;
  197. //join again
  198. stringifiedElement = splitElement.join('');
  199. }
  200. return stringifiedElement;
  201. }
  202. /**
  203. * Create the content column by column and row by row below the title
  204. *
  205. * @param {Object} params Function parameters containing data, fields and delimiter
  206. * @param {String} str Title row as a string
  207. * @returns {String} csv string
  208. */
  209. function createColumnContent(params, str) {
  210. var dataRows = createDataRows(params);
  211. dataRows.forEach(function (dataElement) {
  212. //if null do nothing, if empty object without includeEmptyRows do nothing
  213. if (dataElement && (Object.getOwnPropertyNames(dataElement).length > 0 || params.includeEmptyRows)) {
  214. var line = '';
  215. var eol = params.newLine || os.EOL || '\n';
  216. params.fields.forEach(function (fieldElement) {
  217. var val;
  218. var defaultValue = params.defaultValue;
  219. if (typeof fieldElement === 'object' && 'default' in fieldElement) {
  220. defaultValue = fieldElement.default;
  221. }
  222. if (fieldElement && (typeof fieldElement === 'string' || typeof fieldElement.value === 'string')) {
  223. var path = (typeof fieldElement === 'string') ? fieldElement : fieldElement.value;
  224. val = lodashGet(dataElement, path, defaultValue);
  225. } else if (fieldElement && typeof fieldElement.value === 'function') {
  226. var field = {
  227. label: fieldElement.label,
  228. default: fieldElement.default
  229. };
  230. val = fieldElement.value(dataElement, field, params.data);
  231. }
  232. if (val === null || val === undefined){
  233. val = defaultValue;
  234. }
  235. if (val !== undefined) {
  236. var stringifiedElement = JSON.stringify(val);
  237. if (typeof val === 'object') stringifiedElement = JSON.stringify(stringifiedElement);
  238. if (params.quotes !== '"') {
  239. stringifiedElement = replaceQuotationMarks(stringifiedElement, params.quotes);
  240. }
  241. //JSON.stringify('\\') results in a string with two backslash
  242. //characters in it. I.e. '\\\\'.
  243. stringifiedElement = stringifiedElement.replace(/\\\\/g, '\\');
  244. if (params.excelStrings && typeof val === 'string') {
  245. stringifiedElement = '"="' + stringifiedElement + '""';
  246. }
  247. line += stringifiedElement;
  248. }
  249. line += params.del;
  250. });
  251. //remove last delimeter by its length
  252. line = line.substring(0, line.length - params.del.length);
  253. //Replace single quotes with double quotes. Single quotes are preceeded by
  254. //a backslash. Be careful not to remove backslash content from the string.
  255. line = line.split('\\\\').map(function (portion) {
  256. return portion.replace(/\\"/g, params.doubleQuotes);
  257. }).join('\\\\');
  258. //Remove the final excess backslashes from the stringified value.
  259. line = line.replace(/\\\\/g, '\\');
  260. //If header exists, add it, otherwise, print only content
  261. if (str !== '') {
  262. str += eol + line + params.eol;
  263. } else {
  264. str = line + params.eol;
  265. }
  266. }
  267. });
  268. return str;
  269. }
  270. /**
  271. * Performs the unwind logic if necessary to convert single JSON document into multiple rows
  272. * @param params
  273. */
  274. function createDataRows(params) {
  275. var dataRows = params.data;
  276. if (params.unwindPath) {
  277. dataRows = [];
  278. params.data.forEach(function(dataEl) {
  279. var unwindArray = lodashGet(dataEl, params.unwindPath);
  280. var isArr = Array.isArray(unwindArray);
  281. if (isArr && unwindArray.length) {
  282. unwindArray.forEach(function(unwindEl) {
  283. var dataCopy = lodashCloneDeep(dataEl);
  284. lodashSet(dataCopy, params.unwindPath, unwindEl);
  285. dataRows.push(dataCopy);
  286. });
  287. } else if (isArr && !unwindArray.length) {
  288. var dataCopy = lodashCloneDeep(dataEl);
  289. lodashSet(dataCopy, params.unwindPath, undefined);
  290. dataRows.push(dataCopy);
  291. } else {
  292. dataRows.push(dataEl);
  293. }
  294. });
  295. }
  296. return dataRows;
  297. }
  298. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
  299. /***/ }),
  300. /* 1 */
  301. /***/ (function(module, exports) {
  302. // shim for using process in browser
  303. var process = module.exports = {};
  304. // cached from whatever global is present so that test runners that stub it
  305. // don't break things. But we need to wrap it in a try catch in case it is
  306. // wrapped in strict mode code which doesn't define any globals. It's inside a
  307. // function because try/catches deoptimize in certain engines.
  308. var cachedSetTimeout;
  309. var cachedClearTimeout;
  310. function defaultSetTimout() {
  311. throw new Error('setTimeout has not been defined');
  312. }
  313. function defaultClearTimeout () {
  314. throw new Error('clearTimeout has not been defined');
  315. }
  316. (function () {
  317. try {
  318. if (typeof setTimeout === 'function') {
  319. cachedSetTimeout = setTimeout;
  320. } else {
  321. cachedSetTimeout = defaultSetTimout;
  322. }
  323. } catch (e) {
  324. cachedSetTimeout = defaultSetTimout;
  325. }
  326. try {
  327. if (typeof clearTimeout === 'function') {
  328. cachedClearTimeout = clearTimeout;
  329. } else {
  330. cachedClearTimeout = defaultClearTimeout;
  331. }
  332. } catch (e) {
  333. cachedClearTimeout = defaultClearTimeout;
  334. }
  335. } ())
  336. function runTimeout(fun) {
  337. if (cachedSetTimeout === setTimeout) {
  338. //normal enviroments in sane situations
  339. return setTimeout(fun, 0);
  340. }
  341. // if setTimeout wasn't available but was latter defined
  342. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  343. cachedSetTimeout = setTimeout;
  344. return setTimeout(fun, 0);
  345. }
  346. try {
  347. // when when somebody has screwed with setTimeout but no I.E. maddness
  348. return cachedSetTimeout(fun, 0);
  349. } catch(e){
  350. try {
  351. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  352. return cachedSetTimeout.call(null, fun, 0);
  353. } catch(e){
  354. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  355. return cachedSetTimeout.call(this, fun, 0);
  356. }
  357. }
  358. }
  359. function runClearTimeout(marker) {
  360. if (cachedClearTimeout === clearTimeout) {
  361. //normal enviroments in sane situations
  362. return clearTimeout(marker);
  363. }
  364. // if clearTimeout wasn't available but was latter defined
  365. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  366. cachedClearTimeout = clearTimeout;
  367. return clearTimeout(marker);
  368. }
  369. try {
  370. // when when somebody has screwed with setTimeout but no I.E. maddness
  371. return cachedClearTimeout(marker);
  372. } catch (e){
  373. try {
  374. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  375. return cachedClearTimeout.call(null, marker);
  376. } catch (e){
  377. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  378. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  379. return cachedClearTimeout.call(this, marker);
  380. }
  381. }
  382. }
  383. var queue = [];
  384. var draining = false;
  385. var currentQueue;
  386. var queueIndex = -1;
  387. function cleanUpNextTick() {
  388. if (!draining || !currentQueue) {
  389. return;
  390. }
  391. draining = false;
  392. if (currentQueue.length) {
  393. queue = currentQueue.concat(queue);
  394. } else {
  395. queueIndex = -1;
  396. }
  397. if (queue.length) {
  398. drainQueue();
  399. }
  400. }
  401. function drainQueue() {
  402. if (draining) {
  403. return;
  404. }
  405. var timeout = runTimeout(cleanUpNextTick);
  406. draining = true;
  407. var len = queue.length;
  408. while(len) {
  409. currentQueue = queue;
  410. queue = [];
  411. while (++queueIndex < len) {
  412. if (currentQueue) {
  413. currentQueue[queueIndex].run();
  414. }
  415. }
  416. queueIndex = -1;
  417. len = queue.length;
  418. }
  419. currentQueue = null;
  420. draining = false;
  421. runClearTimeout(timeout);
  422. }
  423. process.nextTick = function (fun) {
  424. var args = new Array(arguments.length - 1);
  425. if (arguments.length > 1) {
  426. for (var i = 1; i < arguments.length; i++) {
  427. args[i - 1] = arguments[i];
  428. }
  429. }
  430. queue.push(new Item(fun, args));
  431. if (queue.length === 1 && !draining) {
  432. runTimeout(drainQueue);
  433. }
  434. };
  435. // v8 likes predictible objects
  436. function Item(fun, array) {
  437. this.fun = fun;
  438. this.array = array;
  439. }
  440. Item.prototype.run = function () {
  441. this.fun.apply(null, this.array);
  442. };
  443. process.title = 'browser';
  444. process.browser = true;
  445. process.env = {};
  446. process.argv = [];
  447. process.version = ''; // empty string to avoid regexp issues
  448. process.versions = {};
  449. function noop() {}
  450. process.on = noop;
  451. process.addListener = noop;
  452. process.once = noop;
  453. process.off = noop;
  454. process.removeListener = noop;
  455. process.removeAllListeners = noop;
  456. process.emit = noop;
  457. process.prependListener = noop;
  458. process.prependOnceListener = noop;
  459. process.listeners = function (name) { return [] }
  460. process.binding = function (name) {
  461. throw new Error('process.binding is not supported');
  462. };
  463. process.cwd = function () { return '/' };
  464. process.chdir = function (dir) {
  465. throw new Error('process.chdir is not supported');
  466. };
  467. process.umask = function() { return 0; };
  468. /***/ }),
  469. /* 2 */
  470. /***/ (function(module, exports) {
  471. exports.endianness = function () { return 'LE' };
  472. exports.hostname = function () {
  473. if (typeof location !== 'undefined') {
  474. return location.hostname
  475. }
  476. else return '';
  477. };
  478. exports.loadavg = function () { return [] };
  479. exports.uptime = function () { return 0 };
  480. exports.freemem = function () {
  481. return Number.MAX_VALUE;
  482. };
  483. exports.totalmem = function () {
  484. return Number.MAX_VALUE;
  485. };
  486. exports.cpus = function () { return [] };
  487. exports.type = function () { return 'Browser' };
  488. exports.release = function () {
  489. if (typeof navigator !== 'undefined') {
  490. return navigator.appVersion;
  491. }
  492. return '';
  493. };
  494. exports.networkInterfaces
  495. = exports.getNetworkInterfaces
  496. = function () { return {} };
  497. exports.arch = function () { return 'javascript' };
  498. exports.platform = function () { return 'browser' };
  499. exports.tmpdir = exports.tmpDir = function () {
  500. return '/tmp';
  501. };
  502. exports.EOL = '\n';
  503. /***/ }),
  504. /* 3 */
  505. /***/ (function(module, exports) {
  506. /* WEBPACK VAR INJECTION */(function(global) {/**
  507. * lodash (Custom Build) <https://lodash.com/>
  508. * Build: `lodash modularize exports="npm" -o ./`
  509. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  510. * Released under MIT license <https://lodash.com/license>
  511. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  512. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  513. */
  514. /** Used as the `TypeError` message for "Functions" methods. */
  515. var FUNC_ERROR_TEXT = 'Expected a function';
  516. /** Used to stand-in for `undefined` hash values. */
  517. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  518. /** Used as references for various `Number` constants. */
  519. var INFINITY = 1 / 0;
  520. /** `Object#toString` result references. */
  521. var funcTag = '[object Function]',
  522. genTag = '[object GeneratorFunction]',
  523. symbolTag = '[object Symbol]';
  524. /** Used to match property names within property paths. */
  525. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  526. reIsPlainProp = /^\w*$/,
  527. reLeadingDot = /^\./,
  528. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  529. /**
  530. * Used to match `RegExp`
  531. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  532. */
  533. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  534. /** Used to match backslashes in property paths. */
  535. var reEscapeChar = /\\(\\)?/g;
  536. /** Used to detect host constructors (Safari). */
  537. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  538. /** Detect free variable `global` from Node.js. */
  539. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  540. /** Detect free variable `self`. */
  541. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  542. /** Used as a reference to the global object. */
  543. var root = freeGlobal || freeSelf || Function('return this')();
  544. /**
  545. * Gets the value at `key` of `object`.
  546. *
  547. * @private
  548. * @param {Object} [object] The object to query.
  549. * @param {string} key The key of the property to get.
  550. * @returns {*} Returns the property value.
  551. */
  552. function getValue(object, key) {
  553. return object == null ? undefined : object[key];
  554. }
  555. /**
  556. * Checks if `value` is a host object in IE < 9.
  557. *
  558. * @private
  559. * @param {*} value The value to check.
  560. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  561. */
  562. function isHostObject(value) {
  563. // Many host objects are `Object` objects that can coerce to strings
  564. // despite having improperly defined `toString` methods.
  565. var result = false;
  566. if (value != null && typeof value.toString != 'function') {
  567. try {
  568. result = !!(value + '');
  569. } catch (e) {}
  570. }
  571. return result;
  572. }
  573. /** Used for built-in method references. */
  574. var arrayProto = Array.prototype,
  575. funcProto = Function.prototype,
  576. objectProto = Object.prototype;
  577. /** Used to detect overreaching core-js shims. */
  578. var coreJsData = root['__core-js_shared__'];
  579. /** Used to detect methods masquerading as native. */
  580. var maskSrcKey = (function() {
  581. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  582. return uid ? ('Symbol(src)_1.' + uid) : '';
  583. }());
  584. /** Used to resolve the decompiled source of functions. */
  585. var funcToString = funcProto.toString;
  586. /** Used to check objects for own properties. */
  587. var hasOwnProperty = objectProto.hasOwnProperty;
  588. /**
  589. * Used to resolve the
  590. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  591. * of values.
  592. */
  593. var objectToString = objectProto.toString;
  594. /** Used to detect if a method is native. */
  595. var reIsNative = RegExp('^' +
  596. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  597. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  598. );
  599. /** Built-in value references. */
  600. var Symbol = root.Symbol,
  601. splice = arrayProto.splice;
  602. /* Built-in method references that are verified to be native. */
  603. var Map = getNative(root, 'Map'),
  604. nativeCreate = getNative(Object, 'create');
  605. /** Used to convert symbols to primitives and strings. */
  606. var symbolProto = Symbol ? Symbol.prototype : undefined,
  607. symbolToString = symbolProto ? symbolProto.toString : undefined;
  608. /**
  609. * Creates a hash object.
  610. *
  611. * @private
  612. * @constructor
  613. * @param {Array} [entries] The key-value pairs to cache.
  614. */
  615. function Hash(entries) {
  616. var index = -1,
  617. length = entries ? entries.length : 0;
  618. this.clear();
  619. while (++index < length) {
  620. var entry = entries[index];
  621. this.set(entry[0], entry[1]);
  622. }
  623. }
  624. /**
  625. * Removes all key-value entries from the hash.
  626. *
  627. * @private
  628. * @name clear
  629. * @memberOf Hash
  630. */
  631. function hashClear() {
  632. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  633. }
  634. /**
  635. * Removes `key` and its value from the hash.
  636. *
  637. * @private
  638. * @name delete
  639. * @memberOf Hash
  640. * @param {Object} hash The hash to modify.
  641. * @param {string} key The key of the value to remove.
  642. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  643. */
  644. function hashDelete(key) {
  645. return this.has(key) && delete this.__data__[key];
  646. }
  647. /**
  648. * Gets the hash value for `key`.
  649. *
  650. * @private
  651. * @name get
  652. * @memberOf Hash
  653. * @param {string} key The key of the value to get.
  654. * @returns {*} Returns the entry value.
  655. */
  656. function hashGet(key) {
  657. var data = this.__data__;
  658. if (nativeCreate) {
  659. var result = data[key];
  660. return result === HASH_UNDEFINED ? undefined : result;
  661. }
  662. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  663. }
  664. /**
  665. * Checks if a hash value for `key` exists.
  666. *
  667. * @private
  668. * @name has
  669. * @memberOf Hash
  670. * @param {string} key The key of the entry to check.
  671. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  672. */
  673. function hashHas(key) {
  674. var data = this.__data__;
  675. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  676. }
  677. /**
  678. * Sets the hash `key` to `value`.
  679. *
  680. * @private
  681. * @name set
  682. * @memberOf Hash
  683. * @param {string} key The key of the value to set.
  684. * @param {*} value The value to set.
  685. * @returns {Object} Returns the hash instance.
  686. */
  687. function hashSet(key, value) {
  688. var data = this.__data__;
  689. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  690. return this;
  691. }
  692. // Add methods to `Hash`.
  693. Hash.prototype.clear = hashClear;
  694. Hash.prototype['delete'] = hashDelete;
  695. Hash.prototype.get = hashGet;
  696. Hash.prototype.has = hashHas;
  697. Hash.prototype.set = hashSet;
  698. /**
  699. * Creates an list cache object.
  700. *
  701. * @private
  702. * @constructor
  703. * @param {Array} [entries] The key-value pairs to cache.
  704. */
  705. function ListCache(entries) {
  706. var index = -1,
  707. length = entries ? entries.length : 0;
  708. this.clear();
  709. while (++index < length) {
  710. var entry = entries[index];
  711. this.set(entry[0], entry[1]);
  712. }
  713. }
  714. /**
  715. * Removes all key-value entries from the list cache.
  716. *
  717. * @private
  718. * @name clear
  719. * @memberOf ListCache
  720. */
  721. function listCacheClear() {
  722. this.__data__ = [];
  723. }
  724. /**
  725. * Removes `key` and its value from the list cache.
  726. *
  727. * @private
  728. * @name delete
  729. * @memberOf ListCache
  730. * @param {string} key The key of the value to remove.
  731. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  732. */
  733. function listCacheDelete(key) {
  734. var data = this.__data__,
  735. index = assocIndexOf(data, key);
  736. if (index < 0) {
  737. return false;
  738. }
  739. var lastIndex = data.length - 1;
  740. if (index == lastIndex) {
  741. data.pop();
  742. } else {
  743. splice.call(data, index, 1);
  744. }
  745. return true;
  746. }
  747. /**
  748. * Gets the list cache value for `key`.
  749. *
  750. * @private
  751. * @name get
  752. * @memberOf ListCache
  753. * @param {string} key The key of the value to get.
  754. * @returns {*} Returns the entry value.
  755. */
  756. function listCacheGet(key) {
  757. var data = this.__data__,
  758. index = assocIndexOf(data, key);
  759. return index < 0 ? undefined : data[index][1];
  760. }
  761. /**
  762. * Checks if a list cache value for `key` exists.
  763. *
  764. * @private
  765. * @name has
  766. * @memberOf ListCache
  767. * @param {string} key The key of the entry to check.
  768. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  769. */
  770. function listCacheHas(key) {
  771. return assocIndexOf(this.__data__, key) > -1;
  772. }
  773. /**
  774. * Sets the list cache `key` to `value`.
  775. *
  776. * @private
  777. * @name set
  778. * @memberOf ListCache
  779. * @param {string} key The key of the value to set.
  780. * @param {*} value The value to set.
  781. * @returns {Object} Returns the list cache instance.
  782. */
  783. function listCacheSet(key, value) {
  784. var data = this.__data__,
  785. index = assocIndexOf(data, key);
  786. if (index < 0) {
  787. data.push([key, value]);
  788. } else {
  789. data[index][1] = value;
  790. }
  791. return this;
  792. }
  793. // Add methods to `ListCache`.
  794. ListCache.prototype.clear = listCacheClear;
  795. ListCache.prototype['delete'] = listCacheDelete;
  796. ListCache.prototype.get = listCacheGet;
  797. ListCache.prototype.has = listCacheHas;
  798. ListCache.prototype.set = listCacheSet;
  799. /**
  800. * Creates a map cache object to store key-value pairs.
  801. *
  802. * @private
  803. * @constructor
  804. * @param {Array} [entries] The key-value pairs to cache.
  805. */
  806. function MapCache(entries) {
  807. var index = -1,
  808. length = entries ? entries.length : 0;
  809. this.clear();
  810. while (++index < length) {
  811. var entry = entries[index];
  812. this.set(entry[0], entry[1]);
  813. }
  814. }
  815. /**
  816. * Removes all key-value entries from the map.
  817. *
  818. * @private
  819. * @name clear
  820. * @memberOf MapCache
  821. */
  822. function mapCacheClear() {
  823. this.__data__ = {
  824. 'hash': new Hash,
  825. 'map': new (Map || ListCache),
  826. 'string': new Hash
  827. };
  828. }
  829. /**
  830. * Removes `key` and its value from the map.
  831. *
  832. * @private
  833. * @name delete
  834. * @memberOf MapCache
  835. * @param {string} key The key of the value to remove.
  836. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  837. */
  838. function mapCacheDelete(key) {
  839. return getMapData(this, key)['delete'](key);
  840. }
  841. /**
  842. * Gets the map value for `key`.
  843. *
  844. * @private
  845. * @name get
  846. * @memberOf MapCache
  847. * @param {string} key The key of the value to get.
  848. * @returns {*} Returns the entry value.
  849. */
  850. function mapCacheGet(key) {
  851. return getMapData(this, key).get(key);
  852. }
  853. /**
  854. * Checks if a map value for `key` exists.
  855. *
  856. * @private
  857. * @name has
  858. * @memberOf MapCache
  859. * @param {string} key The key of the entry to check.
  860. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  861. */
  862. function mapCacheHas(key) {
  863. return getMapData(this, key).has(key);
  864. }
  865. /**
  866. * Sets the map `key` to `value`.
  867. *
  868. * @private
  869. * @name set
  870. * @memberOf MapCache
  871. * @param {string} key The key of the value to set.
  872. * @param {*} value The value to set.
  873. * @returns {Object} Returns the map cache instance.
  874. */
  875. function mapCacheSet(key, value) {
  876. getMapData(this, key).set(key, value);
  877. return this;
  878. }
  879. // Add methods to `MapCache`.
  880. MapCache.prototype.clear = mapCacheClear;
  881. MapCache.prototype['delete'] = mapCacheDelete;
  882. MapCache.prototype.get = mapCacheGet;
  883. MapCache.prototype.has = mapCacheHas;
  884. MapCache.prototype.set = mapCacheSet;
  885. /**
  886. * Gets the index at which the `key` is found in `array` of key-value pairs.
  887. *
  888. * @private
  889. * @param {Array} array The array to inspect.
  890. * @param {*} key The key to search for.
  891. * @returns {number} Returns the index of the matched value, else `-1`.
  892. */
  893. function assocIndexOf(array, key) {
  894. var length = array.length;
  895. while (length--) {
  896. if (eq(array[length][0], key)) {
  897. return length;
  898. }
  899. }
  900. return -1;
  901. }
  902. /**
  903. * The base implementation of `_.get` without support for default values.
  904. *
  905. * @private
  906. * @param {Object} object The object to query.
  907. * @param {Array|string} path The path of the property to get.
  908. * @returns {*} Returns the resolved value.
  909. */
  910. function baseGet(object, path) {
  911. path = isKey(path, object) ? [path] : castPath(path);
  912. var index = 0,
  913. length = path.length;
  914. while (object != null && index < length) {
  915. object = object[toKey(path[index++])];
  916. }
  917. return (index && index == length) ? object : undefined;
  918. }
  919. /**
  920. * The base implementation of `_.isNative` without bad shim checks.
  921. *
  922. * @private
  923. * @param {*} value The value to check.
  924. * @returns {boolean} Returns `true` if `value` is a native function,
  925. * else `false`.
  926. */
  927. function baseIsNative(value) {
  928. if (!isObject(value) || isMasked(value)) {
  929. return false;
  930. }
  931. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  932. return pattern.test(toSource(value));
  933. }
  934. /**
  935. * The base implementation of `_.toString` which doesn't convert nullish
  936. * values to empty strings.
  937. *
  938. * @private
  939. * @param {*} value The value to process.
  940. * @returns {string} Returns the string.
  941. */
  942. function baseToString(value) {
  943. // Exit early for strings to avoid a performance hit in some environments.
  944. if (typeof value == 'string') {
  945. return value;
  946. }
  947. if (isSymbol(value)) {
  948. return symbolToString ? symbolToString.call(value) : '';
  949. }
  950. var result = (value + '');
  951. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  952. }
  953. /**
  954. * Casts `value` to a path array if it's not one.
  955. *
  956. * @private
  957. * @param {*} value The value to inspect.
  958. * @returns {Array} Returns the cast property path array.
  959. */
  960. function castPath(value) {
  961. return isArray(value) ? value : stringToPath(value);
  962. }
  963. /**
  964. * Gets the data for `map`.
  965. *
  966. * @private
  967. * @param {Object} map The map to query.
  968. * @param {string} key The reference key.
  969. * @returns {*} Returns the map data.
  970. */
  971. function getMapData(map, key) {
  972. var data = map.__data__;
  973. return isKeyable(key)
  974. ? data[typeof key == 'string' ? 'string' : 'hash']
  975. : data.map;
  976. }
  977. /**
  978. * Gets the native function at `key` of `object`.
  979. *
  980. * @private
  981. * @param {Object} object The object to query.
  982. * @param {string} key The key of the method to get.
  983. * @returns {*} Returns the function if it's native, else `undefined`.
  984. */
  985. function getNative(object, key) {
  986. var value = getValue(object, key);
  987. return baseIsNative(value) ? value : undefined;
  988. }
  989. /**
  990. * Checks if `value` is a property name and not a property path.
  991. *
  992. * @private
  993. * @param {*} value The value to check.
  994. * @param {Object} [object] The object to query keys on.
  995. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  996. */
  997. function isKey(value, object) {
  998. if (isArray(value)) {
  999. return false;
  1000. }
  1001. var type = typeof value;
  1002. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  1003. value == null || isSymbol(value)) {
  1004. return true;
  1005. }
  1006. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  1007. (object != null && value in Object(object));
  1008. }
  1009. /**
  1010. * Checks if `value` is suitable for use as unique object key.
  1011. *
  1012. * @private
  1013. * @param {*} value The value to check.
  1014. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  1015. */
  1016. function isKeyable(value) {
  1017. var type = typeof value;
  1018. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  1019. ? (value !== '__proto__')
  1020. : (value === null);
  1021. }
  1022. /**
  1023. * Checks if `func` has its source masked.
  1024. *
  1025. * @private
  1026. * @param {Function} func The function to check.
  1027. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  1028. */
  1029. function isMasked(func) {
  1030. return !!maskSrcKey && (maskSrcKey in func);
  1031. }
  1032. /**
  1033. * Converts `string` to a property path array.
  1034. *
  1035. * @private
  1036. * @param {string} string The string to convert.
  1037. * @returns {Array} Returns the property path array.
  1038. */
  1039. var stringToPath = memoize(function(string) {
  1040. string = toString(string);
  1041. var result = [];
  1042. if (reLeadingDot.test(string)) {
  1043. result.push('');
  1044. }
  1045. string.replace(rePropName, function(match, number, quote, string) {
  1046. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  1047. });
  1048. return result;
  1049. });
  1050. /**
  1051. * Converts `value` to a string key if it's not a string or symbol.
  1052. *
  1053. * @private
  1054. * @param {*} value The value to inspect.
  1055. * @returns {string|symbol} Returns the key.
  1056. */
  1057. function toKey(value) {
  1058. if (typeof value == 'string' || isSymbol(value)) {
  1059. return value;
  1060. }
  1061. var result = (value + '');
  1062. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  1063. }
  1064. /**
  1065. * Converts `func` to its source code.
  1066. *
  1067. * @private
  1068. * @param {Function} func The function to process.
  1069. * @returns {string} Returns the source code.
  1070. */
  1071. function toSource(func) {
  1072. if (func != null) {
  1073. try {
  1074. return funcToString.call(func);
  1075. } catch (e) {}
  1076. try {
  1077. return (func + '');
  1078. } catch (e) {}
  1079. }
  1080. return '';
  1081. }
  1082. /**
  1083. * Creates a function that memoizes the result of `func`. If `resolver` is
  1084. * provided, it determines the cache key for storing the result based on the
  1085. * arguments provided to the memoized function. By default, the first argument
  1086. * provided to the memoized function is used as the map cache key. The `func`
  1087. * is invoked with the `this` binding of the memoized function.
  1088. *
  1089. * **Note:** The cache is exposed as the `cache` property on the memoized
  1090. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  1091. * constructor with one whose instances implement the
  1092. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  1093. * method interface of `delete`, `get`, `has`, and `set`.
  1094. *
  1095. * @static
  1096. * @memberOf _
  1097. * @since 0.1.0
  1098. * @category Function
  1099. * @param {Function} func The function to have its output memoized.
  1100. * @param {Function} [resolver] The function to resolve the cache key.
  1101. * @returns {Function} Returns the new memoized function.
  1102. * @example
  1103. *
  1104. * var object = { 'a': 1, 'b': 2 };
  1105. * var other = { 'c': 3, 'd': 4 };
  1106. *
  1107. * var values = _.memoize(_.values);
  1108. * values(object);
  1109. * // => [1, 2]
  1110. *
  1111. * values(other);
  1112. * // => [3, 4]
  1113. *
  1114. * object.a = 2;
  1115. * values(object);
  1116. * // => [1, 2]
  1117. *
  1118. * // Modify the result cache.
  1119. * values.cache.set(object, ['a', 'b']);
  1120. * values(object);
  1121. * // => ['a', 'b']
  1122. *
  1123. * // Replace `_.memoize.Cache`.
  1124. * _.memoize.Cache = WeakMap;
  1125. */
  1126. function memoize(func, resolver) {
  1127. if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
  1128. throw new TypeError(FUNC_ERROR_TEXT);
  1129. }
  1130. var memoized = function() {
  1131. var args = arguments,
  1132. key = resolver ? resolver.apply(this, args) : args[0],
  1133. cache = memoized.cache;
  1134. if (cache.has(key)) {
  1135. return cache.get(key);
  1136. }
  1137. var result = func.apply(this, args);
  1138. memoized.cache = cache.set(key, result);
  1139. return result;
  1140. };
  1141. memoized.cache = new (memoize.Cache || MapCache);
  1142. return memoized;
  1143. }
  1144. // Assign cache to `_.memoize`.
  1145. memoize.Cache = MapCache;
  1146. /**
  1147. * Performs a
  1148. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  1149. * comparison between two values to determine if they are equivalent.
  1150. *
  1151. * @static
  1152. * @memberOf _
  1153. * @since 4.0.0
  1154. * @category Lang
  1155. * @param {*} value The value to compare.
  1156. * @param {*} other The other value to compare.
  1157. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  1158. * @example
  1159. *
  1160. * var object = { 'a': 1 };
  1161. * var other = { 'a': 1 };
  1162. *
  1163. * _.eq(object, object);
  1164. * // => true
  1165. *
  1166. * _.eq(object, other);
  1167. * // => false
  1168. *
  1169. * _.eq('a', 'a');
  1170. * // => true
  1171. *
  1172. * _.eq('a', Object('a'));
  1173. * // => false
  1174. *
  1175. * _.eq(NaN, NaN);
  1176. * // => true
  1177. */
  1178. function eq(value, other) {
  1179. return value === other || (value !== value && other !== other);
  1180. }
  1181. /**
  1182. * Checks if `value` is classified as an `Array` object.
  1183. *
  1184. * @static
  1185. * @memberOf _
  1186. * @since 0.1.0
  1187. * @category Lang
  1188. * @param {*} value The value to check.
  1189. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  1190. * @example
  1191. *
  1192. * _.isArray([1, 2, 3]);
  1193. * // => true
  1194. *
  1195. * _.isArray(document.body.children);
  1196. * // => false
  1197. *
  1198. * _.isArray('abc');
  1199. * // => false
  1200. *
  1201. * _.isArray(_.noop);
  1202. * // => false
  1203. */
  1204. var isArray = Array.isArray;
  1205. /**
  1206. * Checks if `value` is classified as a `Function` object.
  1207. *
  1208. * @static
  1209. * @memberOf _
  1210. * @since 0.1.0
  1211. * @category Lang
  1212. * @param {*} value The value to check.
  1213. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  1214. * @example
  1215. *
  1216. * _.isFunction(_);
  1217. * // => true
  1218. *
  1219. * _.isFunction(/abc/);
  1220. * // => false
  1221. */
  1222. function isFunction(value) {
  1223. // The use of `Object#toString` avoids issues with the `typeof` operator
  1224. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  1225. var tag = isObject(value) ? objectToString.call(value) : '';
  1226. return tag == funcTag || tag == genTag;
  1227. }
  1228. /**
  1229. * Checks if `value` is the
  1230. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  1231. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  1232. *
  1233. * @static
  1234. * @memberOf _
  1235. * @since 0.1.0
  1236. * @category Lang
  1237. * @param {*} value The value to check.
  1238. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  1239. * @example
  1240. *
  1241. * _.isObject({});
  1242. * // => true
  1243. *
  1244. * _.isObject([1, 2, 3]);
  1245. * // => true
  1246. *
  1247. * _.isObject(_.noop);
  1248. * // => true
  1249. *
  1250. * _.isObject(null);
  1251. * // => false
  1252. */
  1253. function isObject(value) {
  1254. var type = typeof value;
  1255. return !!value && (type == 'object' || type == 'function');
  1256. }
  1257. /**
  1258. * Checks if `value` is object-like. A value is object-like if it's not `null`
  1259. * and has a `typeof` result of "object".
  1260. *
  1261. * @static
  1262. * @memberOf _
  1263. * @since 4.0.0
  1264. * @category Lang
  1265. * @param {*} value The value to check.
  1266. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  1267. * @example
  1268. *
  1269. * _.isObjectLike({});
  1270. * // => true
  1271. *
  1272. * _.isObjectLike([1, 2, 3]);
  1273. * // => true
  1274. *
  1275. * _.isObjectLike(_.noop);
  1276. * // => false
  1277. *
  1278. * _.isObjectLike(null);
  1279. * // => false
  1280. */
  1281. function isObjectLike(value) {
  1282. return !!value && typeof value == 'object';
  1283. }
  1284. /**
  1285. * Checks if `value` is classified as a `Symbol` primitive or object.
  1286. *
  1287. * @static
  1288. * @memberOf _
  1289. * @since 4.0.0
  1290. * @category Lang
  1291. * @param {*} value The value to check.
  1292. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  1293. * @example
  1294. *
  1295. * _.isSymbol(Symbol.iterator);
  1296. * // => true
  1297. *
  1298. * _.isSymbol('abc');
  1299. * // => false
  1300. */
  1301. function isSymbol(value) {
  1302. return typeof value == 'symbol' ||
  1303. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  1304. }
  1305. /**
  1306. * Converts `value` to a string. An empty string is returned for `null`
  1307. * and `undefined` values. The sign of `-0` is preserved.
  1308. *
  1309. * @static
  1310. * @memberOf _
  1311. * @since 4.0.0
  1312. * @category Lang
  1313. * @param {*} value The value to process.
  1314. * @returns {string} Returns the string.
  1315. * @example
  1316. *
  1317. * _.toString(null);
  1318. * // => ''
  1319. *
  1320. * _.toString(-0);
  1321. * // => '-0'
  1322. *
  1323. * _.toString([1, 2, 3]);
  1324. * // => '1,2,3'
  1325. */
  1326. function toString(value) {
  1327. return value == null ? '' : baseToString(value);
  1328. }
  1329. /**
  1330. * Gets the value at `path` of `object`. If the resolved value is
  1331. * `undefined`, the `defaultValue` is returned in its place.
  1332. *
  1333. * @static
  1334. * @memberOf _
  1335. * @since 3.7.0
  1336. * @category Object
  1337. * @param {Object} object The object to query.
  1338. * @param {Array|string} path The path of the property to get.
  1339. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  1340. * @returns {*} Returns the resolved value.
  1341. * @example
  1342. *
  1343. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  1344. *
  1345. * _.get(object, 'a[0].b.c');
  1346. * // => 3
  1347. *
  1348. * _.get(object, ['a', '0', 'b', 'c']);
  1349. * // => 3
  1350. *
  1351. * _.get(object, 'a.b.c', 'default');
  1352. * // => 'default'
  1353. */
  1354. function get(object, path, defaultValue) {
  1355. var result = object == null ? undefined : baseGet(object, path);
  1356. return result === undefined ? defaultValue : result;
  1357. }
  1358. module.exports = get;
  1359. /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
  1360. /***/ }),
  1361. /* 4 */
  1362. /***/ (function(module, exports) {
  1363. /* WEBPACK VAR INJECTION */(function(global) {/**
  1364. * lodash (Custom Build) <https://lodash.com/>
  1365. * Build: `lodash modularize exports="npm" -o ./`
  1366. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  1367. * Released under MIT license <https://lodash.com/license>
  1368. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  1369. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  1370. */
  1371. /** Used as references for various `Number` constants. */
  1372. var MAX_SAFE_INTEGER = 9007199254740991;
  1373. /** `Object#toString` result references. */
  1374. var argsTag = '[object Arguments]',
  1375. funcTag = '[object Function]',
  1376. genTag = '[object GeneratorFunction]';
  1377. /** Detect free variable `global` from Node.js. */
  1378. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  1379. /** Detect free variable `self`. */
  1380. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1381. /** Used as a reference to the global object. */
  1382. var root = freeGlobal || freeSelf || Function('return this')();
  1383. /**
  1384. * Appends the elements of `values` to `array`.
  1385. *
  1386. * @private
  1387. * @param {Array} array The array to modify.
  1388. * @param {Array} values The values to append.
  1389. * @returns {Array} Returns `array`.
  1390. */
  1391. function arrayPush(array, values) {
  1392. var index = -1,
  1393. length = values.length,
  1394. offset = array.length;
  1395. while (++index < length) {
  1396. array[offset + index] = values[index];
  1397. }
  1398. return array;
  1399. }
  1400. /** Used for built-in method references. */
  1401. var objectProto = Object.prototype;
  1402. /** Used to check objects for own properties. */
  1403. var hasOwnProperty = objectProto.hasOwnProperty;
  1404. /**
  1405. * Used to resolve the
  1406. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  1407. * of values.
  1408. */
  1409. var objectToString = objectProto.toString;
  1410. /** Built-in value references. */
  1411. var Symbol = root.Symbol,
  1412. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  1413. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
  1414. /**
  1415. * The base implementation of `_.flatten` with support for restricting flattening.
  1416. *
  1417. * @private
  1418. * @param {Array} array The array to flatten.
  1419. * @param {number} depth The maximum recursion depth.
  1420. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  1421. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  1422. * @param {Array} [result=[]] The initial result value.
  1423. * @returns {Array} Returns the new flattened array.
  1424. */
  1425. function baseFlatten(array, depth, predicate, isStrict, result) {
  1426. var index = -1,
  1427. length = array.length;
  1428. predicate || (predicate = isFlattenable);
  1429. result || (result = []);
  1430. while (++index < length) {
  1431. var value = array[index];
  1432. if (depth > 0 && predicate(value)) {
  1433. if (depth > 1) {
  1434. // Recursively flatten arrays (susceptible to call stack limits).
  1435. baseFlatten(value, depth - 1, predicate, isStrict, result);
  1436. } else {
  1437. arrayPush(result, value);
  1438. }
  1439. } else if (!isStrict) {
  1440. result[result.length] = value;
  1441. }
  1442. }
  1443. return result;
  1444. }
  1445. /**
  1446. * Checks if `value` is a flattenable `arguments` object or array.
  1447. *
  1448. * @private
  1449. * @param {*} value The value to check.
  1450. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  1451. */
  1452. function isFlattenable(value) {
  1453. return isArray(value) || isArguments(value) ||
  1454. !!(spreadableSymbol && value && value[spreadableSymbol]);
  1455. }
  1456. /**
  1457. * Flattens `array` a single level deep.
  1458. *
  1459. * @static
  1460. * @memberOf _
  1461. * @since 0.1.0
  1462. * @category Array
  1463. * @param {Array} array The array to flatten.
  1464. * @returns {Array} Returns the new flattened array.
  1465. * @example
  1466. *
  1467. * _.flatten([1, [2, [3, [4]], 5]]);
  1468. * // => [1, 2, [3, [4]], 5]
  1469. */
  1470. function flatten(array) {
  1471. var length = array ? array.length : 0;
  1472. return length ? baseFlatten(array, 1) : [];
  1473. }
  1474. /**
  1475. * Checks if `value` is likely an `arguments` object.
  1476. *
  1477. * @static
  1478. * @memberOf _
  1479. * @since 0.1.0
  1480. * @category Lang
  1481. * @param {*} value The value to check.
  1482. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  1483. * else `false`.
  1484. * @example
  1485. *
  1486. * _.isArguments(function() { return arguments; }());
  1487. * // => true
  1488. *
  1489. * _.isArguments([1, 2, 3]);
  1490. * // => false
  1491. */
  1492. function isArguments(value) {
  1493. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  1494. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  1495. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  1496. }
  1497. /**
  1498. * Checks if `value` is classified as an `Array` object.
  1499. *
  1500. * @static
  1501. * @memberOf _
  1502. * @since 0.1.0
  1503. * @category Lang
  1504. * @param {*} value The value to check.
  1505. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  1506. * @example
  1507. *
  1508. * _.isArray([1, 2, 3]);
  1509. * // => true
  1510. *
  1511. * _.isArray(document.body.children);
  1512. * // => false
  1513. *
  1514. * _.isArray('abc');
  1515. * // => false
  1516. *
  1517. * _.isArray(_.noop);
  1518. * // => false
  1519. */
  1520. var isArray = Array.isArray;
  1521. /**
  1522. * Checks if `value` is array-like. A value is considered array-like if it's
  1523. * not a function and has a `value.length` that's an integer greater than or
  1524. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  1525. *
  1526. * @static
  1527. * @memberOf _
  1528. * @since 4.0.0
  1529. * @category Lang
  1530. * @param {*} value The value to check.
  1531. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  1532. * @example
  1533. *
  1534. * _.isArrayLike([1, 2, 3]);
  1535. * // => true
  1536. *
  1537. * _.isArrayLike(document.body.children);
  1538. * // => true
  1539. *
  1540. * _.isArrayLike('abc');
  1541. * // => true
  1542. *
  1543. * _.isArrayLike(_.noop);
  1544. * // => false
  1545. */
  1546. function isArrayLike(value) {
  1547. return value != null && isLength(value.length) && !isFunction(value);
  1548. }
  1549. /**
  1550. * This method is like `_.isArrayLike` except that it also checks if `value`
  1551. * is an object.
  1552. *
  1553. * @static
  1554. * @memberOf _
  1555. * @since 4.0.0
  1556. * @category Lang
  1557. * @param {*} value The value to check.
  1558. * @returns {boolean} Returns `true` if `value` is an array-like object,
  1559. * else `false`.
  1560. * @example
  1561. *
  1562. * _.isArrayLikeObject([1, 2, 3]);
  1563. * // => true
  1564. *
  1565. * _.isArrayLikeObject(document.body.children);
  1566. * // => true
  1567. *
  1568. * _.isArrayLikeObject('abc');
  1569. * // => false
  1570. *
  1571. * _.isArrayLikeObject(_.noop);
  1572. * // => false
  1573. */
  1574. function isArrayLikeObject(value) {
  1575. return isObjectLike(value) && isArrayLike(value);
  1576. }
  1577. /**
  1578. * Checks if `value` is classified as a `Function` object.
  1579. *
  1580. * @static
  1581. * @memberOf _
  1582. * @since 0.1.0
  1583. * @category Lang
  1584. * @param {*} value The value to check.
  1585. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  1586. * @example
  1587. *
  1588. * _.isFunction(_);
  1589. * // => true
  1590. *
  1591. * _.isFunction(/abc/);
  1592. * // => false
  1593. */
  1594. function isFunction(value) {
  1595. // The use of `Object#toString` avoids issues with the `typeof` operator
  1596. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  1597. var tag = isObject(value) ? objectToString.call(value) : '';
  1598. return tag == funcTag || tag == genTag;
  1599. }
  1600. /**
  1601. * Checks if `value` is a valid array-like length.
  1602. *
  1603. * **Note:** This method is loosely based on
  1604. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  1605. *
  1606. * @static
  1607. * @memberOf _
  1608. * @since 4.0.0
  1609. * @category Lang
  1610. * @param {*} value The value to check.
  1611. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  1612. * @example
  1613. *
  1614. * _.isLength(3);
  1615. * // => true
  1616. *
  1617. * _.isLength(Number.MIN_VALUE);
  1618. * // => false
  1619. *
  1620. * _.isLength(Infinity);
  1621. * // => false
  1622. *
  1623. * _.isLength('3');
  1624. * // => false
  1625. */
  1626. function isLength(value) {
  1627. return typeof value == 'number' &&
  1628. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  1629. }
  1630. /**
  1631. * Checks if `value` is the
  1632. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  1633. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  1634. *
  1635. * @static
  1636. * @memberOf _
  1637. * @since 0.1.0
  1638. * @category Lang
  1639. * @param {*} value The value to check.
  1640. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  1641. * @example
  1642. *
  1643. * _.isObject({});
  1644. * // => true
  1645. *
  1646. * _.isObject([1, 2, 3]);
  1647. * // => true
  1648. *
  1649. * _.isObject(_.noop);
  1650. * // => true
  1651. *
  1652. * _.isObject(null);
  1653. * // => false
  1654. */
  1655. function isObject(value) {
  1656. var type = typeof value;
  1657. return !!value && (type == 'object' || type == 'function');
  1658. }
  1659. /**
  1660. * Checks if `value` is object-like. A value is object-like if it's not `null`
  1661. * and has a `typeof` result of "object".
  1662. *
  1663. * @static
  1664. * @memberOf _
  1665. * @since 4.0.0
  1666. * @category Lang
  1667. * @param {*} value The value to check.
  1668. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  1669. * @example
  1670. *
  1671. * _.isObjectLike({});
  1672. * // => true
  1673. *
  1674. * _.isObjectLike([1, 2, 3]);
  1675. * // => true
  1676. *
  1677. * _.isObjectLike(_.noop);
  1678. * // => false
  1679. *
  1680. * _.isObjectLike(null);
  1681. * // => false
  1682. */
  1683. function isObjectLike(value) {
  1684. return !!value && typeof value == 'object';
  1685. }
  1686. module.exports = flatten;
  1687. /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
  1688. /***/ }),
  1689. /* 5 */
  1690. /***/ (function(module, exports) {
  1691. /* WEBPACK VAR INJECTION */(function(global) {/**
  1692. * lodash (Custom Build) <https://lodash.com/>
  1693. * Build: `lodash modularize exports="npm" -o ./`
  1694. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  1695. * Released under MIT license <https://lodash.com/license>
  1696. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  1697. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  1698. */
  1699. /** Used as the size to enable large array optimizations. */
  1700. var LARGE_ARRAY_SIZE = 200;
  1701. /** Used to stand-in for `undefined` hash values. */
  1702. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  1703. /** Used as references for various `Number` constants. */
  1704. var INFINITY = 1 / 0;
  1705. /** `Object#toString` result references. */
  1706. var funcTag = '[object Function]',
  1707. genTag = '[object GeneratorFunction]';
  1708. /**
  1709. * Used to match `RegExp`
  1710. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1711. */
  1712. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  1713. /** Used to detect host constructors (Safari). */
  1714. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1715. /** Detect free variable `global` from Node.js. */
  1716. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  1717. /** Detect free variable `self`. */
  1718. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1719. /** Used as a reference to the global object. */
  1720. var root = freeGlobal || freeSelf || Function('return this')();
  1721. /**
  1722. * A specialized version of `_.includes` for arrays without support for
  1723. * specifying an index to search from.
  1724. *
  1725. * @private
  1726. * @param {Array} [array] The array to inspect.
  1727. * @param {*} target The value to search for.
  1728. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1729. */
  1730. function arrayIncludes(array, value) {
  1731. var length = array ? array.length : 0;
  1732. return !!length && baseIndexOf(array, value, 0) > -1;
  1733. }
  1734. /**
  1735. * This function is like `arrayIncludes` except that it accepts a comparator.
  1736. *
  1737. * @private
  1738. * @param {Array} [array] The array to inspect.
  1739. * @param {*} target The value to search for.
  1740. * @param {Function} comparator The comparator invoked per element.
  1741. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  1742. */
  1743. function arrayIncludesWith(array, value, comparator) {
  1744. var index = -1,
  1745. length = array ? array.length : 0;
  1746. while (++index < length) {
  1747. if (comparator(value, array[index])) {
  1748. return true;
  1749. }
  1750. }
  1751. return false;
  1752. }
  1753. /**
  1754. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  1755. * support for iteratee shorthands.
  1756. *
  1757. * @private
  1758. * @param {Array} array The array to inspect.
  1759. * @param {Function} predicate The function invoked per iteration.
  1760. * @param {number} fromIndex The index to search from.
  1761. * @param {boolean} [fromRight] Specify iterating from right to left.
  1762. * @returns {number} Returns the index of the matched value, else `-1`.
  1763. */
  1764. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  1765. var length = array.length,
  1766. index = fromIndex + (fromRight ? 1 : -1);
  1767. while ((fromRight ? index-- : ++index < length)) {
  1768. if (predicate(array[index], index, array)) {
  1769. return index;
  1770. }
  1771. }
  1772. return -1;
  1773. }
  1774. /**
  1775. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  1776. *
  1777. * @private
  1778. * @param {Array} array The array to inspect.
  1779. * @param {*} value The value to search for.
  1780. * @param {number} fromIndex The index to search from.
  1781. * @returns {number} Returns the index of the matched value, else `-1`.
  1782. */
  1783. function baseIndexOf(array, value, fromIndex) {
  1784. if (value !== value) {
  1785. return baseFindIndex(array, baseIsNaN, fromIndex);
  1786. }
  1787. var index = fromIndex - 1,
  1788. length = array.length;
  1789. while (++index < length) {
  1790. if (array[index] === value) {
  1791. return index;
  1792. }
  1793. }
  1794. return -1;
  1795. }
  1796. /**
  1797. * The base implementation of `_.isNaN` without support for number objects.
  1798. *
  1799. * @private
  1800. * @param {*} value The value to check.
  1801. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  1802. */
  1803. function baseIsNaN(value) {
  1804. return value !== value;
  1805. }
  1806. /**
  1807. * Checks if a cache value for `key` exists.
  1808. *
  1809. * @private
  1810. * @param {Object} cache The cache to query.
  1811. * @param {string} key The key of the entry to check.
  1812. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1813. */
  1814. function cacheHas(cache, key) {
  1815. return cache.has(key);
  1816. }
  1817. /**
  1818. * Gets the value at `key` of `object`.
  1819. *
  1820. * @private
  1821. * @param {Object} [object] The object to query.
  1822. * @param {string} key The key of the property to get.
  1823. * @returns {*} Returns the property value.
  1824. */
  1825. function getValue(object, key) {
  1826. return object == null ? undefined : object[key];
  1827. }
  1828. /**
  1829. * Checks if `value` is a host object in IE < 9.
  1830. *
  1831. * @private
  1832. * @param {*} value The value to check.
  1833. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  1834. */
  1835. function isHostObject(value) {
  1836. // Many host objects are `Object` objects that can coerce to strings
  1837. // despite having improperly defined `toString` methods.
  1838. var result = false;
  1839. if (value != null && typeof value.toString != 'function') {
  1840. try {
  1841. result = !!(value + '');
  1842. } catch (e) {}
  1843. }
  1844. return result;
  1845. }
  1846. /**
  1847. * Converts `set` to an array of its values.
  1848. *
  1849. * @private
  1850. * @param {Object} set The set to convert.
  1851. * @returns {Array} Returns the values.
  1852. */
  1853. function setToArray(set) {
  1854. var index = -1,
  1855. result = Array(set.size);
  1856. set.forEach(function(value) {
  1857. result[++index] = value;
  1858. });
  1859. return result;
  1860. }
  1861. /** Used for built-in method references. */
  1862. var arrayProto = Array.prototype,
  1863. funcProto = Function.prototype,
  1864. objectProto = Object.prototype;
  1865. /** Used to detect overreaching core-js shims. */
  1866. var coreJsData = root['__core-js_shared__'];
  1867. /** Used to detect methods masquerading as native. */
  1868. var maskSrcKey = (function() {
  1869. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  1870. return uid ? ('Symbol(src)_1.' + uid) : '';
  1871. }());
  1872. /** Used to resolve the decompiled source of functions. */
  1873. var funcToString = funcProto.toString;
  1874. /** Used to check objects for own properties. */
  1875. var hasOwnProperty = objectProto.hasOwnProperty;
  1876. /**
  1877. * Used to resolve the
  1878. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  1879. * of values.
  1880. */
  1881. var objectToString = objectProto.toString;
  1882. /** Used to detect if a method is native. */
  1883. var reIsNative = RegExp('^' +
  1884. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  1885. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  1886. );
  1887. /** Built-in value references. */
  1888. var splice = arrayProto.splice;
  1889. /* Built-in method references that are verified to be native. */
  1890. var Map = getNative(root, 'Map'),
  1891. Set = getNative(root, 'Set'),
  1892. nativeCreate = getNative(Object, 'create');
  1893. /**
  1894. * Creates a hash object.
  1895. *
  1896. * @private
  1897. * @constructor
  1898. * @param {Array} [entries] The key-value pairs to cache.
  1899. */
  1900. function Hash(entries) {
  1901. var index = -1,
  1902. length = entries ? entries.length : 0;
  1903. this.clear();
  1904. while (++index < length) {
  1905. var entry = entries[index];
  1906. this.set(entry[0], entry[1]);
  1907. }
  1908. }
  1909. /**
  1910. * Removes all key-value entries from the hash.
  1911. *
  1912. * @private
  1913. * @name clear
  1914. * @memberOf Hash
  1915. */
  1916. function hashClear() {
  1917. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  1918. }
  1919. /**
  1920. * Removes `key` and its value from the hash.
  1921. *
  1922. * @private
  1923. * @name delete
  1924. * @memberOf Hash
  1925. * @param {Object} hash The hash to modify.
  1926. * @param {string} key The key of the value to remove.
  1927. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1928. */
  1929. function hashDelete(key) {
  1930. return this.has(key) && delete this.__data__[key];
  1931. }
  1932. /**
  1933. * Gets the hash value for `key`.
  1934. *
  1935. * @private
  1936. * @name get
  1937. * @memberOf Hash
  1938. * @param {string} key The key of the value to get.
  1939. * @returns {*} Returns the entry value.
  1940. */
  1941. function hashGet(key) {
  1942. var data = this.__data__;
  1943. if (nativeCreate) {
  1944. var result = data[key];
  1945. return result === HASH_UNDEFINED ? undefined : result;
  1946. }
  1947. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  1948. }
  1949. /**
  1950. * Checks if a hash value for `key` exists.
  1951. *
  1952. * @private
  1953. * @name has
  1954. * @memberOf Hash
  1955. * @param {string} key The key of the entry to check.
  1956. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1957. */
  1958. function hashHas(key) {
  1959. var data = this.__data__;
  1960. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  1961. }
  1962. /**
  1963. * Sets the hash `key` to `value`.
  1964. *
  1965. * @private
  1966. * @name set
  1967. * @memberOf Hash
  1968. * @param {string} key The key of the value to set.
  1969. * @param {*} value The value to set.
  1970. * @returns {Object} Returns the hash instance.
  1971. */
  1972. function hashSet(key, value) {
  1973. var data = this.__data__;
  1974. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  1975. return this;
  1976. }
  1977. // Add methods to `Hash`.
  1978. Hash.prototype.clear = hashClear;
  1979. Hash.prototype['delete'] = hashDelete;
  1980. Hash.prototype.get = hashGet;
  1981. Hash.prototype.has = hashHas;
  1982. Hash.prototype.set = hashSet;
  1983. /**
  1984. * Creates an list cache object.
  1985. *
  1986. * @private
  1987. * @constructor
  1988. * @param {Array} [entries] The key-value pairs to cache.
  1989. */
  1990. function ListCache(entries) {
  1991. var index = -1,
  1992. length = entries ? entries.length : 0;
  1993. this.clear();
  1994. while (++index < length) {
  1995. var entry = entries[index];
  1996. this.set(entry[0], entry[1]);
  1997. }
  1998. }
  1999. /**
  2000. * Removes all key-value entries from the list cache.
  2001. *
  2002. * @private
  2003. * @name clear
  2004. * @memberOf ListCache
  2005. */
  2006. function listCacheClear() {
  2007. this.__data__ = [];
  2008. }
  2009. /**
  2010. * Removes `key` and its value from the list cache.
  2011. *
  2012. * @private
  2013. * @name delete
  2014. * @memberOf ListCache
  2015. * @param {string} key The key of the value to remove.
  2016. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2017. */
  2018. function listCacheDelete(key) {
  2019. var data = this.__data__,
  2020. index = assocIndexOf(data, key);
  2021. if (index < 0) {
  2022. return false;
  2023. }
  2024. var lastIndex = data.length - 1;
  2025. if (index == lastIndex) {
  2026. data.pop();
  2027. } else {
  2028. splice.call(data, index, 1);
  2029. }
  2030. return true;
  2031. }
  2032. /**
  2033. * Gets the list cache value for `key`.
  2034. *
  2035. * @private
  2036. * @name get
  2037. * @memberOf ListCache
  2038. * @param {string} key The key of the value to get.
  2039. * @returns {*} Returns the entry value.
  2040. */
  2041. function listCacheGet(key) {
  2042. var data = this.__data__,
  2043. index = assocIndexOf(data, key);
  2044. return index < 0 ? undefined : data[index][1];
  2045. }
  2046. /**
  2047. * Checks if a list cache value for `key` exists.
  2048. *
  2049. * @private
  2050. * @name has
  2051. * @memberOf ListCache
  2052. * @param {string} key The key of the entry to check.
  2053. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2054. */
  2055. function listCacheHas(key) {
  2056. return assocIndexOf(this.__data__, key) > -1;
  2057. }
  2058. /**
  2059. * Sets the list cache `key` to `value`.
  2060. *
  2061. * @private
  2062. * @name set
  2063. * @memberOf ListCache
  2064. * @param {string} key The key of the value to set.
  2065. * @param {*} value The value to set.
  2066. * @returns {Object} Returns the list cache instance.
  2067. */
  2068. function listCacheSet(key, value) {
  2069. var data = this.__data__,
  2070. index = assocIndexOf(data, key);
  2071. if (index < 0) {
  2072. data.push([key, value]);
  2073. } else {
  2074. data[index][1] = value;
  2075. }
  2076. return this;
  2077. }
  2078. // Add methods to `ListCache`.
  2079. ListCache.prototype.clear = listCacheClear;
  2080. ListCache.prototype['delete'] = listCacheDelete;
  2081. ListCache.prototype.get = listCacheGet;
  2082. ListCache.prototype.has = listCacheHas;
  2083. ListCache.prototype.set = listCacheSet;
  2084. /**
  2085. * Creates a map cache object to store key-value pairs.
  2086. *
  2087. * @private
  2088. * @constructor
  2089. * @param {Array} [entries] The key-value pairs to cache.
  2090. */
  2091. function MapCache(entries) {
  2092. var index = -1,
  2093. length = entries ? entries.length : 0;
  2094. this.clear();
  2095. while (++index < length) {
  2096. var entry = entries[index];
  2097. this.set(entry[0], entry[1]);
  2098. }
  2099. }
  2100. /**
  2101. * Removes all key-value entries from the map.
  2102. *
  2103. * @private
  2104. * @name clear
  2105. * @memberOf MapCache
  2106. */
  2107. function mapCacheClear() {
  2108. this.__data__ = {
  2109. 'hash': new Hash,
  2110. 'map': new (Map || ListCache),
  2111. 'string': new Hash
  2112. };
  2113. }
  2114. /**
  2115. * Removes `key` and its value from the map.
  2116. *
  2117. * @private
  2118. * @name delete
  2119. * @memberOf MapCache
  2120. * @param {string} key The key of the value to remove.
  2121. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2122. */
  2123. function mapCacheDelete(key) {
  2124. return getMapData(this, key)['delete'](key);
  2125. }
  2126. /**
  2127. * Gets the map value for `key`.
  2128. *
  2129. * @private
  2130. * @name get
  2131. * @memberOf MapCache
  2132. * @param {string} key The key of the value to get.
  2133. * @returns {*} Returns the entry value.
  2134. */
  2135. function mapCacheGet(key) {
  2136. return getMapData(this, key).get(key);
  2137. }
  2138. /**
  2139. * Checks if a map value for `key` exists.
  2140. *
  2141. * @private
  2142. * @name has
  2143. * @memberOf MapCache
  2144. * @param {string} key The key of the entry to check.
  2145. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2146. */
  2147. function mapCacheHas(key) {
  2148. return getMapData(this, key).has(key);
  2149. }
  2150. /**
  2151. * Sets the map `key` to `value`.
  2152. *
  2153. * @private
  2154. * @name set
  2155. * @memberOf MapCache
  2156. * @param {string} key The key of the value to set.
  2157. * @param {*} value The value to set.
  2158. * @returns {Object} Returns the map cache instance.
  2159. */
  2160. function mapCacheSet(key, value) {
  2161. getMapData(this, key).set(key, value);
  2162. return this;
  2163. }
  2164. // Add methods to `MapCache`.
  2165. MapCache.prototype.clear = mapCacheClear;
  2166. MapCache.prototype['delete'] = mapCacheDelete;
  2167. MapCache.prototype.get = mapCacheGet;
  2168. MapCache.prototype.has = mapCacheHas;
  2169. MapCache.prototype.set = mapCacheSet;
  2170. /**
  2171. *
  2172. * Creates an array cache object to store unique values.
  2173. *
  2174. * @private
  2175. * @constructor
  2176. * @param {Array} [values] The values to cache.
  2177. */
  2178. function SetCache(values) {
  2179. var index = -1,
  2180. length = values ? values.length : 0;
  2181. this.__data__ = new MapCache;
  2182. while (++index < length) {
  2183. this.add(values[index]);
  2184. }
  2185. }
  2186. /**
  2187. * Adds `value` to the array cache.
  2188. *
  2189. * @private
  2190. * @name add
  2191. * @memberOf SetCache
  2192. * @alias push
  2193. * @param {*} value The value to cache.
  2194. * @returns {Object} Returns the cache instance.
  2195. */
  2196. function setCacheAdd(value) {
  2197. this.__data__.set(value, HASH_UNDEFINED);
  2198. return this;
  2199. }
  2200. /**
  2201. * Checks if `value` is in the array cache.
  2202. *
  2203. * @private
  2204. * @name has
  2205. * @memberOf SetCache
  2206. * @param {*} value The value to search for.
  2207. * @returns {number} Returns `true` if `value` is found, else `false`.
  2208. */
  2209. function setCacheHas(value) {
  2210. return this.__data__.has(value);
  2211. }
  2212. // Add methods to `SetCache`.
  2213. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  2214. SetCache.prototype.has = setCacheHas;
  2215. /**
  2216. * Gets the index at which the `key` is found in `array` of key-value pairs.
  2217. *
  2218. * @private
  2219. * @param {Array} array The array to inspect.
  2220. * @param {*} key The key to search for.
  2221. * @returns {number} Returns the index of the matched value, else `-1`.
  2222. */
  2223. function assocIndexOf(array, key) {
  2224. var length = array.length;
  2225. while (length--) {
  2226. if (eq(array[length][0], key)) {
  2227. return length;
  2228. }
  2229. }
  2230. return -1;
  2231. }
  2232. /**
  2233. * The base implementation of `_.isNative` without bad shim checks.
  2234. *
  2235. * @private
  2236. * @param {*} value The value to check.
  2237. * @returns {boolean} Returns `true` if `value` is a native function,
  2238. * else `false`.
  2239. */
  2240. function baseIsNative(value) {
  2241. if (!isObject(value) || isMasked(value)) {
  2242. return false;
  2243. }
  2244. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  2245. return pattern.test(toSource(value));
  2246. }
  2247. /**
  2248. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  2249. *
  2250. * @private
  2251. * @param {Array} array The array to inspect.
  2252. * @param {Function} [iteratee] The iteratee invoked per element.
  2253. * @param {Function} [comparator] The comparator invoked per element.
  2254. * @returns {Array} Returns the new duplicate free array.
  2255. */
  2256. function baseUniq(array, iteratee, comparator) {
  2257. var index = -1,
  2258. includes = arrayIncludes,
  2259. length = array.length,
  2260. isCommon = true,
  2261. result = [],
  2262. seen = result;
  2263. if (comparator) {
  2264. isCommon = false;
  2265. includes = arrayIncludesWith;
  2266. }
  2267. else if (length >= LARGE_ARRAY_SIZE) {
  2268. var set = iteratee ? null : createSet(array);
  2269. if (set) {
  2270. return setToArray(set);
  2271. }
  2272. isCommon = false;
  2273. includes = cacheHas;
  2274. seen = new SetCache;
  2275. }
  2276. else {
  2277. seen = iteratee ? [] : result;
  2278. }
  2279. outer:
  2280. while (++index < length) {
  2281. var value = array[index],
  2282. computed = iteratee ? iteratee(value) : value;
  2283. value = (comparator || value !== 0) ? value : 0;
  2284. if (isCommon && computed === computed) {
  2285. var seenIndex = seen.length;
  2286. while (seenIndex--) {
  2287. if (seen[seenIndex] === computed) {
  2288. continue outer;
  2289. }
  2290. }
  2291. if (iteratee) {
  2292. seen.push(computed);
  2293. }
  2294. result.push(value);
  2295. }
  2296. else if (!includes(seen, computed, comparator)) {
  2297. if (seen !== result) {
  2298. seen.push(computed);
  2299. }
  2300. result.push(value);
  2301. }
  2302. }
  2303. return result;
  2304. }
  2305. /**
  2306. * Creates a set object of `values`.
  2307. *
  2308. * @private
  2309. * @param {Array} values The values to add to the set.
  2310. * @returns {Object} Returns the new set.
  2311. */
  2312. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  2313. return new Set(values);
  2314. };
  2315. /**
  2316. * Gets the data for `map`.
  2317. *
  2318. * @private
  2319. * @param {Object} map The map to query.
  2320. * @param {string} key The reference key.
  2321. * @returns {*} Returns the map data.
  2322. */
  2323. function getMapData(map, key) {
  2324. var data = map.__data__;
  2325. return isKeyable(key)
  2326. ? data[typeof key == 'string' ? 'string' : 'hash']
  2327. : data.map;
  2328. }
  2329. /**
  2330. * Gets the native function at `key` of `object`.
  2331. *
  2332. * @private
  2333. * @param {Object} object The object to query.
  2334. * @param {string} key The key of the method to get.
  2335. * @returns {*} Returns the function if it's native, else `undefined`.
  2336. */
  2337. function getNative(object, key) {
  2338. var value = getValue(object, key);
  2339. return baseIsNative(value) ? value : undefined;
  2340. }
  2341. /**
  2342. * Checks if `value` is suitable for use as unique object key.
  2343. *
  2344. * @private
  2345. * @param {*} value The value to check.
  2346. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  2347. */
  2348. function isKeyable(value) {
  2349. var type = typeof value;
  2350. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  2351. ? (value !== '__proto__')
  2352. : (value === null);
  2353. }
  2354. /**
  2355. * Checks if `func` has its source masked.
  2356. *
  2357. * @private
  2358. * @param {Function} func The function to check.
  2359. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  2360. */
  2361. function isMasked(func) {
  2362. return !!maskSrcKey && (maskSrcKey in func);
  2363. }
  2364. /**
  2365. * Converts `func` to its source code.
  2366. *
  2367. * @private
  2368. * @param {Function} func The function to process.
  2369. * @returns {string} Returns the source code.
  2370. */
  2371. function toSource(func) {
  2372. if (func != null) {
  2373. try {
  2374. return funcToString.call(func);
  2375. } catch (e) {}
  2376. try {
  2377. return (func + '');
  2378. } catch (e) {}
  2379. }
  2380. return '';
  2381. }
  2382. /**
  2383. * Creates a duplicate-free version of an array, using
  2384. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  2385. * for equality comparisons, in which only the first occurrence of each
  2386. * element is kept.
  2387. *
  2388. * @static
  2389. * @memberOf _
  2390. * @since 0.1.0
  2391. * @category Array
  2392. * @param {Array} array The array to inspect.
  2393. * @returns {Array} Returns the new duplicate free array.
  2394. * @example
  2395. *
  2396. * _.uniq([2, 1, 2]);
  2397. * // => [2, 1]
  2398. */
  2399. function uniq(array) {
  2400. return (array && array.length)
  2401. ? baseUniq(array)
  2402. : [];
  2403. }
  2404. /**
  2405. * Performs a
  2406. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  2407. * comparison between two values to determine if they are equivalent.
  2408. *
  2409. * @static
  2410. * @memberOf _
  2411. * @since 4.0.0
  2412. * @category Lang
  2413. * @param {*} value The value to compare.
  2414. * @param {*} other The other value to compare.
  2415. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  2416. * @example
  2417. *
  2418. * var object = { 'a': 1 };
  2419. * var other = { 'a': 1 };
  2420. *
  2421. * _.eq(object, object);
  2422. * // => true
  2423. *
  2424. * _.eq(object, other);
  2425. * // => false
  2426. *
  2427. * _.eq('a', 'a');
  2428. * // => true
  2429. *
  2430. * _.eq('a', Object('a'));
  2431. * // => false
  2432. *
  2433. * _.eq(NaN, NaN);
  2434. * // => true
  2435. */
  2436. function eq(value, other) {
  2437. return value === other || (value !== value && other !== other);
  2438. }
  2439. /**
  2440. * Checks if `value` is classified as a `Function` object.
  2441. *
  2442. * @static
  2443. * @memberOf _
  2444. * @since 0.1.0
  2445. * @category Lang
  2446. * @param {*} value The value to check.
  2447. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  2448. * @example
  2449. *
  2450. * _.isFunction(_);
  2451. * // => true
  2452. *
  2453. * _.isFunction(/abc/);
  2454. * // => false
  2455. */
  2456. function isFunction(value) {
  2457. // The use of `Object#toString` avoids issues with the `typeof` operator
  2458. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  2459. var tag = isObject(value) ? objectToString.call(value) : '';
  2460. return tag == funcTag || tag == genTag;
  2461. }
  2462. /**
  2463. * Checks if `value` is the
  2464. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  2465. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  2466. *
  2467. * @static
  2468. * @memberOf _
  2469. * @since 0.1.0
  2470. * @category Lang
  2471. * @param {*} value The value to check.
  2472. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  2473. * @example
  2474. *
  2475. * _.isObject({});
  2476. * // => true
  2477. *
  2478. * _.isObject([1, 2, 3]);
  2479. * // => true
  2480. *
  2481. * _.isObject(_.noop);
  2482. * // => true
  2483. *
  2484. * _.isObject(null);
  2485. * // => false
  2486. */
  2487. function isObject(value) {
  2488. var type = typeof value;
  2489. return !!value && (type == 'object' || type == 'function');
  2490. }
  2491. /**
  2492. * This method returns `undefined`.
  2493. *
  2494. * @static
  2495. * @memberOf _
  2496. * @since 2.3.0
  2497. * @category Util
  2498. * @example
  2499. *
  2500. * _.times(2, _.noop);
  2501. * // => [undefined, undefined]
  2502. */
  2503. function noop() {
  2504. // No operation performed.
  2505. }
  2506. module.exports = uniq;
  2507. /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
  2508. /***/ }),
  2509. /* 6 */
  2510. /***/ (function(module, exports) {
  2511. /* WEBPACK VAR INJECTION */(function(global) {/**
  2512. * lodash (Custom Build) <https://lodash.com/>
  2513. * Build: `lodash modularize exports="npm" -o ./`
  2514. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  2515. * Released under MIT license <https://lodash.com/license>
  2516. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  2517. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  2518. */
  2519. /** Used as the `TypeError` message for "Functions" methods. */
  2520. var FUNC_ERROR_TEXT = 'Expected a function';
  2521. /** Used to stand-in for `undefined` hash values. */
  2522. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  2523. /** Used as references for various `Number` constants. */
  2524. var INFINITY = 1 / 0,
  2525. MAX_SAFE_INTEGER = 9007199254740991;
  2526. /** `Object#toString` result references. */
  2527. var funcTag = '[object Function]',
  2528. genTag = '[object GeneratorFunction]',
  2529. symbolTag = '[object Symbol]';
  2530. /** Used to match property names within property paths. */
  2531. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  2532. reIsPlainProp = /^\w*$/,
  2533. reLeadingDot = /^\./,
  2534. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  2535. /**
  2536. * Used to match `RegExp`
  2537. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  2538. */
  2539. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  2540. /** Used to match backslashes in property paths. */
  2541. var reEscapeChar = /\\(\\)?/g;
  2542. /** Used to detect host constructors (Safari). */
  2543. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  2544. /** Used to detect unsigned integer values. */
  2545. var reIsUint = /^(?:0|[1-9]\d*)$/;
  2546. /** Detect free variable `global` from Node.js. */
  2547. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  2548. /** Detect free variable `self`. */
  2549. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  2550. /** Used as a reference to the global object. */
  2551. var root = freeGlobal || freeSelf || Function('return this')();
  2552. /**
  2553. * Gets the value at `key` of `object`.
  2554. *
  2555. * @private
  2556. * @param {Object} [object] The object to query.
  2557. * @param {string} key The key of the property to get.
  2558. * @returns {*} Returns the property value.
  2559. */
  2560. function getValue(object, key) {
  2561. return object == null ? undefined : object[key];
  2562. }
  2563. /**
  2564. * Checks if `value` is a host object in IE < 9.
  2565. *
  2566. * @private
  2567. * @param {*} value The value to check.
  2568. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  2569. */
  2570. function isHostObject(value) {
  2571. // Many host objects are `Object` objects that can coerce to strings
  2572. // despite having improperly defined `toString` methods.
  2573. var result = false;
  2574. if (value != null && typeof value.toString != 'function') {
  2575. try {
  2576. result = !!(value + '');
  2577. } catch (e) {}
  2578. }
  2579. return result;
  2580. }
  2581. /** Used for built-in method references. */
  2582. var arrayProto = Array.prototype,
  2583. funcProto = Function.prototype,
  2584. objectProto = Object.prototype;
  2585. /** Used to detect overreaching core-js shims. */
  2586. var coreJsData = root['__core-js_shared__'];
  2587. /** Used to detect methods masquerading as native. */
  2588. var maskSrcKey = (function() {
  2589. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  2590. return uid ? ('Symbol(src)_1.' + uid) : '';
  2591. }());
  2592. /** Used to resolve the decompiled source of functions. */
  2593. var funcToString = funcProto.toString;
  2594. /** Used to check objects for own properties. */
  2595. var hasOwnProperty = objectProto.hasOwnProperty;
  2596. /**
  2597. * Used to resolve the
  2598. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  2599. * of values.
  2600. */
  2601. var objectToString = objectProto.toString;
  2602. /** Used to detect if a method is native. */
  2603. var reIsNative = RegExp('^' +
  2604. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  2605. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  2606. );
  2607. /** Built-in value references. */
  2608. var Symbol = root.Symbol,
  2609. splice = arrayProto.splice;
  2610. /* Built-in method references that are verified to be native. */
  2611. var Map = getNative(root, 'Map'),
  2612. nativeCreate = getNative(Object, 'create');
  2613. /** Used to convert symbols to primitives and strings. */
  2614. var symbolProto = Symbol ? Symbol.prototype : undefined,
  2615. symbolToString = symbolProto ? symbolProto.toString : undefined;
  2616. /**
  2617. * Creates a hash object.
  2618. *
  2619. * @private
  2620. * @constructor
  2621. * @param {Array} [entries] The key-value pairs to cache.
  2622. */
  2623. function Hash(entries) {
  2624. var index = -1,
  2625. length = entries ? entries.length : 0;
  2626. this.clear();
  2627. while (++index < length) {
  2628. var entry = entries[index];
  2629. this.set(entry[0], entry[1]);
  2630. }
  2631. }
  2632. /**
  2633. * Removes all key-value entries from the hash.
  2634. *
  2635. * @private
  2636. * @name clear
  2637. * @memberOf Hash
  2638. */
  2639. function hashClear() {
  2640. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  2641. }
  2642. /**
  2643. * Removes `key` and its value from the hash.
  2644. *
  2645. * @private
  2646. * @name delete
  2647. * @memberOf Hash
  2648. * @param {Object} hash The hash to modify.
  2649. * @param {string} key The key of the value to remove.
  2650. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2651. */
  2652. function hashDelete(key) {
  2653. return this.has(key) && delete this.__data__[key];
  2654. }
  2655. /**
  2656. * Gets the hash value for `key`.
  2657. *
  2658. * @private
  2659. * @name get
  2660. * @memberOf Hash
  2661. * @param {string} key The key of the value to get.
  2662. * @returns {*} Returns the entry value.
  2663. */
  2664. function hashGet(key) {
  2665. var data = this.__data__;
  2666. if (nativeCreate) {
  2667. var result = data[key];
  2668. return result === HASH_UNDEFINED ? undefined : result;
  2669. }
  2670. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  2671. }
  2672. /**
  2673. * Checks if a hash value for `key` exists.
  2674. *
  2675. * @private
  2676. * @name has
  2677. * @memberOf Hash
  2678. * @param {string} key The key of the entry to check.
  2679. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2680. */
  2681. function hashHas(key) {
  2682. var data = this.__data__;
  2683. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  2684. }
  2685. /**
  2686. * Sets the hash `key` to `value`.
  2687. *
  2688. * @private
  2689. * @name set
  2690. * @memberOf Hash
  2691. * @param {string} key The key of the value to set.
  2692. * @param {*} value The value to set.
  2693. * @returns {Object} Returns the hash instance.
  2694. */
  2695. function hashSet(key, value) {
  2696. var data = this.__data__;
  2697. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  2698. return this;
  2699. }
  2700. // Add methods to `Hash`.
  2701. Hash.prototype.clear = hashClear;
  2702. Hash.prototype['delete'] = hashDelete;
  2703. Hash.prototype.get = hashGet;
  2704. Hash.prototype.has = hashHas;
  2705. Hash.prototype.set = hashSet;
  2706. /**
  2707. * Creates an list cache object.
  2708. *
  2709. * @private
  2710. * @constructor
  2711. * @param {Array} [entries] The key-value pairs to cache.
  2712. */
  2713. function ListCache(entries) {
  2714. var index = -1,
  2715. length = entries ? entries.length : 0;
  2716. this.clear();
  2717. while (++index < length) {
  2718. var entry = entries[index];
  2719. this.set(entry[0], entry[1]);
  2720. }
  2721. }
  2722. /**
  2723. * Removes all key-value entries from the list cache.
  2724. *
  2725. * @private
  2726. * @name clear
  2727. * @memberOf ListCache
  2728. */
  2729. function listCacheClear() {
  2730. this.__data__ = [];
  2731. }
  2732. /**
  2733. * Removes `key` and its value from the list cache.
  2734. *
  2735. * @private
  2736. * @name delete
  2737. * @memberOf ListCache
  2738. * @param {string} key The key of the value to remove.
  2739. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2740. */
  2741. function listCacheDelete(key) {
  2742. var data = this.__data__,
  2743. index = assocIndexOf(data, key);
  2744. if (index < 0) {
  2745. return false;
  2746. }
  2747. var lastIndex = data.length - 1;
  2748. if (index == lastIndex) {
  2749. data.pop();
  2750. } else {
  2751. splice.call(data, index, 1);
  2752. }
  2753. return true;
  2754. }
  2755. /**
  2756. * Gets the list cache value for `key`.
  2757. *
  2758. * @private
  2759. * @name get
  2760. * @memberOf ListCache
  2761. * @param {string} key The key of the value to get.
  2762. * @returns {*} Returns the entry value.
  2763. */
  2764. function listCacheGet(key) {
  2765. var data = this.__data__,
  2766. index = assocIndexOf(data, key);
  2767. return index < 0 ? undefined : data[index][1];
  2768. }
  2769. /**
  2770. * Checks if a list cache value for `key` exists.
  2771. *
  2772. * @private
  2773. * @name has
  2774. * @memberOf ListCache
  2775. * @param {string} key The key of the entry to check.
  2776. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2777. */
  2778. function listCacheHas(key) {
  2779. return assocIndexOf(this.__data__, key) > -1;
  2780. }
  2781. /**
  2782. * Sets the list cache `key` to `value`.
  2783. *
  2784. * @private
  2785. * @name set
  2786. * @memberOf ListCache
  2787. * @param {string} key The key of the value to set.
  2788. * @param {*} value The value to set.
  2789. * @returns {Object} Returns the list cache instance.
  2790. */
  2791. function listCacheSet(key, value) {
  2792. var data = this.__data__,
  2793. index = assocIndexOf(data, key);
  2794. if (index < 0) {
  2795. data.push([key, value]);
  2796. } else {
  2797. data[index][1] = value;
  2798. }
  2799. return this;
  2800. }
  2801. // Add methods to `ListCache`.
  2802. ListCache.prototype.clear = listCacheClear;
  2803. ListCache.prototype['delete'] = listCacheDelete;
  2804. ListCache.prototype.get = listCacheGet;
  2805. ListCache.prototype.has = listCacheHas;
  2806. ListCache.prototype.set = listCacheSet;
  2807. /**
  2808. * Creates a map cache object to store key-value pairs.
  2809. *
  2810. * @private
  2811. * @constructor
  2812. * @param {Array} [entries] The key-value pairs to cache.
  2813. */
  2814. function MapCache(entries) {
  2815. var index = -1,
  2816. length = entries ? entries.length : 0;
  2817. this.clear();
  2818. while (++index < length) {
  2819. var entry = entries[index];
  2820. this.set(entry[0], entry[1]);
  2821. }
  2822. }
  2823. /**
  2824. * Removes all key-value entries from the map.
  2825. *
  2826. * @private
  2827. * @name clear
  2828. * @memberOf MapCache
  2829. */
  2830. function mapCacheClear() {
  2831. this.__data__ = {
  2832. 'hash': new Hash,
  2833. 'map': new (Map || ListCache),
  2834. 'string': new Hash
  2835. };
  2836. }
  2837. /**
  2838. * Removes `key` and its value from the map.
  2839. *
  2840. * @private
  2841. * @name delete
  2842. * @memberOf MapCache
  2843. * @param {string} key The key of the value to remove.
  2844. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2845. */
  2846. function mapCacheDelete(key) {
  2847. return getMapData(this, key)['delete'](key);
  2848. }
  2849. /**
  2850. * Gets the map value for `key`.
  2851. *
  2852. * @private
  2853. * @name get
  2854. * @memberOf MapCache
  2855. * @param {string} key The key of the value to get.
  2856. * @returns {*} Returns the entry value.
  2857. */
  2858. function mapCacheGet(key) {
  2859. return getMapData(this, key).get(key);
  2860. }
  2861. /**
  2862. * Checks if a map value for `key` exists.
  2863. *
  2864. * @private
  2865. * @name has
  2866. * @memberOf MapCache
  2867. * @param {string} key The key of the entry to check.
  2868. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2869. */
  2870. function mapCacheHas(key) {
  2871. return getMapData(this, key).has(key);
  2872. }
  2873. /**
  2874. * Sets the map `key` to `value`.
  2875. *
  2876. * @private
  2877. * @name set
  2878. * @memberOf MapCache
  2879. * @param {string} key The key of the value to set.
  2880. * @param {*} value The value to set.
  2881. * @returns {Object} Returns the map cache instance.
  2882. */
  2883. function mapCacheSet(key, value) {
  2884. getMapData(this, key).set(key, value);
  2885. return this;
  2886. }
  2887. // Add methods to `MapCache`.
  2888. MapCache.prototype.clear = mapCacheClear;
  2889. MapCache.prototype['delete'] = mapCacheDelete;
  2890. MapCache.prototype.get = mapCacheGet;
  2891. MapCache.prototype.has = mapCacheHas;
  2892. MapCache.prototype.set = mapCacheSet;
  2893. /**
  2894. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  2895. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  2896. * for equality comparisons.
  2897. *
  2898. * @private
  2899. * @param {Object} object The object to modify.
  2900. * @param {string} key The key of the property to assign.
  2901. * @param {*} value The value to assign.
  2902. */
  2903. function assignValue(object, key, value) {
  2904. var objValue = object[key];
  2905. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  2906. (value === undefined && !(key in object))) {
  2907. object[key] = value;
  2908. }
  2909. }
  2910. /**
  2911. * Gets the index at which the `key` is found in `array` of key-value pairs.
  2912. *
  2913. * @private
  2914. * @param {Array} array The array to inspect.
  2915. * @param {*} key The key to search for.
  2916. * @returns {number} Returns the index of the matched value, else `-1`.
  2917. */
  2918. function assocIndexOf(array, key) {
  2919. var length = array.length;
  2920. while (length--) {
  2921. if (eq(array[length][0], key)) {
  2922. return length;
  2923. }
  2924. }
  2925. return -1;
  2926. }
  2927. /**
  2928. * The base implementation of `_.isNative` without bad shim checks.
  2929. *
  2930. * @private
  2931. * @param {*} value The value to check.
  2932. * @returns {boolean} Returns `true` if `value` is a native function,
  2933. * else `false`.
  2934. */
  2935. function baseIsNative(value) {
  2936. if (!isObject(value) || isMasked(value)) {
  2937. return false;
  2938. }
  2939. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  2940. return pattern.test(toSource(value));
  2941. }
  2942. /**
  2943. * The base implementation of `_.set`.
  2944. *
  2945. * @private
  2946. * @param {Object} object The object to modify.
  2947. * @param {Array|string} path The path of the property to set.
  2948. * @param {*} value The value to set.
  2949. * @param {Function} [customizer] The function to customize path creation.
  2950. * @returns {Object} Returns `object`.
  2951. */
  2952. function baseSet(object, path, value, customizer) {
  2953. if (!isObject(object)) {
  2954. return object;
  2955. }
  2956. path = isKey(path, object) ? [path] : castPath(path);
  2957. var index = -1,
  2958. length = path.length,
  2959. lastIndex = length - 1,
  2960. nested = object;
  2961. while (nested != null && ++index < length) {
  2962. var key = toKey(path[index]),
  2963. newValue = value;
  2964. if (index != lastIndex) {
  2965. var objValue = nested[key];
  2966. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  2967. if (newValue === undefined) {
  2968. newValue = isObject(objValue)
  2969. ? objValue
  2970. : (isIndex(path[index + 1]) ? [] : {});
  2971. }
  2972. }
  2973. assignValue(nested, key, newValue);
  2974. nested = nested[key];
  2975. }
  2976. return object;
  2977. }
  2978. /**
  2979. * The base implementation of `_.toString` which doesn't convert nullish
  2980. * values to empty strings.
  2981. *
  2982. * @private
  2983. * @param {*} value The value to process.
  2984. * @returns {string} Returns the string.
  2985. */
  2986. function baseToString(value) {
  2987. // Exit early for strings to avoid a performance hit in some environments.
  2988. if (typeof value == 'string') {
  2989. return value;
  2990. }
  2991. if (isSymbol(value)) {
  2992. return symbolToString ? symbolToString.call(value) : '';
  2993. }
  2994. var result = (value + '');
  2995. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  2996. }
  2997. /**
  2998. * Casts `value` to a path array if it's not one.
  2999. *
  3000. * @private
  3001. * @param {*} value The value to inspect.
  3002. * @returns {Array} Returns the cast property path array.
  3003. */
  3004. function castPath(value) {
  3005. return isArray(value) ? value : stringToPath(value);
  3006. }
  3007. /**
  3008. * Gets the data for `map`.
  3009. *
  3010. * @private
  3011. * @param {Object} map The map to query.
  3012. * @param {string} key The reference key.
  3013. * @returns {*} Returns the map data.
  3014. */
  3015. function getMapData(map, key) {
  3016. var data = map.__data__;
  3017. return isKeyable(key)
  3018. ? data[typeof key == 'string' ? 'string' : 'hash']
  3019. : data.map;
  3020. }
  3021. /**
  3022. * Gets the native function at `key` of `object`.
  3023. *
  3024. * @private
  3025. * @param {Object} object The object to query.
  3026. * @param {string} key The key of the method to get.
  3027. * @returns {*} Returns the function if it's native, else `undefined`.
  3028. */
  3029. function getNative(object, key) {
  3030. var value = getValue(object, key);
  3031. return baseIsNative(value) ? value : undefined;
  3032. }
  3033. /**
  3034. * Checks if `value` is a valid array-like index.
  3035. *
  3036. * @private
  3037. * @param {*} value The value to check.
  3038. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  3039. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  3040. */
  3041. function isIndex(value, length) {
  3042. length = length == null ? MAX_SAFE_INTEGER : length;
  3043. return !!length &&
  3044. (typeof value == 'number' || reIsUint.test(value)) &&
  3045. (value > -1 && value % 1 == 0 && value < length);
  3046. }
  3047. /**
  3048. * Checks if `value` is a property name and not a property path.
  3049. *
  3050. * @private
  3051. * @param {*} value The value to check.
  3052. * @param {Object} [object] The object to query keys on.
  3053. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  3054. */
  3055. function isKey(value, object) {
  3056. if (isArray(value)) {
  3057. return false;
  3058. }
  3059. var type = typeof value;
  3060. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  3061. value == null || isSymbol(value)) {
  3062. return true;
  3063. }
  3064. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  3065. (object != null && value in Object(object));
  3066. }
  3067. /**
  3068. * Checks if `value` is suitable for use as unique object key.
  3069. *
  3070. * @private
  3071. * @param {*} value The value to check.
  3072. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  3073. */
  3074. function isKeyable(value) {
  3075. var type = typeof value;
  3076. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  3077. ? (value !== '__proto__')
  3078. : (value === null);
  3079. }
  3080. /**
  3081. * Checks if `func` has its source masked.
  3082. *
  3083. * @private
  3084. * @param {Function} func The function to check.
  3085. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  3086. */
  3087. function isMasked(func) {
  3088. return !!maskSrcKey && (maskSrcKey in func);
  3089. }
  3090. /**
  3091. * Converts `string` to a property path array.
  3092. *
  3093. * @private
  3094. * @param {string} string The string to convert.
  3095. * @returns {Array} Returns the property path array.
  3096. */
  3097. var stringToPath = memoize(function(string) {
  3098. string = toString(string);
  3099. var result = [];
  3100. if (reLeadingDot.test(string)) {
  3101. result.push('');
  3102. }
  3103. string.replace(rePropName, function(match, number, quote, string) {
  3104. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  3105. });
  3106. return result;
  3107. });
  3108. /**
  3109. * Converts `value` to a string key if it's not a string or symbol.
  3110. *
  3111. * @private
  3112. * @param {*} value The value to inspect.
  3113. * @returns {string|symbol} Returns the key.
  3114. */
  3115. function toKey(value) {
  3116. if (typeof value == 'string' || isSymbol(value)) {
  3117. return value;
  3118. }
  3119. var result = (value + '');
  3120. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  3121. }
  3122. /**
  3123. * Converts `func` to its source code.
  3124. *
  3125. * @private
  3126. * @param {Function} func The function to process.
  3127. * @returns {string} Returns the source code.
  3128. */
  3129. function toSource(func) {
  3130. if (func != null) {
  3131. try {
  3132. return funcToString.call(func);
  3133. } catch (e) {}
  3134. try {
  3135. return (func + '');
  3136. } catch (e) {}
  3137. }
  3138. return '';
  3139. }
  3140. /**
  3141. * Creates a function that memoizes the result of `func`. If `resolver` is
  3142. * provided, it determines the cache key for storing the result based on the
  3143. * arguments provided to the memoized function. By default, the first argument
  3144. * provided to the memoized function is used as the map cache key. The `func`
  3145. * is invoked with the `this` binding of the memoized function.
  3146. *
  3147. * **Note:** The cache is exposed as the `cache` property on the memoized
  3148. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  3149. * constructor with one whose instances implement the
  3150. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  3151. * method interface of `delete`, `get`, `has`, and `set`.
  3152. *
  3153. * @static
  3154. * @memberOf _
  3155. * @since 0.1.0
  3156. * @category Function
  3157. * @param {Function} func The function to have its output memoized.
  3158. * @param {Function} [resolver] The function to resolve the cache key.
  3159. * @returns {Function} Returns the new memoized function.
  3160. * @example
  3161. *
  3162. * var object = { 'a': 1, 'b': 2 };
  3163. * var other = { 'c': 3, 'd': 4 };
  3164. *
  3165. * var values = _.memoize(_.values);
  3166. * values(object);
  3167. * // => [1, 2]
  3168. *
  3169. * values(other);
  3170. * // => [3, 4]
  3171. *
  3172. * object.a = 2;
  3173. * values(object);
  3174. * // => [1, 2]
  3175. *
  3176. * // Modify the result cache.
  3177. * values.cache.set(object, ['a', 'b']);
  3178. * values(object);
  3179. * // => ['a', 'b']
  3180. *
  3181. * // Replace `_.memoize.Cache`.
  3182. * _.memoize.Cache = WeakMap;
  3183. */
  3184. function memoize(func, resolver) {
  3185. if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
  3186. throw new TypeError(FUNC_ERROR_TEXT);
  3187. }
  3188. var memoized = function() {
  3189. var args = arguments,
  3190. key = resolver ? resolver.apply(this, args) : args[0],
  3191. cache = memoized.cache;
  3192. if (cache.has(key)) {
  3193. return cache.get(key);
  3194. }
  3195. var result = func.apply(this, args);
  3196. memoized.cache = cache.set(key, result);
  3197. return result;
  3198. };
  3199. memoized.cache = new (memoize.Cache || MapCache);
  3200. return memoized;
  3201. }
  3202. // Assign cache to `_.memoize`.
  3203. memoize.Cache = MapCache;
  3204. /**
  3205. * Performs a
  3206. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3207. * comparison between two values to determine if they are equivalent.
  3208. *
  3209. * @static
  3210. * @memberOf _
  3211. * @since 4.0.0
  3212. * @category Lang
  3213. * @param {*} value The value to compare.
  3214. * @param {*} other The other value to compare.
  3215. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  3216. * @example
  3217. *
  3218. * var object = { 'a': 1 };
  3219. * var other = { 'a': 1 };
  3220. *
  3221. * _.eq(object, object);
  3222. * // => true
  3223. *
  3224. * _.eq(object, other);
  3225. * // => false
  3226. *
  3227. * _.eq('a', 'a');
  3228. * // => true
  3229. *
  3230. * _.eq('a', Object('a'));
  3231. * // => false
  3232. *
  3233. * _.eq(NaN, NaN);
  3234. * // => true
  3235. */
  3236. function eq(value, other) {
  3237. return value === other || (value !== value && other !== other);
  3238. }
  3239. /**
  3240. * Checks if `value` is classified as an `Array` object.
  3241. *
  3242. * @static
  3243. * @memberOf _
  3244. * @since 0.1.0
  3245. * @category Lang
  3246. * @param {*} value The value to check.
  3247. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  3248. * @example
  3249. *
  3250. * _.isArray([1, 2, 3]);
  3251. * // => true
  3252. *
  3253. * _.isArray(document.body.children);
  3254. * // => false
  3255. *
  3256. * _.isArray('abc');
  3257. * // => false
  3258. *
  3259. * _.isArray(_.noop);
  3260. * // => false
  3261. */
  3262. var isArray = Array.isArray;
  3263. /**
  3264. * Checks if `value` is classified as a `Function` object.
  3265. *
  3266. * @static
  3267. * @memberOf _
  3268. * @since 0.1.0
  3269. * @category Lang
  3270. * @param {*} value The value to check.
  3271. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  3272. * @example
  3273. *
  3274. * _.isFunction(_);
  3275. * // => true
  3276. *
  3277. * _.isFunction(/abc/);
  3278. * // => false
  3279. */
  3280. function isFunction(value) {
  3281. // The use of `Object#toString` avoids issues with the `typeof` operator
  3282. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  3283. var tag = isObject(value) ? objectToString.call(value) : '';
  3284. return tag == funcTag || tag == genTag;
  3285. }
  3286. /**
  3287. * Checks if `value` is the
  3288. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  3289. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  3290. *
  3291. * @static
  3292. * @memberOf _
  3293. * @since 0.1.0
  3294. * @category Lang
  3295. * @param {*} value The value to check.
  3296. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  3297. * @example
  3298. *
  3299. * _.isObject({});
  3300. * // => true
  3301. *
  3302. * _.isObject([1, 2, 3]);
  3303. * // => true
  3304. *
  3305. * _.isObject(_.noop);
  3306. * // => true
  3307. *
  3308. * _.isObject(null);
  3309. * // => false
  3310. */
  3311. function isObject(value) {
  3312. var type = typeof value;
  3313. return !!value && (type == 'object' || type == 'function');
  3314. }
  3315. /**
  3316. * Checks if `value` is object-like. A value is object-like if it's not `null`
  3317. * and has a `typeof` result of "object".
  3318. *
  3319. * @static
  3320. * @memberOf _
  3321. * @since 4.0.0
  3322. * @category Lang
  3323. * @param {*} value The value to check.
  3324. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  3325. * @example
  3326. *
  3327. * _.isObjectLike({});
  3328. * // => true
  3329. *
  3330. * _.isObjectLike([1, 2, 3]);
  3331. * // => true
  3332. *
  3333. * _.isObjectLike(_.noop);
  3334. * // => false
  3335. *
  3336. * _.isObjectLike(null);
  3337. * // => false
  3338. */
  3339. function isObjectLike(value) {
  3340. return !!value && typeof value == 'object';
  3341. }
  3342. /**
  3343. * Checks if `value` is classified as a `Symbol` primitive or object.
  3344. *
  3345. * @static
  3346. * @memberOf _
  3347. * @since 4.0.0
  3348. * @category Lang
  3349. * @param {*} value The value to check.
  3350. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  3351. * @example
  3352. *
  3353. * _.isSymbol(Symbol.iterator);
  3354. * // => true
  3355. *
  3356. * _.isSymbol('abc');
  3357. * // => false
  3358. */
  3359. function isSymbol(value) {
  3360. return typeof value == 'symbol' ||
  3361. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  3362. }
  3363. /**
  3364. * Converts `value` to a string. An empty string is returned for `null`
  3365. * and `undefined` values. The sign of `-0` is preserved.
  3366. *
  3367. * @static
  3368. * @memberOf _
  3369. * @since 4.0.0
  3370. * @category Lang
  3371. * @param {*} value The value to process.
  3372. * @returns {string} Returns the string.
  3373. * @example
  3374. *
  3375. * _.toString(null);
  3376. * // => ''
  3377. *
  3378. * _.toString(-0);
  3379. * // => '-0'
  3380. *
  3381. * _.toString([1, 2, 3]);
  3382. * // => '1,2,3'
  3383. */
  3384. function toString(value) {
  3385. return value == null ? '' : baseToString(value);
  3386. }
  3387. /**
  3388. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  3389. * it's created. Arrays are created for missing index properties while objects
  3390. * are created for all other missing properties. Use `_.setWith` to customize
  3391. * `path` creation.
  3392. *
  3393. * **Note:** This method mutates `object`.
  3394. *
  3395. * @static
  3396. * @memberOf _
  3397. * @since 3.7.0
  3398. * @category Object
  3399. * @param {Object} object The object to modify.
  3400. * @param {Array|string} path The path of the property to set.
  3401. * @param {*} value The value to set.
  3402. * @returns {Object} Returns `object`.
  3403. * @example
  3404. *
  3405. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  3406. *
  3407. * _.set(object, 'a[0].b.c', 4);
  3408. * console.log(object.a[0].b.c);
  3409. * // => 4
  3410. *
  3411. * _.set(object, ['x', '0', 'y', 'z'], 5);
  3412. * console.log(object.x[0].y.z);
  3413. * // => 5
  3414. */
  3415. function set(object, path, value) {
  3416. return object == null ? object : baseSet(object, path, value);
  3417. }
  3418. module.exports = set;
  3419. /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
  3420. /***/ }),
  3421. /* 7 */
  3422. /***/ (function(module, exports, __webpack_require__) {
  3423. /* WEBPACK VAR INJECTION */(function(global, module) {/**
  3424. * lodash (Custom Build) <https://lodash.com/>
  3425. * Build: `lodash modularize exports="npm" -o ./`
  3426. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  3427. * Released under MIT license <https://lodash.com/license>
  3428. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  3429. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  3430. */
  3431. /** Used as the size to enable large array optimizations. */
  3432. var LARGE_ARRAY_SIZE = 200;
  3433. /** Used to stand-in for `undefined` hash values. */
  3434. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  3435. /** Used as references for various `Number` constants. */
  3436. var MAX_SAFE_INTEGER = 9007199254740991;
  3437. /** `Object#toString` result references. */
  3438. var argsTag = '[object Arguments]',
  3439. arrayTag = '[object Array]',
  3440. boolTag = '[object Boolean]',
  3441. dateTag = '[object Date]',
  3442. errorTag = '[object Error]',
  3443. funcTag = '[object Function]',
  3444. genTag = '[object GeneratorFunction]',
  3445. mapTag = '[object Map]',
  3446. numberTag = '[object Number]',
  3447. objectTag = '[object Object]',
  3448. promiseTag = '[object Promise]',
  3449. regexpTag = '[object RegExp]',
  3450. setTag = '[object Set]',
  3451. stringTag = '[object String]',
  3452. symbolTag = '[object Symbol]',
  3453. weakMapTag = '[object WeakMap]';
  3454. var arrayBufferTag = '[object ArrayBuffer]',
  3455. dataViewTag = '[object DataView]',
  3456. float32Tag = '[object Float32Array]',
  3457. float64Tag = '[object Float64Array]',
  3458. int8Tag = '[object Int8Array]',
  3459. int16Tag = '[object Int16Array]',
  3460. int32Tag = '[object Int32Array]',
  3461. uint8Tag = '[object Uint8Array]',
  3462. uint8ClampedTag = '[object Uint8ClampedArray]',
  3463. uint16Tag = '[object Uint16Array]',
  3464. uint32Tag = '[object Uint32Array]';
  3465. /**
  3466. * Used to match `RegExp`
  3467. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  3468. */
  3469. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  3470. /** Used to match `RegExp` flags from their coerced string values. */
  3471. var reFlags = /\w*$/;
  3472. /** Used to detect host constructors (Safari). */
  3473. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  3474. /** Used to detect unsigned integer values. */
  3475. var reIsUint = /^(?:0|[1-9]\d*)$/;
  3476. /** Used to identify `toStringTag` values supported by `_.clone`. */
  3477. var cloneableTags = {};
  3478. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  3479. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  3480. cloneableTags[boolTag] = cloneableTags[dateTag] =
  3481. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  3482. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  3483. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  3484. cloneableTags[numberTag] = cloneableTags[objectTag] =
  3485. cloneableTags[regexpTag] = cloneableTags[setTag] =
  3486. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  3487. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  3488. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  3489. cloneableTags[errorTag] = cloneableTags[funcTag] =
  3490. cloneableTags[weakMapTag] = false;
  3491. /** Detect free variable `global` from Node.js. */
  3492. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  3493. /** Detect free variable `self`. */
  3494. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  3495. /** Used as a reference to the global object. */
  3496. var root = freeGlobal || freeSelf || Function('return this')();
  3497. /** Detect free variable `exports`. */
  3498. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  3499. /** Detect free variable `module`. */
  3500. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  3501. /** Detect the popular CommonJS extension `module.exports`. */
  3502. var moduleExports = freeModule && freeModule.exports === freeExports;
  3503. /**
  3504. * Adds the key-value `pair` to `map`.
  3505. *
  3506. * @private
  3507. * @param {Object} map The map to modify.
  3508. * @param {Array} pair The key-value pair to add.
  3509. * @returns {Object} Returns `map`.
  3510. */
  3511. function addMapEntry(map, pair) {
  3512. // Don't return `map.set` because it's not chainable in IE 11.
  3513. map.set(pair[0], pair[1]);
  3514. return map;
  3515. }
  3516. /**
  3517. * Adds `value` to `set`.
  3518. *
  3519. * @private
  3520. * @param {Object} set The set to modify.
  3521. * @param {*} value The value to add.
  3522. * @returns {Object} Returns `set`.
  3523. */
  3524. function addSetEntry(set, value) {
  3525. // Don't return `set.add` because it's not chainable in IE 11.
  3526. set.add(value);
  3527. return set;
  3528. }
  3529. /**
  3530. * A specialized version of `_.forEach` for arrays without support for
  3531. * iteratee shorthands.
  3532. *
  3533. * @private
  3534. * @param {Array} [array] The array to iterate over.
  3535. * @param {Function} iteratee The function invoked per iteration.
  3536. * @returns {Array} Returns `array`.
  3537. */
  3538. function arrayEach(array, iteratee) {
  3539. var index = -1,
  3540. length = array ? array.length : 0;
  3541. while (++index < length) {
  3542. if (iteratee(array[index], index, array) === false) {
  3543. break;
  3544. }
  3545. }
  3546. return array;
  3547. }
  3548. /**
  3549. * Appends the elements of `values` to `array`.
  3550. *
  3551. * @private
  3552. * @param {Array} array The array to modify.
  3553. * @param {Array} values The values to append.
  3554. * @returns {Array} Returns `array`.
  3555. */
  3556. function arrayPush(array, values) {
  3557. var index = -1,
  3558. length = values.length,
  3559. offset = array.length;
  3560. while (++index < length) {
  3561. array[offset + index] = values[index];
  3562. }
  3563. return array;
  3564. }
  3565. /**
  3566. * A specialized version of `_.reduce` for arrays without support for
  3567. * iteratee shorthands.
  3568. *
  3569. * @private
  3570. * @param {Array} [array] The array to iterate over.
  3571. * @param {Function} iteratee The function invoked per iteration.
  3572. * @param {*} [accumulator] The initial value.
  3573. * @param {boolean} [initAccum] Specify using the first element of `array` as
  3574. * the initial value.
  3575. * @returns {*} Returns the accumulated value.
  3576. */
  3577. function arrayReduce(array, iteratee, accumulator, initAccum) {
  3578. var index = -1,
  3579. length = array ? array.length : 0;
  3580. if (initAccum && length) {
  3581. accumulator = array[++index];
  3582. }
  3583. while (++index < length) {
  3584. accumulator = iteratee(accumulator, array[index], index, array);
  3585. }
  3586. return accumulator;
  3587. }
  3588. /**
  3589. * The base implementation of `_.times` without support for iteratee shorthands
  3590. * or max array length checks.
  3591. *
  3592. * @private
  3593. * @param {number} n The number of times to invoke `iteratee`.
  3594. * @param {Function} iteratee The function invoked per iteration.
  3595. * @returns {Array} Returns the array of results.
  3596. */
  3597. function baseTimes(n, iteratee) {
  3598. var index = -1,
  3599. result = Array(n);
  3600. while (++index < n) {
  3601. result[index] = iteratee(index);
  3602. }
  3603. return result;
  3604. }
  3605. /**
  3606. * Gets the value at `key` of `object`.
  3607. *
  3608. * @private
  3609. * @param {Object} [object] The object to query.
  3610. * @param {string} key The key of the property to get.
  3611. * @returns {*} Returns the property value.
  3612. */
  3613. function getValue(object, key) {
  3614. return object == null ? undefined : object[key];
  3615. }
  3616. /**
  3617. * Checks if `value` is a host object in IE < 9.
  3618. *
  3619. * @private
  3620. * @param {*} value The value to check.
  3621. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  3622. */
  3623. function isHostObject(value) {
  3624. // Many host objects are `Object` objects that can coerce to strings
  3625. // despite having improperly defined `toString` methods.
  3626. var result = false;
  3627. if (value != null && typeof value.toString != 'function') {
  3628. try {
  3629. result = !!(value + '');
  3630. } catch (e) {}
  3631. }
  3632. return result;
  3633. }
  3634. /**
  3635. * Converts `map` to its key-value pairs.
  3636. *
  3637. * @private
  3638. * @param {Object} map The map to convert.
  3639. * @returns {Array} Returns the key-value pairs.
  3640. */
  3641. function mapToArray(map) {
  3642. var index = -1,
  3643. result = Array(map.size);
  3644. map.forEach(function(value, key) {
  3645. result[++index] = [key, value];
  3646. });
  3647. return result;
  3648. }
  3649. /**
  3650. * Creates a unary function that invokes `func` with its argument transformed.
  3651. *
  3652. * @private
  3653. * @param {Function} func The function to wrap.
  3654. * @param {Function} transform The argument transform.
  3655. * @returns {Function} Returns the new function.
  3656. */
  3657. function overArg(func, transform) {
  3658. return function(arg) {
  3659. return func(transform(arg));
  3660. };
  3661. }
  3662. /**
  3663. * Converts `set` to an array of its values.
  3664. *
  3665. * @private
  3666. * @param {Object} set The set to convert.
  3667. * @returns {Array} Returns the values.
  3668. */
  3669. function setToArray(set) {
  3670. var index = -1,
  3671. result = Array(set.size);
  3672. set.forEach(function(value) {
  3673. result[++index] = value;
  3674. });
  3675. return result;
  3676. }
  3677. /** Used for built-in method references. */
  3678. var arrayProto = Array.prototype,
  3679. funcProto = Function.prototype,
  3680. objectProto = Object.prototype;
  3681. /** Used to detect overreaching core-js shims. */
  3682. var coreJsData = root['__core-js_shared__'];
  3683. /** Used to detect methods masquerading as native. */
  3684. var maskSrcKey = (function() {
  3685. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  3686. return uid ? ('Symbol(src)_1.' + uid) : '';
  3687. }());
  3688. /** Used to resolve the decompiled source of functions. */
  3689. var funcToString = funcProto.toString;
  3690. /** Used to check objects for own properties. */
  3691. var hasOwnProperty = objectProto.hasOwnProperty;
  3692. /**
  3693. * Used to resolve the
  3694. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  3695. * of values.
  3696. */
  3697. var objectToString = objectProto.toString;
  3698. /** Used to detect if a method is native. */
  3699. var reIsNative = RegExp('^' +
  3700. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  3701. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  3702. );
  3703. /** Built-in value references. */
  3704. var Buffer = moduleExports ? root.Buffer : undefined,
  3705. Symbol = root.Symbol,
  3706. Uint8Array = root.Uint8Array,
  3707. getPrototype = overArg(Object.getPrototypeOf, Object),
  3708. objectCreate = Object.create,
  3709. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  3710. splice = arrayProto.splice;
  3711. /* Built-in method references for those with the same name as other `lodash` methods. */
  3712. var nativeGetSymbols = Object.getOwnPropertySymbols,
  3713. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  3714. nativeKeys = overArg(Object.keys, Object);
  3715. /* Built-in method references that are verified to be native. */
  3716. var DataView = getNative(root, 'DataView'),
  3717. Map = getNative(root, 'Map'),
  3718. Promise = getNative(root, 'Promise'),
  3719. Set = getNative(root, 'Set'),
  3720. WeakMap = getNative(root, 'WeakMap'),
  3721. nativeCreate = getNative(Object, 'create');
  3722. /** Used to detect maps, sets, and weakmaps. */
  3723. var dataViewCtorString = toSource(DataView),
  3724. mapCtorString = toSource(Map),
  3725. promiseCtorString = toSource(Promise),
  3726. setCtorString = toSource(Set),
  3727. weakMapCtorString = toSource(WeakMap);
  3728. /** Used to convert symbols to primitives and strings. */
  3729. var symbolProto = Symbol ? Symbol.prototype : undefined,
  3730. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
  3731. /**
  3732. * Creates a hash object.
  3733. *
  3734. * @private
  3735. * @constructor
  3736. * @param {Array} [entries] The key-value pairs to cache.
  3737. */
  3738. function Hash(entries) {
  3739. var index = -1,
  3740. length = entries ? entries.length : 0;
  3741. this.clear();
  3742. while (++index < length) {
  3743. var entry = entries[index];
  3744. this.set(entry[0], entry[1]);
  3745. }
  3746. }
  3747. /**
  3748. * Removes all key-value entries from the hash.
  3749. *
  3750. * @private
  3751. * @name clear
  3752. * @memberOf Hash
  3753. */
  3754. function hashClear() {
  3755. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  3756. }
  3757. /**
  3758. * Removes `key` and its value from the hash.
  3759. *
  3760. * @private
  3761. * @name delete
  3762. * @memberOf Hash
  3763. * @param {Object} hash The hash to modify.
  3764. * @param {string} key The key of the value to remove.
  3765. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3766. */
  3767. function hashDelete(key) {
  3768. return this.has(key) && delete this.__data__[key];
  3769. }
  3770. /**
  3771. * Gets the hash value for `key`.
  3772. *
  3773. * @private
  3774. * @name get
  3775. * @memberOf Hash
  3776. * @param {string} key The key of the value to get.
  3777. * @returns {*} Returns the entry value.
  3778. */
  3779. function hashGet(key) {
  3780. var data = this.__data__;
  3781. if (nativeCreate) {
  3782. var result = data[key];
  3783. return result === HASH_UNDEFINED ? undefined : result;
  3784. }
  3785. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  3786. }
  3787. /**
  3788. * Checks if a hash value for `key` exists.
  3789. *
  3790. * @private
  3791. * @name has
  3792. * @memberOf Hash
  3793. * @param {string} key The key of the entry to check.
  3794. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3795. */
  3796. function hashHas(key) {
  3797. var data = this.__data__;
  3798. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  3799. }
  3800. /**
  3801. * Sets the hash `key` to `value`.
  3802. *
  3803. * @private
  3804. * @name set
  3805. * @memberOf Hash
  3806. * @param {string} key The key of the value to set.
  3807. * @param {*} value The value to set.
  3808. * @returns {Object} Returns the hash instance.
  3809. */
  3810. function hashSet(key, value) {
  3811. var data = this.__data__;
  3812. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  3813. return this;
  3814. }
  3815. // Add methods to `Hash`.
  3816. Hash.prototype.clear = hashClear;
  3817. Hash.prototype['delete'] = hashDelete;
  3818. Hash.prototype.get = hashGet;
  3819. Hash.prototype.has = hashHas;
  3820. Hash.prototype.set = hashSet;
  3821. /**
  3822. * Creates an list cache object.
  3823. *
  3824. * @private
  3825. * @constructor
  3826. * @param {Array} [entries] The key-value pairs to cache.
  3827. */
  3828. function ListCache(entries) {
  3829. var index = -1,
  3830. length = entries ? entries.length : 0;
  3831. this.clear();
  3832. while (++index < length) {
  3833. var entry = entries[index];
  3834. this.set(entry[0], entry[1]);
  3835. }
  3836. }
  3837. /**
  3838. * Removes all key-value entries from the list cache.
  3839. *
  3840. * @private
  3841. * @name clear
  3842. * @memberOf ListCache
  3843. */
  3844. function listCacheClear() {
  3845. this.__data__ = [];
  3846. }
  3847. /**
  3848. * Removes `key` and its value from the list cache.
  3849. *
  3850. * @private
  3851. * @name delete
  3852. * @memberOf ListCache
  3853. * @param {string} key The key of the value to remove.
  3854. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3855. */
  3856. function listCacheDelete(key) {
  3857. var data = this.__data__,
  3858. index = assocIndexOf(data, key);
  3859. if (index < 0) {
  3860. return false;
  3861. }
  3862. var lastIndex = data.length - 1;
  3863. if (index == lastIndex) {
  3864. data.pop();
  3865. } else {
  3866. splice.call(data, index, 1);
  3867. }
  3868. return true;
  3869. }
  3870. /**
  3871. * Gets the list cache value for `key`.
  3872. *
  3873. * @private
  3874. * @name get
  3875. * @memberOf ListCache
  3876. * @param {string} key The key of the value to get.
  3877. * @returns {*} Returns the entry value.
  3878. */
  3879. function listCacheGet(key) {
  3880. var data = this.__data__,
  3881. index = assocIndexOf(data, key);
  3882. return index < 0 ? undefined : data[index][1];
  3883. }
  3884. /**
  3885. * Checks if a list cache value for `key` exists.
  3886. *
  3887. * @private
  3888. * @name has
  3889. * @memberOf ListCache
  3890. * @param {string} key The key of the entry to check.
  3891. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3892. */
  3893. function listCacheHas(key) {
  3894. return assocIndexOf(this.__data__, key) > -1;
  3895. }
  3896. /**
  3897. * Sets the list cache `key` to `value`.
  3898. *
  3899. * @private
  3900. * @name set
  3901. * @memberOf ListCache
  3902. * @param {string} key The key of the value to set.
  3903. * @param {*} value The value to set.
  3904. * @returns {Object} Returns the list cache instance.
  3905. */
  3906. function listCacheSet(key, value) {
  3907. var data = this.__data__,
  3908. index = assocIndexOf(data, key);
  3909. if (index < 0) {
  3910. data.push([key, value]);
  3911. } else {
  3912. data[index][1] = value;
  3913. }
  3914. return this;
  3915. }
  3916. // Add methods to `ListCache`.
  3917. ListCache.prototype.clear = listCacheClear;
  3918. ListCache.prototype['delete'] = listCacheDelete;
  3919. ListCache.prototype.get = listCacheGet;
  3920. ListCache.prototype.has = listCacheHas;
  3921. ListCache.prototype.set = listCacheSet;
  3922. /**
  3923. * Creates a map cache object to store key-value pairs.
  3924. *
  3925. * @private
  3926. * @constructor
  3927. * @param {Array} [entries] The key-value pairs to cache.
  3928. */
  3929. function MapCache(entries) {
  3930. var index = -1,
  3931. length = entries ? entries.length : 0;
  3932. this.clear();
  3933. while (++index < length) {
  3934. var entry = entries[index];
  3935. this.set(entry[0], entry[1]);
  3936. }
  3937. }
  3938. /**
  3939. * Removes all key-value entries from the map.
  3940. *
  3941. * @private
  3942. * @name clear
  3943. * @memberOf MapCache
  3944. */
  3945. function mapCacheClear() {
  3946. this.__data__ = {
  3947. 'hash': new Hash,
  3948. 'map': new (Map || ListCache),
  3949. 'string': new Hash
  3950. };
  3951. }
  3952. /**
  3953. * Removes `key` and its value from the map.
  3954. *
  3955. * @private
  3956. * @name delete
  3957. * @memberOf MapCache
  3958. * @param {string} key The key of the value to remove.
  3959. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3960. */
  3961. function mapCacheDelete(key) {
  3962. return getMapData(this, key)['delete'](key);
  3963. }
  3964. /**
  3965. * Gets the map value for `key`.
  3966. *
  3967. * @private
  3968. * @name get
  3969. * @memberOf MapCache
  3970. * @param {string} key The key of the value to get.
  3971. * @returns {*} Returns the entry value.
  3972. */
  3973. function mapCacheGet(key) {
  3974. return getMapData(this, key).get(key);
  3975. }
  3976. /**
  3977. * Checks if a map value for `key` exists.
  3978. *
  3979. * @private
  3980. * @name has
  3981. * @memberOf MapCache
  3982. * @param {string} key The key of the entry to check.
  3983. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3984. */
  3985. function mapCacheHas(key) {
  3986. return getMapData(this, key).has(key);
  3987. }
  3988. /**
  3989. * Sets the map `key` to `value`.
  3990. *
  3991. * @private
  3992. * @name set
  3993. * @memberOf MapCache
  3994. * @param {string} key The key of the value to set.
  3995. * @param {*} value The value to set.
  3996. * @returns {Object} Returns the map cache instance.
  3997. */
  3998. function mapCacheSet(key, value) {
  3999. getMapData(this, key).set(key, value);
  4000. return this;
  4001. }
  4002. // Add methods to `MapCache`.
  4003. MapCache.prototype.clear = mapCacheClear;
  4004. MapCache.prototype['delete'] = mapCacheDelete;
  4005. MapCache.prototype.get = mapCacheGet;
  4006. MapCache.prototype.has = mapCacheHas;
  4007. MapCache.prototype.set = mapCacheSet;
  4008. /**
  4009. * Creates a stack cache object to store key-value pairs.
  4010. *
  4011. * @private
  4012. * @constructor
  4013. * @param {Array} [entries] The key-value pairs to cache.
  4014. */
  4015. function Stack(entries) {
  4016. this.__data__ = new ListCache(entries);
  4017. }
  4018. /**
  4019. * Removes all key-value entries from the stack.
  4020. *
  4021. * @private
  4022. * @name clear
  4023. * @memberOf Stack
  4024. */
  4025. function stackClear() {
  4026. this.__data__ = new ListCache;
  4027. }
  4028. /**
  4029. * Removes `key` and its value from the stack.
  4030. *
  4031. * @private
  4032. * @name delete
  4033. * @memberOf Stack
  4034. * @param {string} key The key of the value to remove.
  4035. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4036. */
  4037. function stackDelete(key) {
  4038. return this.__data__['delete'](key);
  4039. }
  4040. /**
  4041. * Gets the stack value for `key`.
  4042. *
  4043. * @private
  4044. * @name get
  4045. * @memberOf Stack
  4046. * @param {string} key The key of the value to get.
  4047. * @returns {*} Returns the entry value.
  4048. */
  4049. function stackGet(key) {
  4050. return this.__data__.get(key);
  4051. }
  4052. /**
  4053. * Checks if a stack value for `key` exists.
  4054. *
  4055. * @private
  4056. * @name has
  4057. * @memberOf Stack
  4058. * @param {string} key The key of the entry to check.
  4059. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4060. */
  4061. function stackHas(key) {
  4062. return this.__data__.has(key);
  4063. }
  4064. /**
  4065. * Sets the stack `key` to `value`.
  4066. *
  4067. * @private
  4068. * @name set
  4069. * @memberOf Stack
  4070. * @param {string} key The key of the value to set.
  4071. * @param {*} value The value to set.
  4072. * @returns {Object} Returns the stack cache instance.
  4073. */
  4074. function stackSet(key, value) {
  4075. var cache = this.__data__;
  4076. if (cache instanceof ListCache) {
  4077. var pairs = cache.__data__;
  4078. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  4079. pairs.push([key, value]);
  4080. return this;
  4081. }
  4082. cache = this.__data__ = new MapCache(pairs);
  4083. }
  4084. cache.set(key, value);
  4085. return this;
  4086. }
  4087. // Add methods to `Stack`.
  4088. Stack.prototype.clear = stackClear;
  4089. Stack.prototype['delete'] = stackDelete;
  4090. Stack.prototype.get = stackGet;
  4091. Stack.prototype.has = stackHas;
  4092. Stack.prototype.set = stackSet;
  4093. /**
  4094. * Creates an array of the enumerable property names of the array-like `value`.
  4095. *
  4096. * @private
  4097. * @param {*} value The value to query.
  4098. * @param {boolean} inherited Specify returning inherited property names.
  4099. * @returns {Array} Returns the array of property names.
  4100. */
  4101. function arrayLikeKeys(value, inherited) {
  4102. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  4103. // Safari 9 makes `arguments.length` enumerable in strict mode.
  4104. var result = (isArray(value) || isArguments(value))
  4105. ? baseTimes(value.length, String)
  4106. : [];
  4107. var length = result.length,
  4108. skipIndexes = !!length;
  4109. for (var key in value) {
  4110. if ((inherited || hasOwnProperty.call(value, key)) &&
  4111. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  4112. result.push(key);
  4113. }
  4114. }
  4115. return result;
  4116. }
  4117. /**
  4118. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  4119. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  4120. * for equality comparisons.
  4121. *
  4122. * @private
  4123. * @param {Object} object The object to modify.
  4124. * @param {string} key The key of the property to assign.
  4125. * @param {*} value The value to assign.
  4126. */
  4127. function assignValue(object, key, value) {
  4128. var objValue = object[key];
  4129. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  4130. (value === undefined && !(key in object))) {
  4131. object[key] = value;
  4132. }
  4133. }
  4134. /**
  4135. * Gets the index at which the `key` is found in `array` of key-value pairs.
  4136. *
  4137. * @private
  4138. * @param {Array} array The array to inspect.
  4139. * @param {*} key The key to search for.
  4140. * @returns {number} Returns the index of the matched value, else `-1`.
  4141. */
  4142. function assocIndexOf(array, key) {
  4143. var length = array.length;
  4144. while (length--) {
  4145. if (eq(array[length][0], key)) {
  4146. return length;
  4147. }
  4148. }
  4149. return -1;
  4150. }
  4151. /**
  4152. * The base implementation of `_.assign` without support for multiple sources
  4153. * or `customizer` functions.
  4154. *
  4155. * @private
  4156. * @param {Object} object The destination object.
  4157. * @param {Object} source The source object.
  4158. * @returns {Object} Returns `object`.
  4159. */
  4160. function baseAssign(object, source) {
  4161. return object && copyObject(source, keys(source), object);
  4162. }
  4163. /**
  4164. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  4165. * traversed objects.
  4166. *
  4167. * @private
  4168. * @param {*} value The value to clone.
  4169. * @param {boolean} [isDeep] Specify a deep clone.
  4170. * @param {boolean} [isFull] Specify a clone including symbols.
  4171. * @param {Function} [customizer] The function to customize cloning.
  4172. * @param {string} [key] The key of `value`.
  4173. * @param {Object} [object] The parent object of `value`.
  4174. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  4175. * @returns {*} Returns the cloned value.
  4176. */
  4177. function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
  4178. var result;
  4179. if (customizer) {
  4180. result = object ? customizer(value, key, object, stack) : customizer(value);
  4181. }
  4182. if (result !== undefined) {
  4183. return result;
  4184. }
  4185. if (!isObject(value)) {
  4186. return value;
  4187. }
  4188. var isArr = isArray(value);
  4189. if (isArr) {
  4190. result = initCloneArray(value);
  4191. if (!isDeep) {
  4192. return copyArray(value, result);
  4193. }
  4194. } else {
  4195. var tag = getTag(value),
  4196. isFunc = tag == funcTag || tag == genTag;
  4197. if (isBuffer(value)) {
  4198. return cloneBuffer(value, isDeep);
  4199. }
  4200. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  4201. if (isHostObject(value)) {
  4202. return object ? value : {};
  4203. }
  4204. result = initCloneObject(isFunc ? {} : value);
  4205. if (!isDeep) {
  4206. return copySymbols(value, baseAssign(result, value));
  4207. }
  4208. } else {
  4209. if (!cloneableTags[tag]) {
  4210. return object ? value : {};
  4211. }
  4212. result = initCloneByTag(value, tag, baseClone, isDeep);
  4213. }
  4214. }
  4215. // Check for circular references and return its corresponding clone.
  4216. stack || (stack = new Stack);
  4217. var stacked = stack.get(value);
  4218. if (stacked) {
  4219. return stacked;
  4220. }
  4221. stack.set(value, result);
  4222. if (!isArr) {
  4223. var props = isFull ? getAllKeys(value) : keys(value);
  4224. }
  4225. arrayEach(props || value, function(subValue, key) {
  4226. if (props) {
  4227. key = subValue;
  4228. subValue = value[key];
  4229. }
  4230. // Recursively populate clone (susceptible to call stack limits).
  4231. assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
  4232. });
  4233. return result;
  4234. }
  4235. /**
  4236. * The base implementation of `_.create` without support for assigning
  4237. * properties to the created object.
  4238. *
  4239. * @private
  4240. * @param {Object} prototype The object to inherit from.
  4241. * @returns {Object} Returns the new object.
  4242. */
  4243. function baseCreate(proto) {
  4244. return isObject(proto) ? objectCreate(proto) : {};
  4245. }
  4246. /**
  4247. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  4248. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  4249. * symbols of `object`.
  4250. *
  4251. * @private
  4252. * @param {Object} object The object to query.
  4253. * @param {Function} keysFunc The function to get the keys of `object`.
  4254. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  4255. * @returns {Array} Returns the array of property names and symbols.
  4256. */
  4257. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  4258. var result = keysFunc(object);
  4259. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  4260. }
  4261. /**
  4262. * The base implementation of `getTag`.
  4263. *
  4264. * @private
  4265. * @param {*} value The value to query.
  4266. * @returns {string} Returns the `toStringTag`.
  4267. */
  4268. function baseGetTag(value) {
  4269. return objectToString.call(value);
  4270. }
  4271. /**
  4272. * The base implementation of `_.isNative` without bad shim checks.
  4273. *
  4274. * @private
  4275. * @param {*} value The value to check.
  4276. * @returns {boolean} Returns `true` if `value` is a native function,
  4277. * else `false`.
  4278. */
  4279. function baseIsNative(value) {
  4280. if (!isObject(value) || isMasked(value)) {
  4281. return false;
  4282. }
  4283. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  4284. return pattern.test(toSource(value));
  4285. }
  4286. /**
  4287. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  4288. *
  4289. * @private
  4290. * @param {Object} object The object to query.
  4291. * @returns {Array} Returns the array of property names.
  4292. */
  4293. function baseKeys(object) {
  4294. if (!isPrototype(object)) {
  4295. return nativeKeys(object);
  4296. }
  4297. var result = [];
  4298. for (var key in Object(object)) {
  4299. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  4300. result.push(key);
  4301. }
  4302. }
  4303. return result;
  4304. }
  4305. /**
  4306. * Creates a clone of `buffer`.
  4307. *
  4308. * @private
  4309. * @param {Buffer} buffer The buffer to clone.
  4310. * @param {boolean} [isDeep] Specify a deep clone.
  4311. * @returns {Buffer} Returns the cloned buffer.
  4312. */
  4313. function cloneBuffer(buffer, isDeep) {
  4314. if (isDeep) {
  4315. return buffer.slice();
  4316. }
  4317. var result = new buffer.constructor(buffer.length);
  4318. buffer.copy(result);
  4319. return result;
  4320. }
  4321. /**
  4322. * Creates a clone of `arrayBuffer`.
  4323. *
  4324. * @private
  4325. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  4326. * @returns {ArrayBuffer} Returns the cloned array buffer.
  4327. */
  4328. function cloneArrayBuffer(arrayBuffer) {
  4329. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  4330. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  4331. return result;
  4332. }
  4333. /**
  4334. * Creates a clone of `dataView`.
  4335. *
  4336. * @private
  4337. * @param {Object} dataView The data view to clone.
  4338. * @param {boolean} [isDeep] Specify a deep clone.
  4339. * @returns {Object} Returns the cloned data view.
  4340. */
  4341. function cloneDataView(dataView, isDeep) {
  4342. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  4343. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  4344. }
  4345. /**
  4346. * Creates a clone of `map`.
  4347. *
  4348. * @private
  4349. * @param {Object} map The map to clone.
  4350. * @param {Function} cloneFunc The function to clone values.
  4351. * @param {boolean} [isDeep] Specify a deep clone.
  4352. * @returns {Object} Returns the cloned map.
  4353. */
  4354. function cloneMap(map, isDeep, cloneFunc) {
  4355. var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);
  4356. return arrayReduce(array, addMapEntry, new map.constructor);
  4357. }
  4358. /**
  4359. * Creates a clone of `regexp`.
  4360. *
  4361. * @private
  4362. * @param {Object} regexp The regexp to clone.
  4363. * @returns {Object} Returns the cloned regexp.
  4364. */
  4365. function cloneRegExp(regexp) {
  4366. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  4367. result.lastIndex = regexp.lastIndex;
  4368. return result;
  4369. }
  4370. /**
  4371. * Creates a clone of `set`.
  4372. *
  4373. * @private
  4374. * @param {Object} set The set to clone.
  4375. * @param {Function} cloneFunc The function to clone values.
  4376. * @param {boolean} [isDeep] Specify a deep clone.
  4377. * @returns {Object} Returns the cloned set.
  4378. */
  4379. function cloneSet(set, isDeep, cloneFunc) {
  4380. var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
  4381. return arrayReduce(array, addSetEntry, new set.constructor);
  4382. }
  4383. /**
  4384. * Creates a clone of the `symbol` object.
  4385. *
  4386. * @private
  4387. * @param {Object} symbol The symbol object to clone.
  4388. * @returns {Object} Returns the cloned symbol object.
  4389. */
  4390. function cloneSymbol(symbol) {
  4391. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  4392. }
  4393. /**
  4394. * Creates a clone of `typedArray`.
  4395. *
  4396. * @private
  4397. * @param {Object} typedArray The typed array to clone.
  4398. * @param {boolean} [isDeep] Specify a deep clone.
  4399. * @returns {Object} Returns the cloned typed array.
  4400. */
  4401. function cloneTypedArray(typedArray, isDeep) {
  4402. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  4403. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  4404. }
  4405. /**
  4406. * Copies the values of `source` to `array`.
  4407. *
  4408. * @private
  4409. * @param {Array} source The array to copy values from.
  4410. * @param {Array} [array=[]] The array to copy values to.
  4411. * @returns {Array} Returns `array`.
  4412. */
  4413. function copyArray(source, array) {
  4414. var index = -1,
  4415. length = source.length;
  4416. array || (array = Array(length));
  4417. while (++index < length) {
  4418. array[index] = source[index];
  4419. }
  4420. return array;
  4421. }
  4422. /**
  4423. * Copies properties of `source` to `object`.
  4424. *
  4425. * @private
  4426. * @param {Object} source The object to copy properties from.
  4427. * @param {Array} props The property identifiers to copy.
  4428. * @param {Object} [object={}] The object to copy properties to.
  4429. * @param {Function} [customizer] The function to customize copied values.
  4430. * @returns {Object} Returns `object`.
  4431. */
  4432. function copyObject(source, props, object, customizer) {
  4433. object || (object = {});
  4434. var index = -1,
  4435. length = props.length;
  4436. while (++index < length) {
  4437. var key = props[index];
  4438. var newValue = customizer
  4439. ? customizer(object[key], source[key], key, object, source)
  4440. : undefined;
  4441. assignValue(object, key, newValue === undefined ? source[key] : newValue);
  4442. }
  4443. return object;
  4444. }
  4445. /**
  4446. * Copies own symbol properties of `source` to `object`.
  4447. *
  4448. * @private
  4449. * @param {Object} source The object to copy symbols from.
  4450. * @param {Object} [object={}] The object to copy symbols to.
  4451. * @returns {Object} Returns `object`.
  4452. */
  4453. function copySymbols(source, object) {
  4454. return copyObject(source, getSymbols(source), object);
  4455. }
  4456. /**
  4457. * Creates an array of own enumerable property names and symbols of `object`.
  4458. *
  4459. * @private
  4460. * @param {Object} object The object to query.
  4461. * @returns {Array} Returns the array of property names and symbols.
  4462. */
  4463. function getAllKeys(object) {
  4464. return baseGetAllKeys(object, keys, getSymbols);
  4465. }
  4466. /**
  4467. * Gets the data for `map`.
  4468. *
  4469. * @private
  4470. * @param {Object} map The map to query.
  4471. * @param {string} key The reference key.
  4472. * @returns {*} Returns the map data.
  4473. */
  4474. function getMapData(map, key) {
  4475. var data = map.__data__;
  4476. return isKeyable(key)
  4477. ? data[typeof key == 'string' ? 'string' : 'hash']
  4478. : data.map;
  4479. }
  4480. /**
  4481. * Gets the native function at `key` of `object`.
  4482. *
  4483. * @private
  4484. * @param {Object} object The object to query.
  4485. * @param {string} key The key of the method to get.
  4486. * @returns {*} Returns the function if it's native, else `undefined`.
  4487. */
  4488. function getNative(object, key) {
  4489. var value = getValue(object, key);
  4490. return baseIsNative(value) ? value : undefined;
  4491. }
  4492. /**
  4493. * Creates an array of the own enumerable symbol properties of `object`.
  4494. *
  4495. * @private
  4496. * @param {Object} object The object to query.
  4497. * @returns {Array} Returns the array of symbols.
  4498. */
  4499. var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
  4500. /**
  4501. * Gets the `toStringTag` of `value`.
  4502. *
  4503. * @private
  4504. * @param {*} value The value to query.
  4505. * @returns {string} Returns the `toStringTag`.
  4506. */
  4507. var getTag = baseGetTag;
  4508. // Fallback for data views, maps, sets, and weak maps in IE 11,
  4509. // for data views in Edge < 14, and promises in Node.js.
  4510. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  4511. (Map && getTag(new Map) != mapTag) ||
  4512. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  4513. (Set && getTag(new Set) != setTag) ||
  4514. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  4515. getTag = function(value) {
  4516. var result = objectToString.call(value),
  4517. Ctor = result == objectTag ? value.constructor : undefined,
  4518. ctorString = Ctor ? toSource(Ctor) : undefined;
  4519. if (ctorString) {
  4520. switch (ctorString) {
  4521. case dataViewCtorString: return dataViewTag;
  4522. case mapCtorString: return mapTag;
  4523. case promiseCtorString: return promiseTag;
  4524. case setCtorString: return setTag;
  4525. case weakMapCtorString: return weakMapTag;
  4526. }
  4527. }
  4528. return result;
  4529. };
  4530. }
  4531. /**
  4532. * Initializes an array clone.
  4533. *
  4534. * @private
  4535. * @param {Array} array The array to clone.
  4536. * @returns {Array} Returns the initialized clone.
  4537. */
  4538. function initCloneArray(array) {
  4539. var length = array.length,
  4540. result = array.constructor(length);
  4541. // Add properties assigned by `RegExp#exec`.
  4542. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  4543. result.index = array.index;
  4544. result.input = array.input;
  4545. }
  4546. return result;
  4547. }
  4548. /**
  4549. * Initializes an object clone.
  4550. *
  4551. * @private
  4552. * @param {Object} object The object to clone.
  4553. * @returns {Object} Returns the initialized clone.
  4554. */
  4555. function initCloneObject(object) {
  4556. return (typeof object.constructor == 'function' && !isPrototype(object))
  4557. ? baseCreate(getPrototype(object))
  4558. : {};
  4559. }
  4560. /**
  4561. * Initializes an object clone based on its `toStringTag`.
  4562. *
  4563. * **Note:** This function only supports cloning values with tags of
  4564. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  4565. *
  4566. * @private
  4567. * @param {Object} object The object to clone.
  4568. * @param {string} tag The `toStringTag` of the object to clone.
  4569. * @param {Function} cloneFunc The function to clone values.
  4570. * @param {boolean} [isDeep] Specify a deep clone.
  4571. * @returns {Object} Returns the initialized clone.
  4572. */
  4573. function initCloneByTag(object, tag, cloneFunc, isDeep) {
  4574. var Ctor = object.constructor;
  4575. switch (tag) {
  4576. case arrayBufferTag:
  4577. return cloneArrayBuffer(object);
  4578. case boolTag:
  4579. case dateTag:
  4580. return new Ctor(+object);
  4581. case dataViewTag:
  4582. return cloneDataView(object, isDeep);
  4583. case float32Tag: case float64Tag:
  4584. case int8Tag: case int16Tag: case int32Tag:
  4585. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  4586. return cloneTypedArray(object, isDeep);
  4587. case mapTag:
  4588. return cloneMap(object, isDeep, cloneFunc);
  4589. case numberTag:
  4590. case stringTag:
  4591. return new Ctor(object);
  4592. case regexpTag:
  4593. return cloneRegExp(object);
  4594. case setTag:
  4595. return cloneSet(object, isDeep, cloneFunc);
  4596. case symbolTag:
  4597. return cloneSymbol(object);
  4598. }
  4599. }
  4600. /**
  4601. * Checks if `value` is a valid array-like index.
  4602. *
  4603. * @private
  4604. * @param {*} value The value to check.
  4605. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  4606. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  4607. */
  4608. function isIndex(value, length) {
  4609. length = length == null ? MAX_SAFE_INTEGER : length;
  4610. return !!length &&
  4611. (typeof value == 'number' || reIsUint.test(value)) &&
  4612. (value > -1 && value % 1 == 0 && value < length);
  4613. }
  4614. /**
  4615. * Checks if `value` is suitable for use as unique object key.
  4616. *
  4617. * @private
  4618. * @param {*} value The value to check.
  4619. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  4620. */
  4621. function isKeyable(value) {
  4622. var type = typeof value;
  4623. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  4624. ? (value !== '__proto__')
  4625. : (value === null);
  4626. }
  4627. /**
  4628. * Checks if `func` has its source masked.
  4629. *
  4630. * @private
  4631. * @param {Function} func The function to check.
  4632. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  4633. */
  4634. function isMasked(func) {
  4635. return !!maskSrcKey && (maskSrcKey in func);
  4636. }
  4637. /**
  4638. * Checks if `value` is likely a prototype object.
  4639. *
  4640. * @private
  4641. * @param {*} value The value to check.
  4642. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  4643. */
  4644. function isPrototype(value) {
  4645. var Ctor = value && value.constructor,
  4646. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  4647. return value === proto;
  4648. }
  4649. /**
  4650. * Converts `func` to its source code.
  4651. *
  4652. * @private
  4653. * @param {Function} func The function to process.
  4654. * @returns {string} Returns the source code.
  4655. */
  4656. function toSource(func) {
  4657. if (func != null) {
  4658. try {
  4659. return funcToString.call(func);
  4660. } catch (e) {}
  4661. try {
  4662. return (func + '');
  4663. } catch (e) {}
  4664. }
  4665. return '';
  4666. }
  4667. /**
  4668. * This method is like `_.clone` except that it recursively clones `value`.
  4669. *
  4670. * @static
  4671. * @memberOf _
  4672. * @since 1.0.0
  4673. * @category Lang
  4674. * @param {*} value The value to recursively clone.
  4675. * @returns {*} Returns the deep cloned value.
  4676. * @see _.clone
  4677. * @example
  4678. *
  4679. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  4680. *
  4681. * var deep = _.cloneDeep(objects);
  4682. * console.log(deep[0] === objects[0]);
  4683. * // => false
  4684. */
  4685. function cloneDeep(value) {
  4686. return baseClone(value, true, true);
  4687. }
  4688. /**
  4689. * Performs a
  4690. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  4691. * comparison between two values to determine if they are equivalent.
  4692. *
  4693. * @static
  4694. * @memberOf _
  4695. * @since 4.0.0
  4696. * @category Lang
  4697. * @param {*} value The value to compare.
  4698. * @param {*} other The other value to compare.
  4699. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  4700. * @example
  4701. *
  4702. * var object = { 'a': 1 };
  4703. * var other = { 'a': 1 };
  4704. *
  4705. * _.eq(object, object);
  4706. * // => true
  4707. *
  4708. * _.eq(object, other);
  4709. * // => false
  4710. *
  4711. * _.eq('a', 'a');
  4712. * // => true
  4713. *
  4714. * _.eq('a', Object('a'));
  4715. * // => false
  4716. *
  4717. * _.eq(NaN, NaN);
  4718. * // => true
  4719. */
  4720. function eq(value, other) {
  4721. return value === other || (value !== value && other !== other);
  4722. }
  4723. /**
  4724. * Checks if `value` is likely an `arguments` object.
  4725. *
  4726. * @static
  4727. * @memberOf _
  4728. * @since 0.1.0
  4729. * @category Lang
  4730. * @param {*} value The value to check.
  4731. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  4732. * else `false`.
  4733. * @example
  4734. *
  4735. * _.isArguments(function() { return arguments; }());
  4736. * // => true
  4737. *
  4738. * _.isArguments([1, 2, 3]);
  4739. * // => false
  4740. */
  4741. function isArguments(value) {
  4742. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  4743. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  4744. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  4745. }
  4746. /**
  4747. * Checks if `value` is classified as an `Array` object.
  4748. *
  4749. * @static
  4750. * @memberOf _
  4751. * @since 0.1.0
  4752. * @category Lang
  4753. * @param {*} value The value to check.
  4754. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  4755. * @example
  4756. *
  4757. * _.isArray([1, 2, 3]);
  4758. * // => true
  4759. *
  4760. * _.isArray(document.body.children);
  4761. * // => false
  4762. *
  4763. * _.isArray('abc');
  4764. * // => false
  4765. *
  4766. * _.isArray(_.noop);
  4767. * // => false
  4768. */
  4769. var isArray = Array.isArray;
  4770. /**
  4771. * Checks if `value` is array-like. A value is considered array-like if it's
  4772. * not a function and has a `value.length` that's an integer greater than or
  4773. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  4774. *
  4775. * @static
  4776. * @memberOf _
  4777. * @since 4.0.0
  4778. * @category Lang
  4779. * @param {*} value The value to check.
  4780. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  4781. * @example
  4782. *
  4783. * _.isArrayLike([1, 2, 3]);
  4784. * // => true
  4785. *
  4786. * _.isArrayLike(document.body.children);
  4787. * // => true
  4788. *
  4789. * _.isArrayLike('abc');
  4790. * // => true
  4791. *
  4792. * _.isArrayLike(_.noop);
  4793. * // => false
  4794. */
  4795. function isArrayLike(value) {
  4796. return value != null && isLength(value.length) && !isFunction(value);
  4797. }
  4798. /**
  4799. * This method is like `_.isArrayLike` except that it also checks if `value`
  4800. * is an object.
  4801. *
  4802. * @static
  4803. * @memberOf _
  4804. * @since 4.0.0
  4805. * @category Lang
  4806. * @param {*} value The value to check.
  4807. * @returns {boolean} Returns `true` if `value` is an array-like object,
  4808. * else `false`.
  4809. * @example
  4810. *
  4811. * _.isArrayLikeObject([1, 2, 3]);
  4812. * // => true
  4813. *
  4814. * _.isArrayLikeObject(document.body.children);
  4815. * // => true
  4816. *
  4817. * _.isArrayLikeObject('abc');
  4818. * // => false
  4819. *
  4820. * _.isArrayLikeObject(_.noop);
  4821. * // => false
  4822. */
  4823. function isArrayLikeObject(value) {
  4824. return isObjectLike(value) && isArrayLike(value);
  4825. }
  4826. /**
  4827. * Checks if `value` is a buffer.
  4828. *
  4829. * @static
  4830. * @memberOf _
  4831. * @since 4.3.0
  4832. * @category Lang
  4833. * @param {*} value The value to check.
  4834. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  4835. * @example
  4836. *
  4837. * _.isBuffer(new Buffer(2));
  4838. * // => true
  4839. *
  4840. * _.isBuffer(new Uint8Array(2));
  4841. * // => false
  4842. */
  4843. var isBuffer = nativeIsBuffer || stubFalse;
  4844. /**
  4845. * Checks if `value` is classified as a `Function` object.
  4846. *
  4847. * @static
  4848. * @memberOf _
  4849. * @since 0.1.0
  4850. * @category Lang
  4851. * @param {*} value The value to check.
  4852. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  4853. * @example
  4854. *
  4855. * _.isFunction(_);
  4856. * // => true
  4857. *
  4858. * _.isFunction(/abc/);
  4859. * // => false
  4860. */
  4861. function isFunction(value) {
  4862. // The use of `Object#toString` avoids issues with the `typeof` operator
  4863. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  4864. var tag = isObject(value) ? objectToString.call(value) : '';
  4865. return tag == funcTag || tag == genTag;
  4866. }
  4867. /**
  4868. * Checks if `value` is a valid array-like length.
  4869. *
  4870. * **Note:** This method is loosely based on
  4871. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  4872. *
  4873. * @static
  4874. * @memberOf _
  4875. * @since 4.0.0
  4876. * @category Lang
  4877. * @param {*} value The value to check.
  4878. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  4879. * @example
  4880. *
  4881. * _.isLength(3);
  4882. * // => true
  4883. *
  4884. * _.isLength(Number.MIN_VALUE);
  4885. * // => false
  4886. *
  4887. * _.isLength(Infinity);
  4888. * // => false
  4889. *
  4890. * _.isLength('3');
  4891. * // => false
  4892. */
  4893. function isLength(value) {
  4894. return typeof value == 'number' &&
  4895. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  4896. }
  4897. /**
  4898. * Checks if `value` is the
  4899. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  4900. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  4901. *
  4902. * @static
  4903. * @memberOf _
  4904. * @since 0.1.0
  4905. * @category Lang
  4906. * @param {*} value The value to check.
  4907. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  4908. * @example
  4909. *
  4910. * _.isObject({});
  4911. * // => true
  4912. *
  4913. * _.isObject([1, 2, 3]);
  4914. * // => true
  4915. *
  4916. * _.isObject(_.noop);
  4917. * // => true
  4918. *
  4919. * _.isObject(null);
  4920. * // => false
  4921. */
  4922. function isObject(value) {
  4923. var type = typeof value;
  4924. return !!value && (type == 'object' || type == 'function');
  4925. }
  4926. /**
  4927. * Checks if `value` is object-like. A value is object-like if it's not `null`
  4928. * and has a `typeof` result of "object".
  4929. *
  4930. * @static
  4931. * @memberOf _
  4932. * @since 4.0.0
  4933. * @category Lang
  4934. * @param {*} value The value to check.
  4935. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  4936. * @example
  4937. *
  4938. * _.isObjectLike({});
  4939. * // => true
  4940. *
  4941. * _.isObjectLike([1, 2, 3]);
  4942. * // => true
  4943. *
  4944. * _.isObjectLike(_.noop);
  4945. * // => false
  4946. *
  4947. * _.isObjectLike(null);
  4948. * // => false
  4949. */
  4950. function isObjectLike(value) {
  4951. return !!value && typeof value == 'object';
  4952. }
  4953. /**
  4954. * Creates an array of the own enumerable property names of `object`.
  4955. *
  4956. * **Note:** Non-object values are coerced to objects. See the
  4957. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  4958. * for more details.
  4959. *
  4960. * @static
  4961. * @since 0.1.0
  4962. * @memberOf _
  4963. * @category Object
  4964. * @param {Object} object The object to query.
  4965. * @returns {Array} Returns the array of property names.
  4966. * @example
  4967. *
  4968. * function Foo() {
  4969. * this.a = 1;
  4970. * this.b = 2;
  4971. * }
  4972. *
  4973. * Foo.prototype.c = 3;
  4974. *
  4975. * _.keys(new Foo);
  4976. * // => ['a', 'b'] (iteration order is not guaranteed)
  4977. *
  4978. * _.keys('hi');
  4979. * // => ['0', '1']
  4980. */
  4981. function keys(object) {
  4982. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  4983. }
  4984. /**
  4985. * This method returns a new empty array.
  4986. *
  4987. * @static
  4988. * @memberOf _
  4989. * @since 4.13.0
  4990. * @category Util
  4991. * @returns {Array} Returns the new empty array.
  4992. * @example
  4993. *
  4994. * var arrays = _.times(2, _.stubArray);
  4995. *
  4996. * console.log(arrays);
  4997. * // => [[], []]
  4998. *
  4999. * console.log(arrays[0] === arrays[1]);
  5000. * // => false
  5001. */
  5002. function stubArray() {
  5003. return [];
  5004. }
  5005. /**
  5006. * This method returns `false`.
  5007. *
  5008. * @static
  5009. * @memberOf _
  5010. * @since 4.13.0
  5011. * @category Util
  5012. * @returns {boolean} Returns `false`.
  5013. * @example
  5014. *
  5015. * _.times(2, _.stubFalse);
  5016. * // => [false, false]
  5017. */
  5018. function stubFalse() {
  5019. return false;
  5020. }
  5021. module.exports = cloneDeep;
  5022. /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(8)(module)))
  5023. /***/ }),
  5024. /* 8 */
  5025. /***/ (function(module, exports) {
  5026. module.exports = function(module) {
  5027. if(!module.webpackPolyfill) {
  5028. module.deprecate = function() {};
  5029. module.paths = [];
  5030. // module.parent = undefined by default
  5031. module.children = [];
  5032. module.webpackPolyfill = 1;
  5033. }
  5034. return module;
  5035. }
  5036. /***/ }),
  5037. /* 9 */
  5038. /***/ (function(module, exports, __webpack_require__) {
  5039. var isBuffer = __webpack_require__(10)
  5040. var flat = module.exports = flatten
  5041. flatten.flatten = flatten
  5042. flatten.unflatten = unflatten
  5043. function flatten(target, opts) {
  5044. opts = opts || {}
  5045. var delimiter = opts.delimiter || '.'
  5046. var maxDepth = opts.maxDepth
  5047. var output = {}
  5048. function step(object, prev, currentDepth) {
  5049. currentDepth = currentDepth ? currentDepth : 1
  5050. Object.keys(object).forEach(function(key) {
  5051. var value = object[key]
  5052. var isarray = opts.safe && Array.isArray(value)
  5053. var type = Object.prototype.toString.call(value)
  5054. var isbuffer = isBuffer(value)
  5055. var isobject = (
  5056. type === "[object Object]" ||
  5057. type === "[object Array]"
  5058. )
  5059. var newKey = prev
  5060. ? prev + delimiter + key
  5061. : key
  5062. if (!isarray && !isbuffer && isobject && Object.keys(value).length &&
  5063. (!opts.maxDepth || currentDepth < maxDepth)) {
  5064. return step(value, newKey, currentDepth + 1)
  5065. }
  5066. output[newKey] = value
  5067. })
  5068. }
  5069. step(target)
  5070. return output
  5071. }
  5072. function unflatten(target, opts) {
  5073. opts = opts || {}
  5074. var delimiter = opts.delimiter || '.'
  5075. var overwrite = opts.overwrite || false
  5076. var result = {}
  5077. var isbuffer = isBuffer(target)
  5078. if (isbuffer || Object.prototype.toString.call(target) !== '[object Object]') {
  5079. return target
  5080. }
  5081. // safely ensure that the key is
  5082. // an integer.
  5083. function getkey(key) {
  5084. var parsedKey = Number(key)
  5085. return (
  5086. isNaN(parsedKey) ||
  5087. key.indexOf('.') !== -1
  5088. ) ? key
  5089. : parsedKey
  5090. }
  5091. Object.keys(target).forEach(function(key) {
  5092. var split = key.split(delimiter)
  5093. var key1 = getkey(split.shift())
  5094. var key2 = getkey(split[0])
  5095. var recipient = result
  5096. while (key2 !== undefined) {
  5097. var type = Object.prototype.toString.call(recipient[key1])
  5098. var isobject = (
  5099. type === "[object Object]" ||
  5100. type === "[object Array]"
  5101. )
  5102. // do not write over falsey, non-undefined values if overwrite is false
  5103. if (!overwrite && !isobject && typeof recipient[key1] !== 'undefined') {
  5104. return
  5105. }
  5106. if ((overwrite && !isobject) || (!overwrite && recipient[key1] == null)) {
  5107. recipient[key1] = (
  5108. typeof key2 === 'number' &&
  5109. !opts.object ? [] : {}
  5110. )
  5111. }
  5112. recipient = recipient[key1]
  5113. if (split.length > 0) {
  5114. key1 = getkey(split.shift())
  5115. key2 = getkey(split[0])
  5116. }
  5117. }
  5118. // unflatten again for 'messy objects'
  5119. recipient[key1] = unflatten(target[key], opts)
  5120. })
  5121. return result
  5122. }
  5123. /***/ }),
  5124. /* 10 */
  5125. /***/ (function(module, exports) {
  5126. /*!
  5127. * Determine if an object is a Buffer
  5128. *
  5129. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  5130. * @license MIT
  5131. */
  5132. // The _isBuffer check is for Safari 5-7 support, because it's missing
  5133. // Object.prototype.constructor. Remove this eventually
  5134. module.exports = function (obj) {
  5135. return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
  5136. }
  5137. function isBuffer (obj) {
  5138. return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  5139. }
  5140. // For Node v0.10 support. Remove this eventually.
  5141. function isSlowBuffer (obj) {
  5142. return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
  5143. }
  5144. /***/ })
  5145. /******/ ])
  5146. });
  5147. ;