Skip to content

Commit

Permalink
Replace _.isArray with Array.isArray
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Feb 22, 2021
1 parent 702a7a7 commit bb3c7c7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions lib/svg-sprite/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function SVGSpriterConfig(config) {
['padding'].forEach(function (property) {
var spacing;

if (!_.isArray(this.spacing[property])) {
if (!Array.isArray(this.spacing[property])) {
spacing = Math.max(0, parseInt(this.spacing[property] || 0, 10));
this.spacing[property] = { top: spacing, right: spacing, bottom: spacing, left: spacing };
} else {
Expand All @@ -222,7 +222,7 @@ function SVGSpriterConfig(config) {
}, this.shape);

// Prepare shape transforms
if (('transform' in this.shape) && _.isArray(this.shape.transform)) {
if (('transform' in this.shape) && Array.isArray(this.shape.transform)) {
transforms = this.shape.transform;
}

Expand All @@ -231,7 +231,7 @@ function SVGSpriterConfig(config) {
if ('transform' in config) {
this.log.warn('The top-level `transform` option is deprecated and will be removed in a future version. Please use `shape.transform` instead.');

if ((transforms === null) && _.isArray(config.transform)) {
if ((transforms === null) && Array.isArray(config.transform)) {
transforms = config.transform;
}
}
Expand All @@ -242,7 +242,7 @@ function SVGSpriterConfig(config) {
}

this.shape.transform = [];
if (_.isArray(transforms)) {
if (Array.isArray(transforms)) {
transformers: for (t = 0; t < transforms.length; ++t) {
if (_.isString(transforms[t])) {
transforms[t] = JSON.parse('{"' + transforms[t] + '":true}');
Expand Down Expand Up @@ -278,7 +278,7 @@ function SVGSpriterConfig(config) {
if ('transform' in this.svg) {
if (_.isFunction(this.svg.transform)) {
transforms.push(this.svg.transform);
} else if (_.isArray(this.svg.transform)) {
} else if (Array.isArray(this.svg.transform)) {
for (t = 0; t < this.svg.transform.length; ++t) {
if (_.isFunction(this.svg.transform[t])) {
transforms.push(this.svg.transform[t]);
Expand Down
6 changes: 3 additions & 3 deletions lib/svg-sprite/shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ SVGShape.prototype.getViewbox = function(width, height) {
* @return {Array} Viewbox
*/
SVGShape.prototype.setViewbox = function(x, y, width, height) {
if (_.isArray(x)) {
if (Array.isArray(x)) {
this.viewBox = x.map(function(n) { return parseFloat(n); });
while (this.viewBox.length < 4) {
this.viewBox.push(0);
Expand Down Expand Up @@ -787,7 +787,7 @@ SVGShape.prototype._replaceIdAndClassnameReferencesInCssSelectors = function(str
css += str.substr(rule.__starts, rule.__ends);

// Else: Recursively process rule content
} else if (_.isArray(rule.cssRules)) {
} else if (Array.isArray(rule.cssRules)) {
css += str.substring(rule.__starts, rule.cssRules[0].__starts) + this._replaceIdAndClassnameReferencesInCssSelectors(str, rule.cssRules, substIds, substClassnames) + str.substring(rule.cssRules[rule.cssRules.length - 1].__ends, rule.__ends);
}

Expand All @@ -809,7 +809,7 @@ SVGShape.prototype._replaceIdAndClassnameReferencesInCssSelectors = function(str
}

// If class name substitution should be applied: Search for class names
if (('classNames' in sel.rule) && (substClassnames !== null) && _.isArray(sel.rule.classNames)) {
if (('classNames' in sel.rule) && (substClassnames !== null) && Array.isArray(sel.rule.classNames)) {
sel.rule.classNames.forEach(classnameFilter);
}
};
Expand Down
2 changes: 1 addition & 1 deletion lib/svg-sprite/sprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ SVGSprite.prototype.XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
* @return {SVGSprite} Self reference
*/
SVGSprite.prototype.add = function(content) {
if (_.isArray(content)) {
if (Array.isArray(content)) {
this.content.push.apply(this.content, content);
} else {
this.content.push(content);
Expand Down

0 comments on commit bb3c7c7

Please sign in to comment.