Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] easiest way to give number as an option #113

Open
dtracers opened this issue Jun 22, 2015 · 1 comment
Open

[Question] easiest way to give number as an option #113

dtracers opened this issue Jun 22, 2015 · 1 comment
Labels

Comments

@dtracers
Copy link
Contributor

I am making the new rule for description style for params and basically I want them to either put a string or an object that contains a number.

ex:

validTagDescription: "single-line"

or

validTagDescription: { spaces: 10 }

I did not know if there was a way to put in the valid values space like

validTagDescription: { allowedValues: ['single-line', { spaces: '#' }]

or something that represents the number type?

I saw that the check annotations just did the check by hand and then stored a value locally.

Also I do not want to allow true as it does not make sense as to what the default should be (but false is allowed obviously)

@qfox
Copy link
Member

qfox commented Jun 24, 2015

There were no real use-cases for Numbers so I've left them to the further researches. In the JSCS repo we thinking about some schema: jscs-dev/node-jscs#895

I think it can be a function for a while with a pure checking like:
function (v) { return typeof v === 'number' || v === true; }

@qfox qfox added the question label Aug 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants