Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Cannot read property 'existyStrict' of undefined #255

Open
smk005 opened this issue Apr 1, 2020 · 0 comments
Open

Cannot read property 'existyStrict' of undefined #255

smk005 opened this issue Apr 1, 2020 · 0 comments

Comments

@smk005
Copy link

smk005 commented Apr 1, 2020

Prerequisites

Hi Team, I am getting the following issue as shown below for extend sample.

[
{
message: "Cannot read property 'existyStrict' of undefined",
validation: 'ENGINE_EXCEPTION',
field: 'start_time'
}
]
How can I fix. Please help. Thank you in advance for your support. Really very awesome and helpful validation library.

Package version

v7.4.4

Node.js and npm version

12.11.1

Sample Code (to reproduce the issue)

const { validate, configure, validateAll, extend } = require('indicative/validator');
const { getValue, skippable } = require('indicative-utils');

const schema = {
username: 'required|alpha',
start_time: 'required|time',
//password: 'required|min:4|max:40',
}

const data = {
username: 'test',
start_time:'0er'
}

const timeRegex = /([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?/;

extend('time', {
async: false,

validate (data, field, args) {
    const fieldValue = getValue(data, field)
    if (skippable(fieldValue)) {
    return true
    }

    return timeRegex.test(fieldValue)
}
});

validate(data, schema, {'start_time.required':'start_time is required','start_time.time':'invalid start time format'}, {
    existyStrict: false,
    removeAdditional: false
  })
.then(console.log)
.catch(console.error)
@smk005 smk005 changed the title Please help I am getting Cannot read property 'existyStrict' of undefined Cannot read property 'existyStrict' of undefined Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant