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

delims

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

delims - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

lib/utils.js

2

bower.json
{
"name": "delims",
"version": "0.1.0",
"version": "0.1.1",
"main": [

@@ -5,0 +5,0 @@ "index.js"

@@ -13,37 +13,8 @@ /*

var _ = require('lodash');
var utils = require('./lib/utils');
var arrayify = function(arr) {
return !Array.isArray(arr) ? [arr] : _.compact(arr);
};
// Escape custom template delimiters
var escapeDelim = function (re) {
return re.replace(/(.)/g, '\\$1');
};
// Build RegExp patterns for delimiters
var buildRegexGroup = function (re, options) {
var opts = _.extend({
escape: false, // Escape delimiter regex
noncapture: false // Build a non-capture group
}, options);
re = arrayify(re);
var len = re.length;
re = (len > 0) ? re.join('|') : re;
re = (opts.escape === true) ? escapeDelim(re) : re;
if(opts.noncapture === true || len > 1) {
re = '(?:' + re + ')';
}
return re;
};
// Generate RegExp patterns dynamically. By default, patterns use
// [\s\S] instead to avoid the need for multiline and dotall flags.
module.exports = function (delims, options) {
var delims = module.exports = function (delims, options) {
if(!_.isArray(delims)) {options = delims; delims = ['---', '---'];}

@@ -62,4 +33,4 @@

// Generate regex ections
var open = buildRegexGroup(delims[0], opts);
var close = buildRegexGroup(delims[1], opts);
var open = utils.buildRegexGroup(delims[0], opts);
var close = utils.buildRegexGroup(delims[1], opts);
var block = opts.matter + close + opts.body + opts.end;

@@ -73,2 +44,6 @@

};
};
};
delims.arrayify = utils.arrayify;
delims.escapeDelim = utils.escapeDelim;
delims.buildRegexGroup = utils.buildRegexGroup;
{
"name": "delims",
"description": "Generate RegExp for delimiters, to be used with templates, files or data streams.",
"version": "0.1.0",
"version": "0.1.1",
"homepage": "https://github.com/jonschlinkert/delims",

@@ -6,0 +6,0 @@ "author": {

@@ -135,2 +135,4 @@ # delims [![NPM version](https://badge.fury.io/js/delims.png)](http://badge.fury.io/js/delims)

***
### Lo-Dash Templates

@@ -141,3 +143,5 @@

***
## Author

@@ -144,0 +148,0 @@

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