How to use the ajv/lib/ajv function in ajv

To help you get started, we’ve selected a few ajv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vcync / modV / src / store / modules / modv-modules.js View on Github external
presetData({ state }) {
    // @TODO: figure out a better clone than JSONparse(JSONstringify())
    const ajv = new Ajv({
      removeAdditional: 'all'
    })
    ajv.addMetaSchema(jsd4)

    const moduleNames = Object.keys(state.active).filter(
      key => key.substring(key.length - 8, key.length) !== '-gallery'
    )

    const moduleData = moduleNames.reduce((obj, moduleName) => {
      obj[moduleName] = {}
      obj[moduleName].values = Object.keys(
        state.active[moduleName].props || {}
      ).reduce((valuesObj, prop) => {
        valuesObj[prop] = state.active[moduleName][prop]
        return valuesObj
      }, {})