New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

alamid-schema

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alamid-schema - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

0

lib/determineType.js

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

2

package.json
{
"name": "alamid-schema",
"version": "0.1.1",
"version": "0.1.2",
"description": "Extendable mongoose-like schemas for node.js and the browser",

@@ -5,0 +5,0 @@ "main": "lib/Schema.js",

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

if(value(model).notTypeOf(Object)) {
throw new TypeError("Model must be an object");
}
if (this.keys.length === 0) {

@@ -115,0 +119,0 @@ setTimeout(function () {

@@ -0,0 +0,0 @@ "use strict";

@@ -5,1 +5,45 @@ ## alamid-schema

[![Dependency Status](https://david-dm.org/peerigon/alamid-schema/status.png)](https://david-dm.org/peerigon/alamid-schema)
```javascript
var Schema = require("alamid-schema");
var Panda = new Schema("Panda", {
name: "poly",
age: {
type: Number,
required: true
},
mood: {
type: String,
enum: ["grumpy", "happy"]
},
birthday: Date
});
```
## Plugins
### Validation
__Example__
```javascript
var panda = {
name: "peeri",
age: 3,
mood: "happy",
birthday: Date.now()
};
Panda.validate(panda, function(validation) {
if(validation.result) {
//happy panda
}
else {
//sad panda
}
});
```

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -170,2 +170,13 @@ "use strict";

it("should throw an error if model is not an object", function() {
var schema = new Schema({});
expect(function() { schema.validate(null, function() {}); }).to.throw(TypeError);
expect(function() { schema.validate(undefined, function() {}); }).to.throw(TypeError);
expect(function() { schema.validate("", function() {}); }).to.throw(TypeError);
expect(function() { schema.validate(12, function() {}); }).to.throw(TypeError);
expect(function() { schema.validate({}, function() {}); }).to.not.throw(TypeError);
});
it("should reference the given model to the validation result", function (done) {

@@ -249,3 +260,3 @@ var model = {};

it("should fail if a async and sync validator fail", function (done) {
it("should fail if an async and sync validator fail", function (done) {
var asyncSpy = chai.spy(validateAgeAsync),

@@ -252,0 +263,0 @@ syncSpy = chai.spy(validateAgeSync);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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