Method with no parameters will error

Open
#39 11 comments 1 reaction 1 assignee View on GitHub

@stubailo is already working on this.

Since Apr 25, 2016.

Assessment

This issue has not been assessed yet.

Description

enhancement

So as per the Meteor guide, if you use mdg:validated-method to create a method that takes no parameters, you still must provide a validator, like so:

validate: new SimpleSchema({}).validator()

But there is an issue then if you then call that method with no parameters at all. e.g. calling

Collection.methods.methodName.call()

will error. As the validator, expects an object as the first parameter. Obviously just changing this to:

Collection.methods.methodName.call({})

fixes the issue, but it's a little awkward.

Dominant language
JavaScript
Stars
193
Forks
29
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from meteor/validated-method

All issues in meteor/validated-method

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.