a98fb05e1a1b2d063b9eb269eb945674.json 3.08 KB
{"ast":null,"code":"(function (global, factory) {\n  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.arrayTreeFilter = factory();\n})(this, function () {\n  'use strict';\n\n  function arrayTreeFilter(data, filterFn, options) {\n    options = options || {};\n    options.childrenKeyName = options.childrenKeyName || \"children\";\n    var children = data || [];\n    var result = [];\n    var level = 0;\n\n    do {\n      var foundItem = children.filter(function (item) {\n        return filterFn(item, level);\n      })[0];\n\n      if (!foundItem) {\n        break;\n      }\n\n      result.push(foundItem);\n      children = foundItem[options.childrenKeyName] || [];\n      level += 1;\n    } while (children.length > 0);\n\n    return result;\n  }\n\n  return arrayTreeFilter;\n});","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/array-tree-filter/lib/index.js"],"names":["global","factory","exports","module","define","amd","arrayTreeFilter","data","filterFn","options","childrenKeyName","children","result","level","foundItem","filter","item","push","length"],"mappings":"AAAC,WAAUA,MAAV,EAAkBC,OAAlB,EAA2B;AAC3B,SAAOC,OAAP,KAAmB,QAAnB,IAA+B,OAAOC,MAAP,KAAkB,WAAjD,GAA+DA,MAAM,CAACD,OAAP,GAAiBD,OAAO,EAAvF,GACA,OAAOG,MAAP,KAAkB,UAAlB,IAAgCA,MAAM,CAACC,GAAvC,GAA6CD,MAAM,CAACH,OAAD,CAAnD,GACCD,MAAM,CAACM,eAAP,GAAyBL,OAAO,EAFjC;AAGA,CAJA,EAIC,IAJD,EAIQ,YAAY;AAAE;;AAEvB,WAASK,eAAT,CAAyBC,IAAzB,EAA+BC,QAA/B,EAAyCC,OAAzC,EAAkD;AAC9CA,IAAAA,OAAO,GAAGA,OAAO,IAAI,EAArB;AACAA,IAAAA,OAAO,CAACC,eAAR,GAA0BD,OAAO,CAACC,eAAR,IAA2B,UAArD;AACA,QAAIC,QAAQ,GAAGJ,IAAI,IAAI,EAAvB;AACA,QAAIK,MAAM,GAAG,EAAb;AACA,QAAIC,KAAK,GAAG,CAAZ;;AACA,OAAG;AACC,UAAIC,SAAS,GAAGH,QAAQ,CAACI,MAAT,CAAgB,UAAUC,IAAV,EAAgB;AAC5C,eAAOR,QAAQ,CAACQ,IAAD,EAAOH,KAAP,CAAf;AACH,OAFe,EAEb,CAFa,CAAhB;;AAGA,UAAI,CAACC,SAAL,EAAgB;AACZ;AACH;;AACDF,MAAAA,MAAM,CAACK,IAAP,CAAYH,SAAZ;AACAH,MAAAA,QAAQ,GAAGG,SAAS,CAACL,OAAO,CAACC,eAAT,CAAT,IAAsC,EAAjD;AACAG,MAAAA,KAAK,IAAI,CAAT;AACH,KAVD,QAUSF,QAAQ,CAACO,MAAT,GAAkB,CAV3B;;AAWA,WAAON,MAAP;AACH;;AAED,SAAON,eAAP;AAEC,CA5BA,CAAD","sourcesContent":["(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.arrayTreeFilter = factory());\n}(this, (function () { 'use strict';\n\nfunction arrayTreeFilter(data, filterFn, options) {\n    options = options || {};\n    options.childrenKeyName = options.childrenKeyName || \"children\";\n    var children = data || [];\n    var result = [];\n    var level = 0;\n    do {\n        var foundItem = children.filter(function (item) {\n            return filterFn(item, level);\n        })[0];\n        if (!foundItem) {\n            break;\n        }\n        result.push(foundItem);\n        children = foundItem[options.childrenKeyName] || [];\n        level += 1;\n    } while (children.length > 0);\n    return result;\n}\n\nreturn arrayTreeFilter;\n\n})));\n"]},"metadata":{},"sourceType":"script"}