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.9 to 0.2.10

4

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

@@ -29,4 +29,4 @@ "scripts": {

"dependencies": {
"@epistemology-factory/crocks-ext": "0.0.14"
"@epistemology-factory/crocks-ext": "0.0.17"
}
}

@@ -25,5 +25,13 @@ "use strict";

// aForbiddenResponse :: Object -> Matcher
const aForbiddenResponse = (headers) =>
aResponse(403, headers, { message: "Forbidden" })
// anInternalServerError :: (Object, String, a) -> Matcher
const anInternalServerError = partial(anErrorResponse, 500)
// anUnauthorisedResponse :: Obejct -> Matcher
const anUnauthorisedResponse = (headers) =>
aResponse(401, headers, { message: "Unauthorised" })
// anUnsupportedMediaType :: (Object, String) -> Matcher

@@ -39,5 +47,7 @@ const anUnsupportedMediaType = (headers, contentType) => anErrorResponse(

aBadRequest,
aForbiddenResponse,
anInternalServerError,
anUnauthorisedResponse,
anUnsupportedMediaType,
aResponse
}

@@ -71,3 +71,3 @@ "use strict";

// getHeader :: a -> String -> b -> c
// getHeaderOr :: a -> String -> b -> c
const getHeaderOr = curry((value, header) =>

@@ -74,0 +74,0 @@ compose(option(value), getHeader(header))

@@ -53,6 +53,14 @@ "use strict";

// validateBody :: Schema -> Object -> Result Object
const validateBody = (schema) =>
pipe(
isSchemaValid(schema, [ "body" ]),
bimap(validationError, identity)
)
module.exports = {
parseBody,
parseJSON,
validateBody,
validateRequest
}

@@ -61,5 +61,11 @@ "use strict";

// forbidden :: Object -> Object
const forbidden = (headers) => response(403, headers, { message: "Forbidden" })
// internalServerError :: Object -> String -> a -> Object
const internalServerError = errorResponse(500);
// unauthorised :: Object -> Object
const unauthorised = (headers) => response(401, headers, { message: "Unauthorised" })
// unsupportedMediaType :: Object -> String -> Object

@@ -72,6 +78,8 @@ const unsupportedMediaType = curry((headers, contentType) =>

badRequest,
forbidden,
internalServerError,
respondWith,
response,
unauthorised,
unsupportedMediaType
}
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