Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
apollo-server-throw-if
Advanced tools
A library that throws Apollo Server exceptions when validations fail.
A library that throws Apollo Server exceptions when validations fail.
npm install --save apollo-server-throw-if
const throwIf = require('apollo-server-throw-if')
// [your code here...]
throwIf.invalidDateInMs('2043-01-01', 'lastUpdate')
Functions | Description |
---|---|
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 |
objectDoesNotContain(object, objectName, properties) | Throws if any of the property names listed in properties are not in object |
objectDoesNotExistOrIsDeleted(object, objectName) | Throws if the object does not exist of object.deleted is true |
objectExist(object, attributeName, attributeValue) | Throws if the object already exist. |
objectUpdatesHaveUnchangedProperties(objectUpdates, objectUpdatesName, originalObject) | Throws if any of the propertes in the objectUpdates has the same value as in originalObject . Change validation uses == as opposed to === and only works for objects that does not contain nested objects. |
outOfSync(localLastUpdated, serverLastUpdated) | Throws if: - any of the provided dates is not a valid date - dates are not the same |
FAQs
A library that throws Apollo Server exceptions when validations fail.
The npm package apollo-server-throw-if receives a total of 0 weekly downloads. As such, apollo-server-throw-if popularity was classified as not popular.
We found that apollo-server-throw-if demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.