Sha256: aed8ca3ba9a687c3f307cf6f5c99848d799065adc443e755b0532dba50207674
Contents?: true
Size: 927 Bytes
Versions: 6
Compression:
Stored size: 927 Bytes
Contents
'use strict'; var through = require('through2'); var falafel = require('falafel'); module.exports = apply; var regex = /process\s*\.\s*browser/; function apply() { var buffers = []; return through(function(chunk, enc, next) { buffers.push(chunk); next(); }, function(next) { var string = Buffer.concat(buffers).toString(); if (!string.match(regex)) { this.push(string); return next(); } var resp = falafel(string, { ecmaVersion: 6, allowReturnOutsideFunction: true }, function (node) { if ( node.type === 'MemberExpression' && node.object && node.property && node.object.name === 'process' && node.property.name === 'browser' && !(node.parent ? node.parent.operator === '=' && node.parent.left === node : true) ) { node.update('true'); } }); this.push(resp.toString()); next(); }); }
Version data entries
6 entries across 6 versions & 1 rubygems