Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/ajv/lib/dot/multipleOf.jst')
-rw-r--r--node_modules/ajv/lib/dot/multipleOf.jst22
1 files changed, 22 insertions, 0 deletions
diff --git a/node_modules/ajv/lib/dot/multipleOf.jst b/node_modules/ajv/lib/dot/multipleOf.jst
new file mode 100644
index 000000000..6d88a456f
--- /dev/null
+++ b/node_modules/ajv/lib/dot/multipleOf.jst
@@ -0,0 +1,22 @@
+{{# def.definitions }}
+{{# def.errors }}
+{{# def.setupKeyword }}
+{{# def.$data }}
+
+{{# def.numberKeyword }}
+
+var division{{=$lvl}};
+if ({{?$isData}}
+ {{=$schemaValue}} !== undefined && (
+ typeof {{=$schemaValue}} != 'number' ||
+ {{?}}
+ (division{{=$lvl}} = {{=$data}} / {{=$schemaValue}},
+ {{? it.opts.multipleOfPrecision }}
+ Math.abs(Math.round(division{{=$lvl}}) - division{{=$lvl}}) > 1e-{{=it.opts.multipleOfPrecision}}
+ {{??}}
+ division{{=$lvl}} !== parseInt(division{{=$lvl}})
+ {{?}}
+ )
+ {{?$isData}} ) {{?}} ) {
+ {{# def.error:'multipleOf' }}
+} {{? $breakOnError }} else { {{?}}