{"id":300925,"date":"2020-03-29T15:00:28","date_gmt":"2020-03-29T15:00:28","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=300925"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=300925","title":{"rendered":"Quartet 9: Allegro | \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c"},"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\/494632\/\">\n<p>\u041a\u043e\u0433\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0430\u0441\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 <a href=\"https:\/\/www.npmjs.com\/package\/quartet\" rel=\"nofollow\">quartet<\/a> \u0431\u044b\u043b\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0446\u0435\u043b\u0438-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li>TypeScript<\/li>\n<li>\u041a\u0440\u0430\u0442\u043a\u043e\u0441\u0442\u044c<\/li>\n<li>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430<\/li>\n<li>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c <code>quartet<\/code> \u0438 \u0435\u0451 \u043f\u0440\u0438\u0447\u0438\u043d\u044b.<\/p>\n<p>  <\/p>\n<p>\u0411\u0443\u0434\u0435\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0430\u0441\u043f\u0435\u043a\u0442 \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 <code>quartet<\/code> \u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0439 <a href=\"https:\/\/www.npmjs.com\/package\/ajv\" rel=\"nofollow\">ajv<\/a>.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"hello-world\">Hello world<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u2014 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 &quot;Hello World!&quot;.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u043c\u0435\u0435\u043c \u0442\u0430\u043a\u0438\u0435 \u043d\u0430\u0431\u043e\u0440\u044b \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0445 \u0438 \u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const positives = [&quot;Hello World!&quot;]; const negatives = [null, false, undefined, &quot;&quot;, 1, Infinity, &quot;Hello World&quot;];<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"ajv\">ajv<\/h3>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0441\u0451 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0438\u043c\u043f\u043e\u0440\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const Ajv = require(&quot;ajv&quot;);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 &quot;\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430&quot;:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const ajv = new Ajv();<\/code><\/pre>\n<p>  <\/p>\n<p>Ajv \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0432 \u0432\u0438\u0434\u0435 <a href=\"https:\/\/json-schema.org\/\" rel=\"nofollow\">JSON \u0441\u0445\u0435\u043c\u044b<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const helloWorldSchema = {   type: &quot;string&quot;,   enum: [&quot;Hello World!&quot;] };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e &quot;\u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c&quot; \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u0438\u0437 \u0441\u0445\u0435\u043c\u044b \u2014 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0432\u0445\u043e\u0434, \u0430 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c <code>true<\/code>, \u0435\u0441\u043b\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0432 \u0438\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c <code>false<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const ajvValidator = ajv.compile(helloWorldSchema);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e!<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u0441\u0445\u0435\u043c\u044b \u0431\u044b\u043b\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/www.npmjs.com\/package\/benchmark\" rel=\"nofollow\">benchmark<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0434\u044f \u043f\u044f\u0442\u044c \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0437\u0430\u043c\u0435\u0440\u043e\u0432, \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u043c\u0435\u0435\u043c \u0442\u0430\u043a\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Ajv Build 661,639 ops\/sec 354,725 ops\/sec 628,443 ops\/sec 659,900 ops\/sec 557,037 ops\/sec  \u0421\u0440\u0435\u0434\u043d\u0435\u0435: 572,349 ops\/sec<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0451\u043c \u0437\u0430\u043c\u0435\u0440 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">for (let i = 0; i &lt; positives.length; i++) {   ajvValidator(positives[i]); } for (let i = 0; i &lt; negatives.length; i++) {   ajvValidator(negatives[i]); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u044f\u0442\u044c \u0437\u0430\u043c\u0435\u0440\u043e\u0432 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Ajv Validation  21,452,228 ops\/sec  3,066,770 ops\/sec  4,522,850 ops\/sec  2,522,777 ops\/sec  2,741,310 ops\/sec  \u0421\u0440\u0435\u0434\u043d\u0435\u0435: 6,861,187 ops\/sec<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u043c\u0435\u0440 \u0432\u044b\u0448\u0435\u043b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u2014 \u043d\u043e \u0447\u0442\u043e \u0435\u0441\u0442\u044c, \u0442\u043e \u0435\u0441\u0442\u044c.<\/p>\n<p>  <\/p>\n<h3 id=\"quartet\">quartet<\/h3>\n<p>  <\/p>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0454\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 &quot;\u043a\u043e\u043c\u043f\u043b\u0438\u044f\u0442\u043e\u0440\u0430&quot;<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const { v } = require(&quot;quartet&quot;);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const validator = v(&quot;Hello World!&quot;);<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u044f\u0442\u044c \u0437\u0430\u043c\u0435\u0440\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Quartet 9: Allegro Build  6,019,078 ops\/sec 3,893,780 ops\/sec 2,712,363 ops\/sec 5,926,415 ops\/sec 2,729,369 ops\/sec  \u0421\u0440\u0435\u0434\u043d\u0435\u0435: 4,256,201 ops\/sec<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0451\u043c \u0437\u0430\u043c\u0435\u0440 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">for (let i = 0; i &lt; positives.length; i++) {   validator(positives[i]); } for (let i = 0; i &lt; negatives.length; i++) {   validator(negatives[i]); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u044f\u0442\u044c \u0437\u0430\u043c\u0435\u0440\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Quartet 9: Allegro Validation  15,073,432 ops\/sec 13,711,573 ops\/sec 13,123,812 ops\/sec 25,617,225 ops\/sec 17,588,846 ops\/sec  \u0421\u0440\u0435\u0434\u043d\u0435\u0435: 17,022,977 ops\/sec<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u043c\u0435\u0435\u043c \u0442\u0430\u043a\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/-t\/zs\/_h\/-tzs_hijjjfvctwjxamx2irzkew.png\" alt=\"image\"><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/k2\/e4\/zf\/k2e4zfhjlvkcpwrmoa4pymdgowo.png\" alt=\"image\"><\/p>\n<p>  <\/p>\n<h3 id=\"prichiny\">\u041f\u0440\u0438\u0447\u0438\u043d\u044b<\/h3>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0442\u0430\u043a\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u044f\u0441\u043d\u0430 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">console.log(&quot;Function&quot;); console.log(validator.toString());<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">function (value) { return value === c; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c <code>c<\/code> \u2014 \u044d\u0442\u043e \u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440.<\/p>\n<p>  <\/p>\n<h3 id=\"itogi\">\u0418\u0442\u043e\u0433\u0438<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430 \u0442\u0430\u043a\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0432\u044b\u0432\u043e\u0434\u043e\u0432. \u041c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"my-vse-zhivye-lyudi\">\u041c\u044b \u0432\u0441\u0435 \u0436\u0438\u0432\u044b\u0435 \u043b\u044e\u0434\u0438<\/h2>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043c \u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440. \u041f\u0443\u0441\u0442\u044c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0433\u043e API. \u041c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c, \u0447\u0442\u043e \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u0438\u043f\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">interface Person {   id: number; \/\/ \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e   name: string; \/\/ \u043d\u0435\u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430   phone: string | null; \/\/ null \u0438\u043b\u0438 12 \u0446\u0438\u0444\u0440 \u043d\u043e\u043c\u0435\u0440\u0430   phoneBook: {     [name: string]: string; \/\/ 12 \u0446\u0438\u0444\u0440 \u043d\u043e\u043c\u0435\u0440   };   gender: &quot;male&quot; | &quot;female&quot;; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0411\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0437\u0430\u043c\u0435\u0440\u044b \u043d\u0430 \u0442\u0430\u043a\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u0437\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u0438 \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">const positives = [   {     id: 1,     name: &quot;andrew&quot;,     phone: &quot;380975003434&quot;,     phoneBook: {       andrew: &quot;380975003434&quot;,       bohdan: &quot;380975003434&quot;,       vasilina: &quot;380975003434&quot;     },     gender: &quot;male&quot;   },   {     id: 2,     name: &quot;bohdan&quot;,     phone: null,     phoneBook: {},     gender: &quot;male&quot;   },   {     id: 3,     name: &quot;Elena&quot;,     phone: null,     phoneBook: {       siroja: &quot;380975003434&quot;     },     gender: &quot;female&quot;   } ];<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"javascript\">const negatives = [   null, \/\/ \u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442   false, \/\/ \u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442   undefined, \/\/ \u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442   &quot;&quot;, \/\/ \u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442   1, \/\/ \u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442   Infinity, \/\/ \u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442   &quot;Hello World&quot;, \/\/ \u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442   {     id: 0, \/\/ \u043d\u0435 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e     name: &quot;andrew&quot;,     phone: &quot;380975003434&quot;,     phoneBook: {       andrew: &quot;380975003434&quot;,       bohdan: &quot;380975003434&quot;,       vasilina: &quot;380975003434&quot;     },     gender: &quot;male&quot;   },   {     \/\/ \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 id     name: &quot;andrew&quot;,     phone: &quot;380975003434&quot;,     phoneBook: {       andrew: &quot;380975003434&quot;,       bohdan: &quot;380975003434&quot;,       vasilina: &quot;380975003434&quot;     },     gender: &quot;male&quot;   },   {     id: 1.5, \/\/ \u041d\u0435 \u0446\u0435\u043b\u043e\u0435     name: &quot;andrew&quot;,     phone: &quot;380975003434&quot;,     phoneBook: {       andrew: &quot;380975003434&quot;,       bohdan: &quot;380975003434&quot;,       vasilina: &quot;380975003434&quot;     },     gender: &quot;male&quot;   },   {     id: 1,     name: &quot;&quot;, \/\/ \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430     phone: &quot;380975003434&quot;,     phoneBook: {       andrew: &quot;380975003434&quot;,       bohdan: &quot;380975003434&quot;,       vasilina: &quot;380975003434&quot;     },     gender: &quot;male&quot;   },   {     id: 1,     \/\/ \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 name     phone: &quot;380975003434&quot;,     phoneBook: {       andrew: &quot;380975003434&quot;,       bohdan: &quot;380975003434&quot;,       vasilina: &quot;380975003434&quot;     },     gender: &quot;male&quot;   },   {     id: 1,     name: &quot;andrew&quot;,     phone: &quot;38097500434&quot;, \/\/ 11 \u0446\u0438\u0444\u0440     phoneBook: {       andrew: &quot;380975003434&quot;,       bohdan: &quot;380975003434&quot;,       vasilina: &quot;380975003434&quot;     },     gender: &quot;male&quot;   },   {     id: 1,     name: &quot;andrew&quot;,     \/\/ \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 phone     phoneBook: {       andrew: &quot;380975003434&quot;,       bohdan: &quot;380975003434&quot;,       vasilina: &quot;380975003434&quot;     },     gender: &quot;male&quot;   },   {     id: 1,     name: &quot;andrew&quot;,     phone: &quot;380975003434&quot;,     phoneBook: {       andrew: &quot;380975003434&quot;,       bohdan: &quot;380975003434&quot;,       vasilina: &quot;38097503434&quot; \/\/ 11 \u0446\u0438\u0444\u0440     },     gender: &quot;male&quot;   },   {     id: 1,     name: &quot;andrew&quot;,     phone: &quot;380975003434&quot;,     \/\/ phoneBook \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442     gender: &quot;male&quot;   },   {     id: 1,     name: &quot;andrew&quot;,     phone: &quot;380975003434&quot;,     phoneBook: {       andrew: &quot;380975003434&quot;,       bohdan: &quot;380975003434&quot;,       vasilina: &quot;380975003434&quot;     },     gender: &quot;Male&quot; \/\/ 'male'   },   {     id: 1,     name: &quot;andrew&quot;,     phone: &quot;380975003434&quot;,     phoneBook: {       andrew: &quot;380975003434&quot;,       bohdan: &quot;380975003434&quot;,       vasilina: &quot;380975003434&quot;     }   } ];<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h3 id=\"ajv-1\">ajv<\/h3>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0445\u0435\u043c\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const personSchema = {   type: &quot;object&quot;,   required: [&quot;id&quot;, &quot;name&quot;, &quot;phone&quot;, &quot;phoneBook&quot;, &quot;gender&quot;],   properties: {     id: {       type: &quot;integer&quot;,       exclusiveMinimum: 0     },     name: {       type: &quot;string&quot;,       minLength: 1     },     phone: {       anyOf: [         { type: &quot;null&quot; },         {           type: &quot;string&quot;,           pattern: &quot;^\\\\d{12}$&quot;         }       ]     },     phoneBook: {       type: &quot;object&quot;,       additionalProperties: {         type: &quot;string&quot;,         pattern: &quot;^\\\\d{12}$&quot;       }     },     gender: {       type: &quot;string&quot;,       enum: [&quot;male&quot;, &quot;female&quot;]     }   } };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const ajvCheckPerson = ajv.compile(personSchema);<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0434\u044f \u0434\u0435\u0441\u044f\u0442\u044c \u0437\u0430\u043c\u0435\u0440\u043e\u0432 \u0438\u043c\u0435\u0435\u043c \u0442\u0430\u043a\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Ajv Build  79,476 ops\/sec 78,334 ops\/sec 61,752 ops\/sec 77,395 ops\/sec 78,539 ops\/sec 51,922 ops\/sec 80,031 ops\/sec 77,687 ops\/sec 65,439 ops\/sec 79,805 ops\/sec  \u0421\u0440\u0435\u0434\u043d\u0435\u0435: 73,038 ops\/sec<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0434\u0451\u043c \u0437\u0430\u043c\u0435\u0440\u044b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">for (let i = 0; i &lt; positives.length; i++) {   ajvCheckPerson(positives[i]); } for (let i = 0; i &lt; negatives.length; i++) {   ajvCheckPerson(negatives[i]); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0435\u0441\u044f\u0442\u044c \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0437\u0430\u043c\u0435\u0440\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Ajv Validation  227,640 ops\/sec 301,134 ops\/sec 190,450 ops\/sec 195,595 ops\/sec 384,380 ops\/sec 193,358 ops\/sec 385,280 ops\/sec 239,009 ops\/sec 193,832 ops\/sec 392,808 ops\/sec  \u0421\u0440\u0435\u0434\u043d\u0435\u0435: 270,349 ops\/sec<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"quartet-1\">quartet<\/h3>\n<p>  <\/p>\n<p>\u0421\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const checkPerson = v({   id: v.and(v.safeInteger, v.positive),   name: v.and(v.string, v.minLength(1)),   phone: [null, v.test(\/^\\d{12}$\/)],   phoneBook: {     [v.rest]: v.test(\/^\\d{12}$\/)   },   gender: [&quot;male&quot;, &quot;female&quot;] });<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0435\u0441\u044f\u0442\u044c \u0437\u0430\u043c\u0435\u0440\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Quartet 9: Allegro Build  35,564 ops\/sec 14,401 ops\/sec 15,438 ops\/sec 26,852 ops\/sec 33,935 ops\/sec 16,010 ops\/sec 34,550 ops\/sec 33,148 ops\/sec 16,037 ops\/sec 36,828 ops\/sec  \u0421\u0440\u0435\u0434\u043d\u0435\u0435: 26,276 ops\/sec<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0434\u0451\u043c \u0437\u0430\u043c\u0435\u0440\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">for (let i = 0; i &lt; positives.length; i++) {   checkPerson(positives[i]); } for (let i = 0; i &lt; negatives.length; i++) {   checkPerson(negatives[i]); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0435\u0441\u044f\u0442\u044c \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Quartet 9: Allegro Validation  237,059 ops\/sec 435,844 ops\/sec 248,021 ops\/sec 238,931 ops\/sec 416,993 ops\/sec 281,904 ops\/sec 439,975 ops\/sec 242,074 ops\/sec 330,487 ops\/sec 421,704 ops\/sec  \u0421\u0440\u0435\u0434\u043d\u0435\u0435: 329,299 ops\/sec<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0440\u0430\u0432\u043d\u0438\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043e\u0431\u043e\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5u\/5e\/co\/5u5eco9fklnbrifwelobswnxtei.png\" alt=\"image\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mg\/wz\/tw\/mgwztwmr8asx-rfp72ou8widwyq.png\" alt=\"image\"><\/p>\n<p>  <\/p>\n<h3 id=\"prichiny-1\">\u041f\u0440\u0438\u0447\u0438\u043d\u044b<\/h3>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0447\u0438\u043d\u044b \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438, \u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043e\u0442\u0441\u0442\u0430\u0432\u0430\u043d\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0441\u0442\u0430\u043d\u0443\u0442 \u044f\u0441\u043d\u044b\u043c\u0438, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>checkPerson<\/code> \u0438 \u0435\u0451 \u043f\u043e\u043b\u044f \u0438 \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">console.log(checkPerson.toString()); console.log({ ...checkPerson });<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function validator(value) {   if (value == null) return false   if (!validator.and(value.id)) return false   if (!validator[&quot;and-1&quot;](value.name)) return false   if (!validator[&quot;value.phone&quot;](value.phone)) return false   if (value.phoneBook == null) return false   validator.keys = Object.keys(value.phoneBook)   for (let i = 0; i &lt; validator.keys.length; i++) {     validator.elem = value.phoneBook[validator.keys[i]]     if (!validator[&quot;tester-1&quot;].test(validator.elem)) return false   }    if (!validator[&quot;value.gender&quot;](value.gender)) return false   return true };  \/\/ Check person properties {   and: function validator(value) {     if (!Number.isSafeInteger(value)) return false     if (value &lt;= 0) return false     return true   },   'and-1': validator(value) {     if (typeof value !== 'string') return false     if (value == null || value.length &lt; 1) return false     return true   },   'value.phone': function validator(value) {     if (value === null) return true;     if (validator.tester.test(value)) return true;     return false   }   ['value.phone']['tester']: \/^\\d{12}$\/,   'tester-1': \/^\\d{12}$\/,   'value.gender': function validator(value) {     if (validator.__validValuesDict[value] === true) return true     return false   },   ['value.gender']['__validValuesDict']: {     male: true,     female: true   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u2014 \u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u043b\u0435\u0433\u043a\u0438\u0439 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, \u043d\u043e \u043f\u0440\u0438 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u043c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0438 \u0441\u0442\u0430\u043d\u0435\u0442 \u044f\u0441\u043d\u043e \u2014 \u0447\u0442\u043e \u043e\u043d \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0442\u0438\u043f\u0430 \u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0435\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e.<\/p>\n<p>  <\/p>\n<h2 id=\"itogi-1\">\u0418\u0442\u043e\u0433\u0438<\/h2>\n<p>  <\/p>\n<p>\u042f \u0432\u043e\u043e\u0434\u0443\u0448\u0435\u0432\u043b\u0451\u043d \u0442\u0430\u043a\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c <code>quartet@9<\/code> \u043d\u0430 \u0434\u0435\u043b\u0435.<\/p>\n<p>  <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438.<\/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\/494632\/\"> https:\/\/habr.com\/ru\/post\/494632\/<\/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\/494632\/\">\n<p>\u041a\u043e\u0433\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0430\u0441\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 <a href=\"https:\/\/www.npmjs.com\/package\/quartet\" rel=\"nofollow\">quartet<\/a> \u0431\u044b\u043b\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0446\u0435\u043b\u0438-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li>TypeScript<\/li>\n<li>\u041a\u0440\u0430\u0442\u043a\u043e\u0441\u0442\u044c<\/li>\n<li>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430<\/li>\n<li>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c <code>quartet<\/code> \u0438 \u0435\u0451 \u043f\u0440\u0438\u0447\u0438\u043d\u044b.<\/p>\n<p>  <\/p>\n<p>\u0411\u0443\u0434\u0435\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0430\u0441\u043f\u0435\u043a\u0442 \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 <code>quartet<\/code> \u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0439 <a href=\"https:\/\/www.npmjs.com\/package\/ajv\" rel=\"nofollow\">ajv<\/a>.<\/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-300925","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/300925","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=300925"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/300925\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=300925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=300925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=300925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}