Skip to content

Commit

Permalink
fix(deps): remove lodash (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
tripodsan authored Nov 13, 2020
1 parent 0fc2cad commit c9e07d4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"antlr4": "^4.7.2",
"fs-extra": "^9.0.0",
"he": "^1.2.0",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"node-esapi": "0.0.1",
"numeral": "^2.0.6",
Expand Down
9 changes: 4 additions & 5 deletions src/runtime/xss_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

'use strict';

const _ = require('lodash');
const sanitizer = require('sanitizer');
const esapiEncoder = require('node-esapi').encoder();
const XRegExp = require('xregexp');
Expand Down Expand Up @@ -282,11 +281,11 @@ module.exports = {
* @returns {String}
*/
getValidJSToken(input, defaultValue) {
if (!_.isString(input)) {
if (typeof input !== 'string') {
return defaultValue;
}
const encoded = escapeJSToken(input);
if (_.isUndefined(encoded)) {
if (encoded === undefined) {
return defaultValue;
}
return encoded;
Expand All @@ -298,7 +297,7 @@ module.exports = {
* @returns {String} a sanitized URL (possibly empty)
*/
getValidHref(url) {
if (!_.isString(url)) {
if (typeof url !== 'string') {
return '';
}
return sanitizeURL(url.trim());
Expand All @@ -312,7 +311,7 @@ module.exports = {
* @return {String} a string containing sanitized style token
*/
getValidStyleToken(input, defaultValue) {
if (_.isString(input) && input.length > 0 && CSS_TOKEN.test(input)) {
if (typeof input === 'string' && input.length > 0 && CSS_TOKEN.test(input)) {
return input;
}
return defaultValue;
Expand Down

0 comments on commit c9e07d4

Please sign in to comment.