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

apollo-server-throw-if

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-server-throw-if

A library that throws Apollo Server exceptions when validations fail.

  • 0.1.0
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

apollo-throw-if

github license npm version

A library that throws Apollo Server exceptions when validations fail.

Usage

Install module

npm install --save apollo-server-throw-if

Sample

const throwIf = require('apollo-server-throw-if')

// [your code here...]

throwIf.invalidDateInMs('2043-01-01', 'lastUpdate')

Functions

FunctionsDescription
objectDoesNotContain(object, objectName, properties)Throws if any of the property names listed in properties are not in object
invalidDateInMs(value, argumentName)Throws if:
- value is not a number
- value can not be parsed by new Date(value)
invalidFirestoreId(id, objectName)Throws if:
- not a valid Firestore id (20 characters a-z, A-Z, and 0-9)
invalidShortDate(value, argumentName)Expects a date with the format (YYYY-MM-DD). Throws if:
- value is not a string with exactly 10 characters
- value can not be parsed by new Date(value)
invalidTrimmedNonEmptyString(value, argumentName)Throws if:
- value is not a string
- value is not trimmed
- string is empty

Keywords

FAQs

Package last updated on 10 Aug 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