npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@yokotak0527/kensho-rulebook-default

v1.0.1

Published

[Kensho](https://www.npmjs.com/package/@yokotak0527/kensho) ruleBook package.

Downloads

4

Readme

Kensho-rulebook-default

Kensho ruleBook package.

Install

$ npm i @yokotak0527/kensho-rulebook-default

Usage

import Kensho from '@yokotak0527/kensho'
import ruleBook from '@yokotak0527/kensho-rulebook-default'

// if you are using CommonJS
const Kensho = require('@yokotak0527/kensho')
const ruleBook = require('@yokotak0527/kensho-rulebook-default')

Kensho.rule.import(ruleBook)

rule list

isNumber(value: unknown)

The value is a number.

isNegativeNumber(value: number, option:Object)

The value is a negative number.
ex. zero, -1, -1.1, -3, -4...

| option prop. | type | default | desc. | |--------------|-----------|---------|-------| | zero | boolean | false | include 0 as negative number. |

isPositiveNumber(value: number, option:Object)

The value is a positive number.
ex. zero, 1, 1.1, 3, 4...

| option prop. | type | default | desc. | |--------------|-----------|---------|-------| | zero | boolean | true | include 0 as positive number. |

isInteger(value: number)

The value is an integer.

isNegativeInteger(value: number, option: Object)

The value is a negative integer.
ex. -1, -2, -3, -4...

| option prop. | type | default | desc. | |--------------|-----------|---------|-------| | zero | boolean | false | include 0 as negative integer. |

isPositiveInteger(value: number, option: Object)

The value is a positive integer.
ex. 0, 1, 2, 3, 4...

| option prop. | type | default | desc. | |--------------|-----------|---------|-------| | zero | boolean | true | include 0 as positive integer. |

isNaturalNumber(value: number, option: Object)

The value is a natural number. This is as alias for isPositiveInteger().
ex. 0, 1, 2, 3, 4...

| option prop. | type | default | desc. | |--------------|-----------|---------|-------| | zero | boolean | true | include 0 as natural number. |

isAge(value: number, option: Object)

The value is valid for age.

| option prop. | type | default | desc. | |--------------|-----------|---------|-------| | max | number | 125 | upper limit for age. include this value. |

isString(value: unknown)

The value is a string.

regexp(value: string, option: Object)

The value matches a regular expression.
Returns true if no regular expression is specified in option.regexp.

| option prop. | type | default | desc. | |--------------|-----------|---------|-------| | regexp | RegExp | | Returns true if no regular expression is specified in option.regexp. |

isEmpty(value: any)

The value is empty.
Support types are undefined, null, string, Array<any>, Object. If you pass other then above types, returns false.

exists(value: any)

The value is existed.
Returns the opposite result of isEmpty().

isEmail(value: string)

The value is valid as e-mail address.

equal(value: any, option: Object)

The value same as option.isSame.
This is depend on fast-deep-equal.

| option prop. | type | default | desc. | |--------------|----------------|---------|-------| | isSame | typeof value | | |

isZero(value: number)

The value is 0.

words(value: string, option: Object)

The words is between option.min and option.max.
If you pass option.min as negative number, throw Error.
If you pass number to option.max less than option.min, throw Error.

| option prop. | type | default | desc. | |--------------|--------|---------|-------| | min | number | 0 | | | max | number | -1 | -1 means do not use. |