Socket
Socket
Sign inDemoInstall

@epistemology-factory/crocks-web

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@epistemology-factory/crocks-web - npm Package Compare versions

Comparing version 0.2.6 to 0.2.7

2

package.json
{
"name": "@epistemology-factory/crocks-web",
"version": "0.2.6",
"version": "0.2.7",
"description": "Functions to help write web applications with crocks",

@@ -5,0 +5,0 @@ "scripts": {

@@ -5,2 +5,4 @@ "use strict";

IS_DEFINED: "is-defined",
IS_ISO_DATE: "is-iso-date",
IS_OBJECT: "is-object",
IS_STRING: "is-string",

@@ -11,2 +13,4 @@ }

[CONSTRAINTS.IS_DEFINED]: "should not be null or undefined",
[CONSTRAINTS.IS_ISO_DATE]: "should be an ISO date",
[CONSTRAINTS.IS_OBJECT]: "must be an object",
[CONSTRAINTS.IS_STRING]: "must be a string",

@@ -13,0 +17,0 @@ }

@@ -19,2 +19,6 @@ "use strict";

const { makeValidator } = require("./validator");
const { validationFailure } = require("../validation-failure");
const { CONSTRAINTS, DEFAULT_MESSAGES } = require("./constraints");
/**

@@ -27,2 +31,11 @@ * Schema :: {

// isObject :: [ String ] -> a -> Result ValidationFailure a
const isObject = makeValidator(
require("crocks/predicates/isObject"),
validationFailure(
CONSTRAINTS.IS_OBJECT,
DEFAULT_MESSAGES[CONSTRAINTS.IS_OBJECT]
)
)
/**

@@ -58,3 +71,4 @@ * Allows an object to validated against a schema

module.exports = {
isObject,
isSchemaValid
}
"use strict";
const curry = require("crocks/helpers/curry");
const { makeValidator } = require("./validator");

@@ -7,2 +9,14 @@ const { validationFailure } = require("../validation-failure");

// matchesRegex :: RegExp -> String -> Boolean
const matchesRegex = curry((regexp, str) => regexp.test(str))
// isISODate :: [ String ] -> a -> Result ValidationFailure a
const isISODate = makeValidator(
matchesRegex(/^\d{4}-\d{2}-\d{2}$/),
validationFailure(
CONSTRAINTS.IS_ISO_DATE,
DEFAULT_MESSAGES[CONSTRAINTS.IS_ISO_DATE]
)
);
// isString :: [ String ] -> a -> Result ValidationFailure a

@@ -18,3 +32,4 @@ const isString = makeValidator(

module.exports = {
isISODate,
isString
}
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