Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ssylvia committed May 8, 2024
1 parent 615dd09 commit e62a1ff
Show file tree
Hide file tree
Showing 5 changed files with 1,077 additions and 570 deletions.
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"author": "Esri",
"license": "Apache-2.0",
"scripts": {
"build": "rimraf dist && rollup -c && yarn run build:dts",
"build": "rimraf dist && rollup -c --bundleConfigAsCjs && yarn run build:dts",
"build:dts": "tsc -p tsconfig-decl.json --outDir dist/esm && tsc -p tsconfig-decl.json --outDir dist/node",
"lint": "tslint --project tsconfig.json",
"lint:fix": "tslint --project tsconfig.json --fix",
Expand Down Expand Up @@ -51,20 +51,20 @@
"xss": "1.0.13"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-replace": "^4.0.0",
"@rollup/plugin-typescript": "^8.3.4",
"@types/jest": "^28.1.7",
"jest": "^28.1.3",
"rimraf": "^3.0.2",
"rollup": "^2.78.1",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-typescript": "^11.1.6",
"@types/jest": "^29.5.12",
"jest": "^29.7.0",
"rimraf": "^5.0.5",
"rollup": "^4.17.2",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^28.0.8",
"ts-jest": "^29.1.2",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"tslint-config-standard": "^9.0.0",
"typescript": "^4.7.4"
"typescript": "^5.4.5"
},
"publishConfig": {
"access": "public"
Expand Down
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export class Sanitizer {
// Extend the defaults
xssFilterOptions = Object.create(this.arcgisFilterOptions);
xssFilterOptions.css = { whiteList: this.arcgisCSSWhiteList };
Object.keys(filterOptions).forEach((key) => {
(Object.keys(filterOptions) as Array<keyof XSS.IFilterXSSOptions>).forEach(<T extends keyof XSS.IFilterXSSOptions>(key: T) => {
if (key === "whiteList") {
// Extend the whitelist by concatenating arrays
xssFilterOptions.whiteList = this._extendObjectOfArrays([
Expand Down Expand Up @@ -362,7 +362,7 @@ export class Sanitizer {
*/
public encodeHTML(value: string): string {
return String(value).replace(/[&<>"'\/]/g, (s) => {
return this._entityMap[s];
return this._entityMap[s as keyof typeof this._entityMap];
});
}

Expand Down Expand Up @@ -395,10 +395,10 @@ export class Sanitizer {
* @memberof Sanitizer
*/
private _extendObjectOfArrays(objects: {}[]): {} {
const finalObj = {};
const finalObj: Record<string, any> = {};

objects.forEach((obj) => {
Object.keys(obj).forEach((key) => {
(Object.keys(obj) as Array<keyof typeof obj>).forEach(<T extends keyof typeof obj>(key: T) => {
if (Array.isArray(obj[key]) && Array.isArray(finalObj[key])) {
finalObj[key] = finalObj[key].concat(obj[key]);
} else {
Expand Down Expand Up @@ -441,8 +441,8 @@ export class Sanitizer {
}
return null;
} else {
const keys = Object.keys(obj);
changedObj = keys.reduce((prev, key) => {
const keys = Object.keys(obj) as Array<keyof typeof obj>;
changedObj = keys.reduce(<T extends keyof typeof obj>(prev: Record<keyof typeof obj, unknown>, key: T) => {
const value = obj[key];
const validation = this.validate(value, options);
if (validation.isValid) {
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"noUnusedLocals": true,
"strict": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"target": "es5",
"types": ["jest", "xss"]
},
Expand Down
3 changes: 2 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"ordered-imports": true,
"only-arrow-functions": [false],
"object-literal-sort-keys": false,
"interface-name": [true, "always-prefix"]
"interface-name": [true, "always-prefix"],
"no-shadowed-variable": false
}
}
Loading

0 comments on commit e62a1ff

Please sign in to comment.