Rocky_Mountain_Vending/.pnpm-store/v10/files/49/de850298f90a87ec7a1a73a87a63b3add1324b18d94acbac5ee0c80119ac7b1f269cdbf6d734256022c89898a95cac2c1a2a5a0c9f4e7053d6ec042673d7a7-exec
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

93 lines
2.2 KiB
Text
Executable file

'use strict';
const { assert } = require('@hapi/hoek');
const Keys = require('./keys');
const internals = {};
module.exports = Keys.extend({
type: 'function',
properties: {
typeof: 'function'
},
rules: {
arity: {
method(n) {
assert(Number.isSafeInteger(n) && n >= 0, 'n must be a positive integer');
return this.$_addRule({ name: 'arity', args: { n } });
},
validate(value, helpers, { n }) {
if (value.length === n) {
return value;
}
return helpers.error('function.arity', { n });
}
},
class: {
method() {
return this.$_addRule('class');
},
validate(value, helpers) {
if ((/^\s*class\s/).test(value.toString())) {
return value;
}
return helpers.error('function.class', { value });
}
},
minArity: {
method(n) {
assert(Number.isSafeInteger(n) && n > 0, 'n must be a strict positive integer');
return this.$_addRule({ name: 'minArity', args: { n } });
},
validate(value, helpers, { n }) {
if (value.length >= n) {
return value;
}
return helpers.error('function.minArity', { n });
}
},
maxArity: {
method(n) {
assert(Number.isSafeInteger(n) && n >= 0, 'n must be a positive integer');
return this.$_addRule({ name: 'maxArity', args: { n } });
},
validate(value, helpers, { n }) {
if (value.length <= n) {
return value;
}
return helpers.error('function.maxArity', { n });
}
}
},
messages: {
'function.arity': '{{#label}} must have an arity of {{#n}}',
'function.class': '{{#label}} must be a class',
'function.maxArity': '{{#label}} must have an arity lesser or equal to {{#n}}',
'function.minArity': '{{#label}} must have an arity greater or equal to {{#n}}'
}
});