gulp-has
Optimize code paths using has API feature detection.
Installation
Install package with NPM and add it to your development dependencies:
npm install --save-dev gulp-has
Usage
var has = uglify = ; gulp;
When run against code written like this:
if ! Objectcreate = { var {}; return { if argumentslength > 1 throw Error 'Second argument not supported' ; if typeof prototype != 'object' throw TypeError 'Argument must be an object' ; Tempprototype = prototype; var result = ; Tempprototype = null; return result; }; } ; var o = Object;
The compress
task would transform it into something like this:
var o = Object;
has API
The has
API was introduced by has.js as a convention for doing feature detection; however you don't need to use has.js
to take advantage of gulp-has
.
// A small adapter for Modernizr{ return Modernizr id ;} if console; else console;