Sha256: 545a502321ba98367137664f23766e607ba4be0744187ae8c303ff8367fc4f37
Contents?: true
Size: 818 Bytes
Versions: 180
Compression:
Stored size: 818 Bytes
Contents
'use strict'; var KNOWN_TYPES = ['undefined', 'string', 'number', 'object', 'function', 'boolean', 'symbol']; module.exports = function defFunc(ajv) { defFunc.definition = { inline: function (it, keyword, schema) { var data = 'data' + (it.dataLevel || ''); if (typeof schema == 'string') return 'typeof ' + data + ' == "' + schema + '"'; schema = 'validate.schema' + it.schemaPath + '.' + keyword; return schema + '.indexOf(typeof ' + data + ') >= 0'; }, metaSchema: { anyOf: [ { type: 'string', enum: KNOWN_TYPES }, { type: 'array', items: { type: 'string', enum: KNOWN_TYPES } } ] } }; ajv.addKeyword('typeof', defFunc.definition); return ajv; };
Version data entries
180 entries across 83 versions & 16 rubygems