Code Monkey home page Code Monkey logo

intus's People

Contributors

bdsumon4u avatar druc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

intus's Issues

TS Support

Can you please add typescript support to the package?

Parse date strings

Currently the isDate() rule only accepts Date objects. Would be nice to work with strings as well.

New isDistinctWith rule

Would be nice to have something like this:

"lines.*.expiration_date": [isDistinctWith(["lines.*.id"])]

This would ensure only lines with different expiration_date&id are allowed.

[Feature] Support nested data validation

Hey Constantin,
Thanks for this great library and the videos with intus was very helpfull. I have face a "problem", I have dynamics inpus and the data is in an array object. It will be a great feature if the intus support an array with data and an array with multiple rules. The intus work perfect by the way and it is great.

const validation = intus.validate({
  name: [isRequired()],
  products: [
    products.value,
    [isRequired(), ...],
  ],
});

Validation Errors uses dot notation in nested data.

I would like to report this issue where the validation.errors() produces an object key with dot notation. causing me to not access the address.province validation error.

image

                <div class="flex flex-col">
                    <TextField v-model="form.address.province" label="Province" :invalidFeedback="errors.address.province" />
                </div>
            </div>

<script>
import { defineComponent } from 'vue';
import intus from 'intus'
import { isRequired } from 'intus/rules';

export default defineComponent({
    name: 'Dashboard',
    setup(){},
    data(){
        return {
            active: false,
            form: {
                name: null,
                address: {
                    province: null,
                }
            },
        }
    },
    methods: {
        submit(){

            let validation = intus.validate(
                this.form,
                {
                    name: [isRequired()],
                    "address.province":  [isRequired()]
                },
            )

            if(validation.passes()){
                alert('๐Ÿคก๐Ÿ’ฃ')
            }
            console.log(validation.errors())
            this.errors = validation.errors()
        }
    },
})
</script>
<TextField v-model="form.address.barangay" label="Mokong Address" :invalidFeedback="errors ? errors['address.province'] ?? null : null " />

Am I doing something wrong or is this an expected result? Im using this work around at the moment it just breaks the intuitiveness of the package. Thank you in advance

Message mapping on production build fails

Hello, there's a bug when build for production and the compiler (vite in my case) has function minification enabled.

In particular here: https://github.com/druc/intus/blob/master/lib/validation.js#L53

`${attributeToWildcard(attribute)}.${this.rules[attribute][rule].name}`

In this.rules[attribute][rule] you have a function, and when you call Function.name you expect to get the function name, which in case of this library means smth. You expect isRequired, isMin, etc.

But with the minification you get whatever the compiler choose for the function: ee, aa, a1.

Not really sure what the solution is for this. I guess you need a definition map for name to function in order to keep this link, as you can't really on the internal js function name.

Bogdan

subscribe @druc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.