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

bal-util

Package Overview
Dependencies
Maintainers
1
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bal-util - npm Package Compare versions

Comparing version 1.13.11 to 1.13.12

8

History.md
## History
- v1.13.12 October 22, 2012
- `balUtilFlow` changes:
- `extend` is now an alias of `shallowExtendPlainObjects` as they were exactly the same
- `balUtilHTML` changes:
- `replaceElement` and `replaceElementAsync` changes:
- now accept arguments in object form as well
- accept a `removeIndentation` argument that defaults to `true`
- v1.13.11 October 22, 2012

@@ -4,0 +12,0 @@ - `balUtilPaths` changes:

16

out/lib/flow.js

@@ -51,15 +51,5 @@ // Generated by CoffeeScript 1.3.3

extend: function() {
var key, obj, objs, target, value, _i, _len;
target = arguments[0], objs = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
target || (target = {});
for (_i = 0, _len = objs.length; _i < _len; _i++) {
obj = objs[_i];
obj || (obj = {});
for (key in obj) {
if (!__hasProp.call(obj, key)) continue;
value = obj[key];
target[key] = value;
}
}
return target;
var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return this.shallowExtendPlainObjects.apply(this, args);
},

@@ -66,0 +56,0 @@ shallowExtendPlainObjects: function() {

// Generated by CoffeeScript 1.3.3
(function() {
var balUtilFlow, balUtilHTML;
var balUtilFlow, balUtilHTML,
__slice = [].slice;

@@ -31,13 +32,27 @@ balUtilFlow = (typeof require === "function" ? require(__dirname + '/flow') : void 0) || this.balUtilFlow;

},
replaceElement: function(source, elementNameMatcher, replaceElementCallback) {
var regex, result;
regex = new RegExp("<(" + elementNameMatcher + "(?:\\:[-:_a-z0-9]+)?)(\\s+[^>]+)?>([\\s\\S]+?)<\\/\\1>", 'ig');
result = source.replace(regex, function(outerHTML, elementNameMatched, attributes, innerHTML) {
innerHTML = balUtilHTML.removeIndentation(innerHTML);
return replaceElementCallback(outerHTML, elementNameMatched, attributes, innerHTML);
replaceElement: function() {
var args, element, html, regex, removeIndentation, replace, result, _ref;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
if (args.length === 1) {
_ref = args[0], html = _ref.html, element = _ref.element, removeIndentation = _ref.removeIndentation, replace = _ref.replace;
} else {
html = args[0], element = args[1], replace = args[2];
}
regex = new RegExp("<(" + element + "(?:\\:[-:_a-z0-9]+)?)(\\s+[^>]+)?>([\\s\\S]+?)<\\/\\1>", 'ig');
result = html.replace(regex, function(outerHTML, element, attributes, innerHTML) {
if (removeIndentation !== false) {
innerHTML = balUtilHTML.removeIndentation(innerHTML);
}
return replace(outerHTML, element, attributes, innerHTML);
});
return result;
},
replaceElementAsync: function(source, elementNameMatcher, replaceElementCallback, next) {
var result, tasks;
replaceElementAsync: function() {
var args, element, html, next, removeIndentation, replace, result, tasks, _ref;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
if (args.length === 1) {
_ref = args[0], html = _ref.html, element = _ref.element, removeIndentation = _ref.removeIndentation, replace = _ref.replace, next = _ref.next;
} else {
html = args[0], element = args[1], replace = args[2], next = args[3];
}
tasks = new balUtilFlow.Group(function(err) {

@@ -49,15 +64,20 @@ if (err) {

});
result = balUtilHTML.replaceElement(source, elementNameMatcher, function(outerHTML, elementNameMatched, attributes, innerHTML) {
var random;
random = Math.random();
tasks.push(function(complete) {
return replaceElementCallback(outerHTML, elementNameMatched, attributes, innerHTML, function(err, replaceElementResult) {
if (err) {
return complete(err);
}
result = result.replace(random, replaceElementResult);
return complete();
result = balUtilHTML.replaceElement({
html: html,
element: element,
removeIndentation: removeIndentation,
replace: function(outerHTML, element, attributes, innerHTML) {
var random;
random = Math.random();
tasks.push(function(complete) {
return replace(outerHTML, element, attributes, innerHTML, function(err, replaceElementResult) {
if (err) {
return complete(err);
}
result = result.replace(random, replaceElementResult);
return complete();
});
});
});
return random;
return random;
}
});

@@ -64,0 +84,0 @@ tasks.sync();

{
"name": "bal-util",
"version": "1.13.11",
"version": "1.13.12",
"description": "Common utility functions for Node.js used and maintained by Benjamin Lupton",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/balupton/bal-util",

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