GithubHelp home page GithubHelp logo

fantasticfiasco / expect Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 1.0 668.11 MB

A Node.js library written in TypeScript providing argument validation.

License: Apache License 2.0

TypeScript 55.04% JavaScript 44.96%
expect argument validation hacktoberfest

expect's Introduction

@fantasticfiasco/expect

Build Status Coverage Status npm version SemVer compatible

A Node.js library written in TypeScript providing argument validation.

Table of contents

Super simple to use

import * as expect from '@fantasticfiasco/expect';

function update(person) {
    expect.toExist(person.name);
    expect.toBeTrue(person.age >= 0, 'existential theories are not up for discussion');

    // Squint your eyes and imagine your code here...
}

Installation

npm install @fantasticfiasco/expect
# or
yarn add @fantasticfiasco/expect

API

toBeTrue(condition[, errorMessage])

  • condition: boolean The condition expected to be true
  • errorMessage: string The optional error message displayed if expectation fails

Expect a condition to be true.

toBeFalse(condition[, errorMessage])

  • condition: boolean The condition expected to be false
  • errorMessage: string The optional error message displayed if expectation fails

Expect a condition to be false.

toExist<T>(value[, errorMessage])

  • value: T The value expected to exist
  • errorMessage: string The optional error message displayed if expectation fails

Expect a value to exist.

toNotExist<T>(value[, errorMessage])

  • value: T The value expected not to exist
  • errorMessage: string The optional error message displayed if expectation fails

Expect a value not to exist.

toBeAlphanumeric(value[, errorMessage])

  • value: string The value expected to be alphanumeric
  • errorMessage: string The optional error message displayed if expectation fails

Expect a value to be alphanumeric.

toBeCharCodes(value, minCharCode, maxCharCode[, errorMessage])

  • value: string The value expected to have characters from a range of character codes
  • minCharCode: number The expected minimum character code
  • maxCharCode: number The expected maximum character code
  • errorMessage: string The optional error message displayed if expectation fails

Expect a value to only contain characters from a range of character codes.

Credit

Thank you JetBrains for your important initiative to support the open source community with free licenses to your products.

JetBrains

expect's People

Contributors

alandeev avatar dependabot[bot] avatar fantasticfiasco avatar github-actions[bot] avatar greenkeeper[bot] avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

alandeev

expect's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Pending Status Checks

These updates await pending status checks. To force their creation now, click the checkbox below.

  • chore(deps): update dependency inquirer to v9.2.20
  • chore(deps): update eslint packages to v7.7.1 (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci-cd.yml
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/update-copyright-years-in-license-file.yml
  • actions/checkout v4
  • FantasticFiasco/action-update-license-year v3
npm
.yarn/sdks/eslint/package.json
.yarn/sdks/typescript/package.json
package.json
  • @octokit/rest 20.1.0
  • @types/jest 29.5.12
  • @types/node 20.12.7
  • @typescript-eslint/eslint-plugin 7.7.0
  • @typescript-eslint/parser 7.7.0
  • copyfiles 2.4.1
  • eslint 8.57.0
  • inquirer 9.2.19
  • jest 29.7.0
  • rimraf 5.0.5
  • ts-jest 29.1.2
  • typescript 5.4.5
  • node >=16.0.0
  • hosted-git-info >=2.8.9
  • node-fetch >=3.2.10
  • path-parse >=1.0.7
  • tmpl >=1.0.5
  • yarn 3.8.1

  • Check this box to trigger a request for Renovate to run again on this repository

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.