Skip to content

Instantly share code, notes, and snippets.

@erayarslan
Created November 10, 2016 07:52
Show Gist options
  • Save erayarslan/5f5efeee8a6f8353da1a0e5ddc12b56e to your computer and use it in GitHub Desktop.
Save erayarslan/5f5efeee8a6f8353da1a0e5ddc12b56e to your computer and use it in GitHub Desktop.
_if.js
(function (global) {
"use strict";
global._if = function () {
var args = arguments;
if (args.length == 3) {
(args[0] ? args[1] : args[2])();
} else if (args.length == 4) {
args[0] ? setTimeout(args[1], args[3]) : setTimeout(args[2], args[3]);
} else {
throw new Error("something wrong :/");
}
};
}(window));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment