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

gotu

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gotu - npm Package Compare versions

Comparing version 1.0.17 to 1.0.18

14

package.json
{
"name": "gotu",
"version": "1.0.17",
"version": "1.0.18",
"description": "Domain entities javascript library.",

@@ -37,13 +37,13 @@ "main": "./src/gotu.js",

"dependencies": {
"suma": "^1.0.7"
"suma": "^1.0.8"
},
"devDependencies": {
"eslint": "^7.12.1",
"eslint-config-prettier": "^6.15.0",
"eslint": "^7.25.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.1.4",
"mocha": "^8.2.0",
"eslint-plugin-prettier": "^3.4.0",
"mocha": "^8.3.2",
"nyc": "^15.1.0",
"prettier": "^2.1.2"
"prettier": "^2.2.1"
}
}

@@ -20,3 +20,3 @@ <p align="center"><img src="https://raw.githubusercontent.com/herbsjs/gotu/master/docs/logo.png" height="220"></p>

const Feature =
const Feature =
entity('Feature', {

@@ -27,3 +27,3 @@ name: field(String),

const Plan =
const Plan =
entity('Plan', {

@@ -34,3 +34,3 @@ name: field(String),

const User =
const User =
entity('User', {

@@ -47,3 +47,3 @@ name: field(String),

user.plan.monthlyCost = 10
user.features = [
user.features = [
new Feature(),

@@ -64,3 +64,3 @@ new Feature(),

const Plan =
const Plan =
entity('Plan', {

@@ -71,3 +71,3 @@ ...

const User =
const User =
entity('User', {

@@ -81,3 +81,3 @@ name: field(String),

user.plan.monthlyCost = true
user.validate()
user.validate()
user.errors // { name: [ wrongType: 'String' ], plan: { monthlyCost: [ wrongType: 'Number' ] } }

@@ -96,8 +96,11 @@ user.isValid() // false

```javascript
const User =
const User =
entity('User', {
...
password: field(String, validation: {
presence: true,
password: field(String, validation: {
presence: true,
length: { minimum: 6 }
}),
cardNumber: field(String, validation: {
custom: { invalidCardNumber: (value) => value.length === 16 }
})

@@ -108,4 +111,5 @@ })

user.password = '1234'
user.validate()
user.errors // { password: [ { isTooShort: 6 } ] }
user.cardNumber = '1234456'
user.validate()
user.errors // [{ password: [ { isTooShort: 6 } ] , { "invalidCardNumber": true }]
user.isValid // false

@@ -121,3 +125,3 @@ ```

```javascript
const User =
const User =
entity('User', {

@@ -162,3 +166,3 @@ name: field(String)

```javascript
const User =
const User =
entity('User', {

@@ -177,3 +181,3 @@ name: field(String),

```javascript
const Plan =
const Plan =
entity('Plan', {

@@ -184,3 +188,3 @@ ...

const User =
const User =
entity('User', {

@@ -197,3 +201,3 @@ ...

```javascript
const Plan =
const Plan =
entity('Plan', {

@@ -204,3 +208,3 @@ ...

const User =
const User =
entity('User', {

@@ -217,3 +221,3 @@ ...

```javascript
const User =
const User =
entity('User', {

@@ -232,3 +236,3 @@ ...

```javascript
const User =
const User =
entity('User', {

@@ -257,3 +261,3 @@ ...

```javascript
const User =
const User =
entity('User', {

@@ -273,3 +277,3 @@ ...

```javascript
const User =
const User =
entity('User', {

@@ -295,3 +299,3 @@ ...

const instance2 = new AnSecondEntity()
AnEntity.isParentOf(instance1) // true

@@ -309,3 +313,3 @@ AnEntity.isParentOf(instance2) // false

const instance1 = new AnEntity()
entity.isEntity(AnEntity) // true

@@ -312,0 +316,0 @@ entity.isEntity(Object) // false

@@ -19,2 +19,3 @@ const { entity } = require('../../src/entity')

[
{ type: String, value: "1234", validation: { custom: { invalidCardNumber: (value) => value.length === 16 } }, errors: { field1: [{ invalidCardNumber: true }] } },
{ type: Number, value: 1, validation: { numericality: { greaterThan: 10 } }, errors: { field1: [{ notGreaterThan: 10 }] } },

@@ -47,2 +48,2 @@ { type: String, value: '', validation: { presence: true }, errors: { field1: [{ cantBeEmpty: true }] } },

})
})
})
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