{"id":299980,"date":"2020-03-11T15:00:41","date_gmt":"2020-03-11T15:00:41","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=299980"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=299980","title":{"rendered":"\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435. JS\/TS"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/491610\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tg\/oe\/vx\/tgoevxjfh91r8a7v7syb7n7uthg.png\"><\/p>\n<p>  <\/p>\n<p>\u0427\u0430\u0441\u0442\u043e \u043b\u0438 \u0432\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0432\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445? \u042d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0442\u0430\u0431\u043b\u0438\u0446, \u043a\u0430\u0440\u0442\u043e\u0447\u0435\u043a, \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u2014 \u0447\u0435\u0433\u043e \u0443\u0433\u043e\u0434\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f, \u0442\u043e \u0442\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <code>map<\/code>, <code>filter<\/code> \u0438 <code>reduce<\/code> \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u041d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438\u043b\u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u0434\u0430 \u0435\u0449\u0435 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e. \u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c\u0441\u044f, \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f, \u0438 \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043e\u0432 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f, \u0442\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0438 \u043d\u0435\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0436\u0435 \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0435\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438?<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u042f \u0441\u0430\u043c \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0432\u0441\u0435 \u043d\u043e\u0432\u044b\u0435 \u0438 \u043d\u043e\u0432\u044b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043d\u0430\u0447\u0430\u043b\u0443 \u0432\u0441\u0435 \u0448\u043b\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438 \u0441\u0432\u043e\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u043e. \u0421\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0441\u0442\u0430\u043b\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441 \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0445. \u041a\u043e\u0434 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0438 \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430. \u0422\u0438\u043f\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u043b\u0430\u0441\u044c \u0437\u0430 \u0447\u0430\u0441, \u043d\u043e \u0432\u043e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u043f\u0438\u0441\u0430\u043b\u0438\u0441\u044c \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0434\u043e\u043b\u044c\u0448\u0435. \u041d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0447\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043d\u0430\u0439\u0442\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443.<br \/>  \u0421\u0430\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438:<\/p>\n<p>  <\/p>\n<ol>\n<li><code>ng-table<\/code> \u2014 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438. \u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b\u0438 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435.<\/li>\n<li><code>List.js<\/code> \u2014 \u043a\u0430\u043a ng-table, \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430.<\/li>\n<li><code>filter.js<\/code> \u2014 \u0431\u043b\u0438\u0437\u043a\u043e \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u043d\u0443\u0436\u043d\u043e, \u043d\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u043b\u043e \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438.<\/li>\n<li><code>Isotope<\/code> \u2014 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a DOM \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c. \u0423 \u043d\u0430\u0441 \u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0435\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0438\u043b\u044c\u0442\u0440\u0430.<\/li>\n<li>\u041f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430.<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438.<\/li>\n<li>\u041a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b \u043a\u0430\u043a \u0432 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>and<\/code> \u0438 <code>or<\/code> \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432.<\/li>\n<li>\u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0433\u0440\u0443\u043f\u043f. \u0412\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f.<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 (\u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043c\u044b \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b, \u0435\u0441\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0430 \u0441\u043e\u0432\u043f\u0430\u043b\u0430 \u0441 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u043c, \u043d\u043e \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u043b \u043d\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u0435\u0451 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0432\u044b\u0432\u0435\u043b\u0430\u0441\u044c \u0433\u0440\u0443\u043f\u043f\u0430 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438)<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/dmitriypereverza\/awsome-data-filter\" rel=\"nofollow\">awesome-data-filter<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<h2 id=\"ustanovka\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h2>\n<p>  <\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0438 \u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0435\u0435 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">npm install awesome-data-filter<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430.<br \/>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const users = [   {     age: 31,     name: &quot;Marina Gilmore&quot;,   },   {     age: 34,     name: &quot;Joyner Mccray&quot;,   },   {     age: 23,     name: &quot;Inez Copeland&quot;,   },   {     age: 23,     name: &quot;Marina Mitchell&quot;,   },   {     age: 25,     name: &quot;Prince Spears&quot;,   }, ];<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const filterValue = {   age: 23,   searchText: &quot;mari&quot;, };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b.<\/p>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430:<\/p>\n<p>  <\/p>\n<ul>\n<li><code>matchText<\/code> \u2014 \u043f\u043e\u0438\u0441\u043a \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u043c \u043f\u043e\u043b\u0435;<\/li>\n<li><code>equalProp<\/code> \u2014 \u043f\u043e\u043b\u043d\u043e\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432;<br \/> \n<ul>\n<li><code>betweenDates<\/code> \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0434\u0430\u0442\u044b \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d;<\/li>\n<li><code>equalOneOf<\/code> \u2014 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0443;<\/li>\n<li><code>someInArray<\/code> \u2014 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0443;<\/li>\n<li><code>isEmptyArray<\/code> \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432;<\/li>\n<li><code>lessThen<\/code> \u2014 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c;<\/li>\n<li><code>moreThen<\/code> \u2014 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c;<\/li>\n<li><code>not<\/code> \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0442\u0440\u0438\u0446\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e <code>matchText<\/code> \u0438 <code>equalProp<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439:<\/p>\n<p>  <\/p>\n<ul>\n<li><code>filterField<\/code> \u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430;<\/li>\n<li><code>elementField<\/code> \u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u043f\u0438\u0441\u043a\u0430.<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"javascript\">import {    buildFilter,    elementField,    filterField,  } from &quot;awsome-data-filter&quot;; import { matchText, equalProp } from &quot;awsome-data-filter\/rules&quot;; import { and } from &quot;awsome-data-filter\/conditions&quot;;  const filter = buildFilter({     rules: {       elementFilter: and([         matchText(filterField(&quot;searchText&quot;), elementField(&quot;name&quot;)),         equalProp(filterField(&quot;age&quot;), elementField(&quot;age&quot;)),       ]),     },   });  const { elements } = filter(     filterValue,     {       groups: [],       elements: users,     }, );  console.log(elements); \/\/ elements: [{ age: 23, name: &quot;Marina Mitchell&quot; }]<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>filter<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <code>groups<\/code> \u0438 <code>elements<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0433\u0440\u0443\u043f\u043f\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u043d\u0438 \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435. \u0412\u043d\u0443\u0442\u0440\u0438 \u0433\u0440\u0443\u043f\u043f \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ff\/0h\/d1\/ff0hd1m-m9wk2gmemzlfg_qjdem.png\"><\/p>\n<p>  <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u043f\u043b\u043e\u0441\u043a\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e <code>elements<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u043c <code>and<\/code> \u043d\u0430 <code>or<\/code>, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b 2\u0445 \u043f\u0440\u0430\u0432\u0438\u043b.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">import {    buildFilter,    elementField,    filterField,  } from &quot;awsome-data-filter&quot;; import { matchText, equalProp } from &quot;awsome-data-filter\/rules&quot;; import { or } from &quot;awsome-data-filter\/conditions&quot;;  const filter = buildFilter({     rules: {       elementFilter: or([         matchText(filterField(&quot;searchText&quot;), elementField(&quot;name&quot;)),         equalProp(filterField(&quot;age&quot;), elementField(&quot;age&quot;)),       ]),     },   });  const { elements } = filter(     filterValue,     {       groups: [],       elements: users,     }, );  console.log(elements); \/\/ elements:  \/\/ [ \/\/   { \/\/     age: 31, \/\/     name: &quot;Marina Gilmore&quot;, \/\/   }, \/\/   { \/\/     age: 23, \/\/     name: &quot;Inez Copeland&quot;, \/\/   }, \/\/   { \/\/     age: 23, \/\/     name: &quot;Marina Mitchell&quot;, \/\/   } \/\/ ]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c <code>filterField<\/code>, <code>elementField<\/code> \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>constValue<\/code> \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<br \/>  \u0423\u0441\u043b\u043e\u0432\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0432\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u0432 \u0434\u0440\u0443\u0433\u0430 <code>or(..., matchText, [and([..., matchText, ...]), or([..., ...])])<\/code><\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0444\u0438\u043b\u044c\u0442\u0440 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const dataList = [   {     groupName: &quot;first group&quot;,     list: [       { age: 31, name: &quot;Marina&quot; },       { age: 23, name: &quot;Fabio&quot; },     ],   },   {     groupName: &quot;second group&quot;,     groups: [       {         groupName: &quot;third group&quot;,         list: [],         groups: [           {             groupName: &quot;fourth group&quot;,             list: [{ age: 42, name: &quot;Li&quot; }],           },         ],       },     ],     list: [       { age: 41, name: &quot;Marina&quot; },       { age: 29, name: &quot;Inez&quot; },       { age: 33, name: &quot;Marina&quot; },     ],   },   {     groupName: &quot;fifth group&quot;,     list: [       { age: 21, name: &quot;Dmitriy&quot; },       { age: 22, name: &quot;Li&quot; },       { age: 45, name: &quot;Mitchell&quot; },     ],   }, ];<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u043e\u0431\u0445\u043e\u0434\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 \u043f\u043e\u043b\u0435 <code>traversal<\/code>: <\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">import {    buildFilter,    elementField,    filterField,  } from &quot;awsome-data-filter&quot;; import { matchText } from &quot;awsome-data-filter\/rules&quot;;  const filter = buildFilter({     traversal: {       getChildrenFunc: group =&gt; group.list, \/\/ \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b       setChildrenFunc: (group, list) =&gt; ({ ...group, list }), \/\/ \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0433\u0440\u0443\u043f\u043f\u0443       getGroupsFunc: group =&gt; group.groups, \/\/ \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b       setGroupsFunc: (group, groups) =&gt; ({ ...group, groups }), \/\/ \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b     },     rules: {       elementFilter: matchText(filterField(&quot;searchText&quot;), elementField(&quot;name&quot;)),     },   });  const filterValue = {   searchText: &quot;li&quot;, };  const { groups } = filter(filterValue, {   groups: dataList, \/\/ \u0433\u0440\u0443\u043f\u043f\u044b \u0441 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0438 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438   elements: [], \/\/ \u043a\u0430\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043b\u043e\u0441\u043a\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0438 });  console.log(groups); \/\/ groups:  \/\/[ \/\/  { \/\/    groupName: &quot;second group&quot;, \/\/    groups: [ \/\/      { \/\/        groupName: &quot;third group&quot;, \/\/        list: [], \/\/        groups: [ \/\/          { \/\/            groupName: &quot;fourth group&quot;, \/\/            list: [{ age: 42, name: &quot;Li&quot; }], \/\/          }, \/\/        ], \/\/      }, \/\/    ], \/\/    list: [], \/\/  }, \/\/  { \/\/    groupName: &quot;fifth group&quot;, \/\/    list: [ \/\/      { age: 22, name: &quot;Li&quot; }, \/\/    ], \/\/  }, \/\/]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e <code>elementFilter<\/code> \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c <code>groupFilter<\/code> \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">import {    buildFilter,    elementField,    filterField,  } from &quot;awsome-data-filter&quot;; import { matchText } from &quot;awsome-data-filter\/rules&quot;;  const filter = buildFilter({     traversal: {       getChildrenFunc: group =&gt; group.list, \/\/ \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b       setChildrenFunc: (group, list) =&gt; ({ ...group, list }), \/\/ \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0433\u0440\u0443\u043f\u043f\u0443       getGroupsFunc: group =&gt; group.groups, \/\/ \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b       setGroupsFunc: (group, groups) =&gt; ({ ...group, groups }), \/\/ \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b     },     rules: {       elementFilter: matchText(filterField(&quot;searchText&quot;), elementField(&quot;name&quot;)),       groupFilter: matchText(filterField(&quot;groupName&quot;), elementField(&quot;groupName&quot;)),     },   });  const filterValue = {   searchText: &quot;li&quot;,   groupName: &quot;fi&quot;, };  const { groups } = filter(filterValue, {   groups: dataList,   elements: [], });  console.log(groups); \/\/ groups: \/\/[ \/\/  { \/\/    groupName: &quot;first group&quot;, \/\/    list: [ \/\/      { age: 31, name: &quot;Marina&quot; }, \/\/      { age: 23, name: &quot;Fabio&quot; }, \/\/    ], \/\/  }, \/\/  { \/\/    groupName: &quot;second group&quot;, \/\/    groups: [ \/\/      { \/\/        groupName: &quot;third group&quot;, \/\/        list: [], \/\/        groups: [ \/\/          { \/\/            groupName: &quot;fourth group&quot;, \/\/            list: [{ age: 42, name: &quot;Li&quot; }], \/\/          }, \/\/        ], \/\/      }, \/\/    ], \/\/    list: [], \/\/  }, \/\/  { \/\/    groupName: &quot;fifth group&quot;, \/\/    list: [ \/\/      { age: 22, name: &quot;Li&quot; }, \/\/    ], \/\/  }, \/\/]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0413\u0440\u0443\u043f\u043f\u0430 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <code>first group<\/code> \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0435, \u0438 \u0442\u0430\u043a \u043a\u0430\u043a \u0444\u0438\u043b\u044c\u0442\u0440 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043f\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c, \u043d\u043e \u043d\u0430\u0448\u0435\u043b \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u0435, \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043f\u0438\u0441\u043a\u0430.<br \/>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 <code>fifth group<\/code> \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0438 \u043f\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c, \u0438 \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438 \u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f <code>\u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0435\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438<\/code>. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const standardStrategy: StrategiesFilterInterface = {   elementHandler: ({ \/\/ \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432     element,     tools: {          isGroupFilterIsActive, \/\/ \u0435\u0441\u0442\u044c \u043b\u0438 \u0444\u0438\u043b\u044c\u0442\u0440 \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u0430\u043c         applyElementFilter \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430     },   }) =&gt; {     if (isGroupFilterIsActive) return null;     if (!applyElementFilter) return element;     return applyElementFilter(element, true) ? element : null;   },   groupHandler: ({     element: group,     originalElement: originalGroup,     tools: {       isGroupFilterIsActive,       applyElementFilter,       getIsGroupFilterHaveMatch,       getGroupsFunc,       getChildrenFunc,       setChildrenFunc,     },   }) =&gt; {     let newChildren = [];     let originalChildren = [];     const children = getChildrenFunc(group);     const childrenExists = !!children;     \/\/ \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0435\u0441\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u0438\u0445     if (children) {       originalChildren = [...children];       newChildren = originalChildren.filter(element =&gt;         applyElementFilter           ? applyElementFilter(element, !isGroupFilterIsActive)           : !isGroupFilterIsActive,       );     }     \/\/ \u0435\u0441\u043b\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439 \u043f\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u043d\u0435\u0442, \u043d\u043e \u0435\u0441\u0442\u044c \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u0435, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442     if (!newChildren.length &amp;&amp; getIsGroupFilterHaveMatch(group)) {       return originalGroup;     }     \/\/ \u0435\u0441\u043b\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043f\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0435\u0441\u0442\u044c, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0445 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443     if (childrenExists) {       group = setChildrenFunc(group, newChildren);     }      \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f     const newGroups = getGroupsFunc(group);     const isGroupsExists = !!(newGroups &amp;&amp; newGroups.length);     const isElementExists = !!(newChildren &amp;&amp; newChildren.length);     \/\/ \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0433\u0440\u0443\u043f\u043f, \u0442\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u0443     return isElementExists || isGroupsExists ? group : null;   }, };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u0435 \u0432 \u043f\u043e\u043b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 <code>filterStrategy<\/code>.<\/p>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0438 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u043e\u0438\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fx\/-m\/fw\/fx-mfwped4vo_jakrhvugi9p36u.png\"><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u0442\u043e \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 \u044d\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c \u0435\u0435 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u0432\u0430\u0448\u0438\u043c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c, \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c \u0438 \u0441\u043e\u0432\u0435\u0442\u0430\u043c.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/491610\/\"> https:\/\/habr.com\/ru\/post\/491610\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/491610\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tg\/oe\/vx\/tgoevxjfh91r8a7v7syb7n7uthg.png\"><\/p>\n<p>  <\/p>\n<p>\u0427\u0430\u0441\u0442\u043e \u043b\u0438 \u0432\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0432\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445? \u042d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0442\u0430\u0431\u043b\u0438\u0446, \u043a\u0430\u0440\u0442\u043e\u0447\u0435\u043a, \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u2014 \u0447\u0435\u0433\u043e \u0443\u0433\u043e\u0434\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f, \u0442\u043e \u0442\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <code>map<\/code>, <code>filter<\/code> \u0438 <code>reduce<\/code> \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u041d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438\u043b\u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u0434\u0430 \u0435\u0449\u0435 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e. \u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c\u0441\u044f, \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f, \u0438 \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043e\u0432 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f, \u0442\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0438 \u043d\u0435\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0436\u0435 \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0435\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438?<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-299980","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/299980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=299980"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/299980\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=299980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=299980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=299980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}