"Fossies" - the Fresh Open Source Software Archive

Member "node-v12.18.4-win-x86/node_modules/npm/node_modules/ajv/lib/dot/uniqueItems.jst" (14 Feb 2020, 875 Bytes) of package /windows/www/node-v12.18.4-win-x86.zip:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 {{# def.definitions }}
    2 {{# def.errors }}
    3 {{# def.setupKeyword }}
    4 {{# def.$data }}
    5 
    6 
    7 {{? ($schema || $isData) && it.opts.uniqueItems !== false }}
    8   {{? $isData }}
    9     var {{=$valid}};
   10     if ({{=$schemaValue}} === false || {{=$schemaValue}} === undefined)
   11       {{=$valid}} = true;
   12     else if (typeof {{=$schemaValue}} != 'boolean')
   13       {{=$valid}} = false;
   14     else {
   15   {{?}}
   16 
   17   var {{=$valid}} = true;
   18   if ({{=$data}}.length > 1) {
   19     var i = {{=$data}}.length, j;
   20     outer:
   21     for (;i--;) {
   22       for (j = i; j--;) {
   23         if (equal({{=$data}}[i], {{=$data}}[j])) {
   24           {{=$valid}} = false;
   25           break outer;
   26         }
   27       }
   28     }
   29   }
   30 
   31   {{? $isData }}  }  {{?}}
   32 
   33   if (!{{=$valid}}) {
   34     {{# def.error:'uniqueItems' }}
   35   } {{? $breakOnError }} else { {{?}}
   36 {{??}}
   37   {{? $breakOnError }} if (true) { {{?}}
   38 {{?}}