Created
September 14, 2013 04:52
-
-
Save iamnoah/6558903 to your computer and use it in GitHub Desktop.
Convert steal.dev.warn calls to console.warns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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