Code Duplication    Length = 17-18 lines in 2 locations

formio/node_modules/ajv/lib/dotjs/validate.js 2 locations

@@ 301-318 (lines=18) @@
298
              var $schema = it.schema.properties,
299
                $schemaKeys = Object.keys($schema);
300
              var arr3 = $schemaKeys;
301
              if (arr3) {
302
                var $propertyKey, i3 = -1,
303
                  l3 = arr3.length - 1;
304
                while (i3 < l3) {
305
                  $propertyKey = arr3[i3 += 1];
306
                  var $sch = $schema[$propertyKey];
307
                  if ($sch.default !== undefined) {
308
                    var $passData = $data + it.util.getProperty($propertyKey);
309
                    out += '  if (' + ($passData) + ' === undefined) ' + ($passData) + ' = ';
310
                    if (it.opts.useDefaults == 'shared') {
311
                      out += ' ' + (it.useDefault($sch.default)) + ' ';
312
                    } else {
313
                      out += ' ' + (JSON.stringify($sch.default)) + ' ';
314
                    }
315
                    out += '; ';
316
                  }
317
                }
318
              }
319
            } else if ($rulesGroup.type == 'array' && Array.isArray(it.schema.items)) {
320
              var arr4 = it.schema.items;
321
              if (arr4) {
@@ 321-337 (lines=17) @@
318
              }
319
            } else if ($rulesGroup.type == 'array' && Array.isArray(it.schema.items)) {
320
              var arr4 = it.schema.items;
321
              if (arr4) {
322
                var $sch, $i = -1,
323
                  l4 = arr4.length - 1;
324
                while ($i < l4) {
325
                  $sch = arr4[$i += 1];
326
                  if ($sch.default !== undefined) {
327
                    var $passData = $data + '[' + $i + ']';
328
                    out += '  if (' + ($passData) + ' === undefined) ' + ($passData) + ' = ';
329
                    if (it.opts.useDefaults == 'shared') {
330
                      out += ' ' + (it.useDefault($sch.default)) + ' ';
331
                    } else {
332
                      out += ' ' + (JSON.stringify($sch.default)) + ' ';
333
                    }
334
                    out += '; ';
335
                  }
336
                }
337
              }
338
            }
339
          }
340
          var arr5 = $rulesGroup.rules;