New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

br-hobbies

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

br-hobbies

Hobbies business rules

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
11
Maintainers
1
Weekly downloads
 
Created
Source

hobbies

Business rules for hobbies.

  • employee
    • name -> first name + last name is required
    • email is required
  • hobbies
    • each employee must give at least 2 hobbies, maximum hobbies is 4
    • each hobby can have optional information about
      • How often do you participate in this hobby
      • Is a paid hobby
      • Would recommend this hobby to a friend
    • your firm has foreign employees - form must support czech, english and german languages

Basic usage


var Hobbies = require('br-hobbies');

//create test data
    var data = {
        Person:{
            FirstName: 'John',
            LastName: 'Smith',
            Email: "joht.smith@gmail.com"
        },
        Hobbies:[
            {HobbyName:"English", Frequency:Hobbies.HobbyFrequency.Weekly , Paid:true,Recommendation:true},
            {HobbyName:"Swimming", Frequency:Hobbies.HobbyFrequency.Monthly , Paid:false,Recommendation:true}
        ]
    };

//business rules
var businessRules = new Hobbies.BusinessRules(data);

//execute validation
businessRules.Validate();

//verify and display results
if (businessRules.Errors.HasErrors) console.log(businessRules.Errors.ErrorMessage);

Tests

Output of all business rules that are under tests.

 business rules for hobbies
     hobbies
       first name + last name
         √ fill no names 
         √ fill empty names 
         √ fill long names 
         √ fill some names 
       items
         √ fill no item 
         √ fill two items 
         √ fill five items 

Keywords

business

FAQs

Package last updated on 29 Aug 2014

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