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

freeman-check

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

freeman-check

Easy type and format checking on JavaScript objects

  • 2.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
decreased by-71.79%
Maintainers
1
Weekly downloads
 
Created
Source

freeman-check

Simple type and format checking of JavaScript objects. This is a very popular utility at Freeman Industries.

Installation

npm install freeman-check --save

Usage

var Check = require('freeman-check')

var object = {
	name: "Nabil Freeman",
	favourite_films: [
		"Face/Off",
		"Bad Lieutenant",
		"The Wicker Man"
	]
}

var schema = {
	type: "object",
	properties: {
		name: {
			type: "string"
		}
		email: {
			type: "string",
			format: "email"
		},
		favourite_films: {
			type: "array",
			items: {
				type: "string"
			}
		}
	},
	required: ["name", "email", "favourite_films"]
};

Check.test(some_object, schema).then(function(object){
	console.log(object) //object === some_object
}).catch(function(error){
	console.log(error.message) // "`email` is missing." // "`email` is malformatted." // etc...
	console.log(error.schema) //error.schema === schema
})

FAQs

Package last updated on 08 May 2017

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