Skip to content

Instantly share code, notes, and snippets.

@iamnoah
Created September 14, 2013 04:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamnoah/6558903 to your computer and use it in GitHub Desktop.
Save iamnoah/6558903 to your computer and use it in GitHub Desktop.
Convert steal.dev.warn calls to console.warns
/**
* Shaper for cleaning up steal 3.2 declarations. Multiple calls are collapsed into a single
* wrapped call and non-dependant arguments are sorted.
*/
if (typeof define !== 'function') { var define = require('amdefine')(module); }
define(['../shaper', '../fmt', '../ref', '../tkn'], function(Shaper, Fmt, Ref, tkn) {
"use strict"; "use restrict";
new Shaper("steal-warn", function(root) {
return Shaper.traverse(root, {
pre: function(node, ref) {
var replacement;
if (Shaper.match("steal.dev.warn($$)", node)) {
var list = node.children[1];
list.srcs[0] = "";
list.srcs[list.srcs.length - 1] = "";
ref.set(Shaper.replace("window.console && console.warn && console.warn($)", list));
return "break";
}
}
});
});
return Shaper.get("steal-warn");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment