Skip to content

risseraka/switchy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Use:

var element1 = {
  "type": "onetype"
};
var element2 = {
  "type": "sometype",
  "subelement": {
    "subType": "subValue"
  }
};

var result1 = switchy(element1.type, {
  "onetype": "lalala",
  "sometype": function () {
    return (element2.subelement || {})["subType"];
  }
});
// "lalala"

var result2 = switchy(element2.type, {
  "onetype": "lalala",
  "sometype": function () {
    return (element2.subelement || {})["subType"];
  }
});
// "subValue"

Releases

No releases published

Packages

No packages published