From 0036cfad3a3035735fa24ad9377585de72074728 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Fri, 15 May 2020 22:41:17 +0200 Subject: [PATCH] Initial commit --- .gitignore | 1 + README.md | 5 +++++ example.js | 11 +++++++++++ index.js | 10 ++++++++++ package.json | 15 +++++++++++++++ yarn.lock | 20 ++++++++++++++++++++ 6 files changed, 62 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 example.js create mode 100644 index.js create mode 100644 package.json create mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/README.md b/README.md new file mode 100644 index 0000000..3d6a402 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# @validatem/match-validation-error + +Documentation for this module has not been written yet. By the time it reaches 1.0.0, it will have full documentation. + +In the meantime, check out the `example.js` file in the repository for a usage demonstration. diff --git a/example.js b/example.js new file mode 100644 index 0000000..169c0c7 --- /dev/null +++ b/example.js @@ -0,0 +1,11 @@ +"use strict"; + +const matchValidationError = require("./"); +const ValidationError = require("@validatem/error"); + +let error = new ValidationError("Must be a valid thing"); +let notAnError = 42; + +console.log(matchValidationError(error)); // true +console.log(matchValidationError(notAnError)); // false + diff --git a/index.js b/index.js new file mode 100644 index 0000000..4dfa815 --- /dev/null +++ b/index.js @@ -0,0 +1,10 @@ +"use strict"; + +const createVersionedSpecialCheck = require("@validatem/match-versioned-special"); + +module.exports = createVersionedSpecialCheck({ + markerProperty: "___validatem_isValidationError", + versionProperty: "___validatem_errorVersion", + friendlyName: "a ValidationError", + expectedVersions: [ 1 ] +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..c29bff1 --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "name": "@validatem/match-validation-error", + "description": "Utility for checking whether something is a ValidationError", + "version": "0.1.0", + "main": "index.js", + "repository": "http://git.cryto.net/validatem/match-validation-error.git", + "author": "Sven Slootweg ", + "license": "WTFPL OR CC0-1.0", + "devDependencies": { + "@validatem/error": "^1.0.0" + }, + "dependencies": { + "@validatem/match-versioned-special": "^0.1.0" + } +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..e6c1aed --- /dev/null +++ b/yarn.lock @@ -0,0 +1,20 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@validatem/error@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@validatem/error/-/error-1.0.0.tgz#a975904aa4c3e7618d89088a393567a5e1778340" + integrity sha512-7M3tV4DhCuimuCRdC2L/topBByDjhzspzeQGNU0S4/mdn2aDNtESYE43K/2Kh/utCAhqXh2gyw89WYxy//t3fQ== + dependencies: + create-error "^0.3.1" + +"@validatem/match-versioned-special@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@validatem/match-versioned-special/-/match-versioned-special-0.1.0.tgz#2eacc48debecdbbe7e3d02f0c0a665afaea9bedf" + integrity sha512-xoOTY0bdA2ELj+ntcDVJ8YyMEFIJpjZ4HNPL9lGcbnRFwJBhQcHUAhUpZwkMxu02zH9wkNM1FvYGHxPz40745Q== + +create-error@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/create-error/-/create-error-0.3.1.tgz#69810245a629e654432bf04377360003a5351a23" + integrity sha1-aYECRaYp5lRDK/BDdzYAA6U1GiM=