Comparing version 0.1.4 to 0.2.0
{ | ||
"name": "delims", | ||
"version": "0.1.4", | ||
"version": "0.2.0", | ||
"main": [ | ||
@@ -5,0 +5,0 @@ "index.js" |
15
index.js
@@ -8,13 +8,16 @@ /*! | ||
const _ = require('lodash'); | ||
const utils = require('./lib/utils'); | ||
'use strict'; | ||
var utils = require('./lib/utils'); | ||
var arrayify = require('arrayify-compact'); | ||
var extend = require('xtend'); | ||
// Generate RegExp patterns dynamically. By default, patterns use | ||
// [\s\S] instead to avoid the need for multiline and dotall flags. | ||
var delims = module.exports = function (delims, options) { | ||
if(!_.isArray(delims)) {options = delims; delims = ['---', '---'];} | ||
if(!Array.isArray(delims)) {options = delims; delims = ['---', '---'];} | ||
// Defaults | ||
var opts = _.defaults({}, options, { | ||
var opts = extend({}, { | ||
beginning: '^', // '^' Matches beginning of input. | ||
@@ -25,3 +28,3 @@ matter: '([\\s\\S]+?)', // The "content" between the delims | ||
flags: '' // g, m, i | ||
}); | ||
}, options); | ||
opts.body = delims[2] || opts.body || ''; | ||
@@ -42,4 +45,4 @@ | ||
delims.arrayify = utils.arrayify; | ||
delims.arrayify = arrayify; | ||
delims.escapeDelim = utils.escapeDelim; | ||
delims.buildRegexGroup = utils.buildRegexGroup; |
@@ -8,9 +8,9 @@ /*! | ||
const _ = require('lodash'); | ||
const utils = module.exports = {}; | ||
'use strict'; | ||
utils.arrayify = function(arr) { | ||
return !Array.isArray(arr) ? [arr] : _.compact(arr); | ||
}; | ||
var extend = require('xtend'); | ||
var arrayify = require('arrayify-compact'); | ||
var utils = module.exports = {}; | ||
// Escape custom template delimiters | ||
@@ -23,3 +23,3 @@ utils.escapeDelim = function (re) { | ||
utils.buildRegexGroup = function (re, options) { | ||
var opts = _.extend({ | ||
var opts = extend({ | ||
escape: false, // Escape delimiter regex | ||
@@ -29,3 +29,3 @@ noncapture: false // Build a non-capture group | ||
re = utils.arrayify(re); | ||
re = arrayify(re); | ||
var len = re.length; | ||
@@ -32,0 +32,0 @@ |
{ | ||
"name": "delims", | ||
"description": "Generate RegExp for delimiters, to be used with templates, files or data streams.", | ||
"version": "0.1.4", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/jonschlinkert/delims", | ||
@@ -32,3 +32,4 @@ "author": { | ||
"dependencies": { | ||
"lodash": "~2.4.1" | ||
"arrayify-compact": "^0.1.0", | ||
"xtend": "^3.0.0" | ||
}, | ||
@@ -35,0 +36,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13675
165
2
+ Addedarrayify-compact@^0.1.0
+ Addedxtend@^3.0.0
+ Addedarray-flatten@2.1.2(transitive)
+ Addedarrayify-compact@0.1.1(transitive)
+ Addedxtend@3.0.0(transitive)
- Removedlodash@~2.4.1
- Removedlodash@2.4.2(transitive)