0.1.5 • Published 7 years ago

eiffel v0.1.5

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

eiffel

Painless Contracts in Javascript

extending npm-version downloads build coverage climate dependencies qa-control

language: English also available in: Spanish

Instalation

> npm install eiffel

Add Contracts in Javascript without changing the function definitions. Like in Eiffel contracts are writing in native language (Javascript) with minimal function calls and can easily enabled and disabled.

Main features

  • Declare your function as you usualy do
  • Declare require and ensure clausules like Eiffel anywhere
  • Enable and disable when you want without changing the code
  • Enjoy

Examples

function intRandom(min, max){
    return Math.floor(Math.random()*(max-min+1)+min);
}

Eiffel.global('intRandom',{
    require:function(min, max){
        return !isNaN(min) && !isNaN(max) && min<=max;
    },
    ensure:function(result, min, max){
        return result.returned>=min && result.returned<=max;
    }
});

More: A non nonsense example in eiffel_demo.js (solving quadratic equations).

0.1.5

7 years ago

0.1.4

8 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago