GithubHelp home page GithubHelp logo

Comments (9)

SamVerschueren avatar SamVerschueren commented on September 3, 2024

I'm not sure about the syntax anymore. Maybe something like ow.predicate.validate(customPredicate | function)?

const ow = require('ow');
const owDate = require('ow-date');

// Custom predicate
ow('2017-09-12', ow.string.validate(owDate.date.after('2018-01-01')));

// Custom function
ow('foo', ow.string.validate(value => ({
    message: 'Expected the value to be foo',
    validator: value === 'foo'
});

Just some thoughts :)

from ow.

SamVerschueren avatar SamVerschueren commented on September 3, 2024

The validate method is actually what is defines in #4. Except that is accepts a function which returns a boolean and not a validation object.

from ow.

sindresorhus avatar sindresorhus commented on September 3, 2024

Yeah, I like that API better too.

from ow.

IssueHuntBot avatar IssueHuntBot commented on September 3, 2024

@issuehuntfest has funded $80.00 to this issue. See it on IssueHunt

from ow.

SamVerschueren avatar SamVerschueren commented on September 3, 2024

@sindresorhus whats the path forward here? Do you want the API which accepts a validation object?

from ow.

sindresorhus avatar sindresorhus commented on September 3, 2024

Yeah, I can't think of a better API than what you've suggest in #40 (comment).

from ow.

SamVerschueren avatar SamVerschueren commented on September 3, 2024

👌

from ow.

IssueHuntBot avatar IssueHuntBot commented on September 3, 2024

@rororofff has funded $2.00 to this issue.


from ow.

IssueHuntBot avatar IssueHuntBot commented on September 3, 2024

@sindresorhus has rewarded $73.80 to @SamVerschueren. See it on IssueHunt

  • 💰 Total deposit: $82.00
  • 🎉 Repository reward(0%): $0.00
  • 🔧 Service fee(10%): $8.20

from ow.

Related Issues (20)

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.