Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-file-include

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-file-include - npm Package Compare versions

Comparing version 0.13.4 to 0.13.5

lib/replace-function.js

0

lib/indent.js

@@ -0,0 +0,0 @@ module.exports = function(src, index, dest) {

38

lib/index.js
'use strict';
var replaceConditional = require('./conditional');
var replaceVariable = require('./variable');
var replaceInclude = require('./include');
var replaceOperator = require('./replace-operator');
var replaceFunction = require('./replace-function');
var replaceVariable = require('./replace-variable');
var concat = require('concat-stream');

@@ -73,22 +73,26 @@ var setIndent = require('./indent');

text = stripCommentedIncludes(text, opts);
text = replaceConditional({
handler: conditionalHandler,
content: text
}, opts);
text = replaceInclude({
handler: includeHandler,
content: text
}, opts);
text = replaceOperator(text, {
prefix: opts.prefix,
suffix: opts.suffix,
name: 'if',
handler: conditionalHandler
});
text = replaceFunction(text, {
prefix: opts.prefix,
suffix: opts.suffix,
name: 'include',
handler: includeHandler
});
text = replaceVariable(text, data, opts);
function conditionalHandler(args, body) {
function conditionalHandler(inst) {
// jshint ignore: start
var condition = new Function('var context = this; with (context) { return ' + args + '; }').call(data);
var condition = new Function('var context = this; with (context) { return ' + inst.args + '; }').call(data);
// jshint ignore: end
return condition ? body : '';
return condition ? inst.body : '';
}
function includeHandler(args, before) {
var args = /[^)"\']*["\']([^"\']*)["\'](,\s*({[\s\S]*?})){0,1}\s*/.exec(args);
function includeHandler(inst) {
var args = /[^)"\']*["\']([^"\']*)["\'](,\s*({[\s\S]*?})){0,1}\s*/.exec(inst.args);

@@ -105,3 +109,3 @@ if(args) {

if (opts.indent) {
includeContent = setIndent(before, before.length, includeContent);
includeContent = setIndent(inst.before, inst.before.length, includeContent);
}

@@ -108,0 +112,0 @@

{
"name": "gulp-file-include",
"version": "0.13.4",
"version": "0.13.5",
"description": "a gulp plugin for file include",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -0,0 +0,0 @@ [![NPM version][npm-img]][npm-url]

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc