Last change
on this file was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago |
primeNG components
|
-
Property mode
set to
100644
|
File size:
818 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var KNOWN_TYPES = ['undefined', 'string', 'number', 'object', 'function', 'boolean', 'symbol'];
|
---|
| 4 |
|
---|
| 5 | module.exports = function defFunc(ajv) {
|
---|
| 6 | defFunc.definition = {
|
---|
| 7 | inline: function (it, keyword, schema) {
|
---|
| 8 | var data = 'data' + (it.dataLevel || '');
|
---|
| 9 | if (typeof schema == 'string') return 'typeof ' + data + ' == "' + schema + '"';
|
---|
| 10 | schema = 'validate.schema' + it.schemaPath + '.' + keyword;
|
---|
| 11 | return schema + '.indexOf(typeof ' + data + ') >= 0';
|
---|
| 12 | },
|
---|
| 13 | metaSchema: {
|
---|
| 14 | anyOf: [
|
---|
| 15 | {
|
---|
| 16 | type: 'string',
|
---|
| 17 | enum: KNOWN_TYPES
|
---|
| 18 | },
|
---|
| 19 | {
|
---|
| 20 | type: 'array',
|
---|
| 21 | items: {
|
---|
| 22 | type: 'string',
|
---|
| 23 | enum: KNOWN_TYPES
|
---|
| 24 | }
|
---|
| 25 | }
|
---|
| 26 | ]
|
---|
| 27 | }
|
---|
| 28 | };
|
---|
| 29 |
|
---|
| 30 | ajv.addKeyword('typeof', defFunc.definition);
|
---|
| 31 | return ajv;
|
---|
| 32 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.