Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expect-more

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expect-more

Curried JavaScript Type Testing Library with Zero Dependencies

  • 0.5.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
80K
decreased by-5.6%
Maintainers
1
Weekly downloads
 
Created
Source

expect-more

Curried JavaScript Type Testing Library with Zero Dependencies

NPM version NPM downloads Build Status Code Climate Gitter Chat for expect-more Donate via PayPal Analytics Follow JamieMason on GitHub Follow fold_left on Twitter

Status

This is a new project which needs a lot of work on documentation. It is under active development so there will likely be changes, but at its core it is a rewrite of the core logic behind the matchers in jasmine-expect which is a mature, well-tested library.

Installation

npm install expect-more --save-dev

Usage

import { endsWith, isWithinRange } from 'expect-more';

endsWith('Script', 'JavaScript');
// => true

const endsWithScript = endsWith('Script');
endsWithScript('JavaScript');
// => true

isWithinRange(10, 20, 21);
// => false

[0, 1, 1, 2, 3, 5, 8, 13, 21, 34].filter(isWithinRange(5, 15));
// => [5, 8, 13]

API

General

  • isBoolean: (value: any) => boolean
  • isFalse: (value: any) => boolean
  • isNull: (value: any) => boolean
  • isRegExp: (value: any) => boolean
  • isTrue: (value: any) => boolean
  • isUndefined: (value: any) => boolean

Functions

  • isFunction: (value: any) => boolean
  • throwsAnyError: (value: () => void) => boolean
  • throwsErrorOfType: (typeName: string, value: () => void) => boolean

Objects

  • hasMember: (memberName: string, value: any) => boolean
  • isEmptyObject: (value: any) => boolean
  • isNonEmptyObject: (value: any) => boolean
  • isObject: (value: any) => boolean
  • isWalkable: (value: any) => boolean

Arrays

  • isArray: (value: any) => boolean
  • isArrayOfBooleans: (value: any) => boolean
  • isArrayOfNumbers: (value: any) => boolean
  • isArrayOfObjects: (value: any) => boolean
  • isArrayOfSize: (size: number, value: any) => boolean
  • isArrayOfStrings: (value: any) => boolean
  • isEmptyArray: (any) => boolean
  • isNonEmptyArray: (value: any) => boolean

Dates

  • isAfter: (other: Date, value: any) => boolean
  • isBefore: (other: Date, value: any) => boolean
  • isDate: (value: any) => boolean
  • isIso8601: (value: any) => boolean
  • isValidDate: (value: any) => boolean

Numbers

  • isCalculable: (value: any) => boolean
  • isDivisibleBy: (other: number, value: any) => boolean
  • isEvenNumber: (value: any) => boolean
  • isGreaterThanOrEqualTo: (other: number, value: any) => boolean
  • isLessThanOrEqualTo: (other: number, value: any) => boolean
  • isNear: (other: number, epsilon: number, value: any) => boolean
  • isNumber: (value: any) => boolean
  • isOddNumber: (value: any) => boolean
  • isWholeNumber: (value: any) => boolean
  • isWithinRange: (floor: number, ceiling: number, value: any) => boolean

Strings

  • endsWith: (other: string, value: any) => boolean
  • isEmptyString: (value: any) => boolean
  • isJsonString: (value: any) => boolean
  • isLongerThan: (other: string, value: any) => boolean
  • isNonEmptyString: (value: any) => boolean
  • isSameLengthAs: (other: string, value: any) => boolean
  • isShorterThan: (other: string, value: any) => boolean
  • isString: (value: any) => boolean
  • isWhitespace: (value: any) => boolean
  • startsWith: (other: string, value: any) => boolean

FAQs

Package last updated on 17 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc