Skip to content

Instantly share code, notes, and snippets.

@ladydangerdame
Last active July 31, 2017 04:39
Show Gist options
  • Save ladydangerdame/0729b44f9403f2a07b5bca45fab09f7f to your computer and use it in GitHub Desktop.
Save ladydangerdame/0729b44f9403f2a07b5bca45fab09f7f to your computer and use it in GitHub Desktop.
Sodo test

Hey Eric! So this is by no means done. However, I am already too thankful for your patience.

Here's what I have been playing with so far in terms of approaches to this problem. (Looks not like much but I threw out a slew of other janky methods.)

var obj = {
  "backlog": [],
  "build": [{
    "label": "circleci",
    "actions": {
      "show": "hello from [build, circleci, show]",
      "run": "hello from [build, circleci, run]"
    }
  }],
  "project": [{
      "label": "server",
      "actions": {
        "compile": "hello from [project, server, compile]",
        "lint": "hello from [project, server, lint]",
        "test": "hello from [project, server, test]",
        "run": "hello from [project, server, run]"
      }
    },
    {
      "label": "client",
      "actions": {
        "compile": "hello from [project, client, compile]",
        "lint": "hello from [project, client, lint]",
        "test": "hello from [project, client, test]"
      }
    },
    {
      "label": "all",
      "actions": {
        "compile": "hello from [project, all, compile]",
        "lint": "hello from [project, all, lint]",
        "test": "hello from [project, all, test]"
      }
    }
  ],
  "coverage": [{
      "label": "coveralls",
      "actions": {
        "show": "hello from [coverage, server, show]"
      }
    },
    {
      "label": "local",
      "actions": {
        "show": "hello from [coverage, client, show]"
      }
    }
  ]
}

var msg = obj.build[0].actions.show;

function sodo(object) {
  for (var key in obj) {
    if (obj.hasOwnProperty(key)) {
        console.log(msg);
      }
    }
  }

  sodo(obj);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment