Skip to content
/ yanus Public

A tiny tool for both plain list and object function param styles support

License

Notifications You must be signed in to change notification settings

gbezyuk/yanus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yanus

A tiny tool for both plain list and object function param styles support Build Status

How to use

// NodeJS
var yanus = require('yanus');

// in a nutshell
function prepare_agent_legend () {
  var defaults = {
    name: 'Bond',
    full_name: 'James Bond',
    code: '007',
    id: 7,
    is_agent: false,
    is_really_agent: true,
    motto: "The World is not enough"
  };

  var signature = ['name', 'full_name', 'code', 'id',
    'is_agent', 'is_really_agent', 'motto'];

  // here we go
  var params = yanus(defaults, signature, arguments);

  // now do some stuff on your own
}

// before sending James to Russia
prepare_agent_legend('Ivan', 'Ivan Ivanov');
prepare_agent_legend({name: 'Ivan', full_name: 'Ivan Ivanov'}); // same result

// be specific, they said
prepare_agent_legend({
  name: 'Ivan',
  full_name: 'Ivan Ivanov',
  motto: 'Too much vodka is never enough'
});

About

A tiny tool for both plain list and object function param styles support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published