Comparing version 1.7.0 to 1.7.1
# Changelog | ||
## v1.7.1 | ||
- Same update for [v2.0.1](https://github.com/jet2jet/resedit-js/releases/tag/v2.0.1): | ||
- Add nullish check for some fields | ||
- Add demo page link to README | ||
- Same update for [v2.0.2](https://github.com/jet2jet/resedit-js/releases/tag/v2.0.2): | ||
- Update pe-library | ||
## v1.7.0 | ||
@@ -4,0 +12,0 @@ |
@@ -37,4 +37,4 @@ import IconItem from '../data/IconItem.js'; | ||
var idCurrent = 1; | ||
for (var i = 0; i < filteredIDs.length; ++i) { | ||
var id = filteredIDs[i]; | ||
for (var _i = 0, filteredIDs_1 = filteredIDs; _i < filteredIDs_1.length; _i++) { | ||
var id = filteredIDs_1[_i]; | ||
if (idCurrent < id) { | ||
@@ -197,3 +197,3 @@ return { | ||
var e = destEntries[i]; | ||
if (e.type === 3) { | ||
if (e != null && e.type === 3) { | ||
// RT_ICON | ||
@@ -200,0 +200,0 @@ if (!isIconUsed(e, destEntries, entry)) { |
@@ -95,6 +95,6 @@ import StringTableItem from './StringTableItem.js'; | ||
var e = dest[i]; | ||
if (e.type === 6 && e.lang === this.lang) { | ||
if (e != null && e.type === 6 && e.lang === this.lang) { | ||
for (var j = dest.length - 1; j >= i; --j) { | ||
var e2 = dest[j]; | ||
if (e2.type === 6 && e2.lang === this.lang) { | ||
if (e2 != null && e2.type === 6 && e2.lang === this.lang) { | ||
dest.splice(j, 1); | ||
@@ -111,3 +111,3 @@ } | ||
var e = dest[i]; | ||
if (e.type === 6 && e.lang < this.lang) { | ||
if (e != null && e.type === 6 && e.lang < this.lang) { | ||
var f = dest.splice.bind(dest, i + 1, 0); | ||
@@ -121,3 +121,3 @@ f.apply(void 0, entries); | ||
var e = dest[i]; | ||
if (e.type === 6) { | ||
if (e != null && e.type === 6) { | ||
var f = dest.splice.bind(dest, i + 1, 0); | ||
@@ -124,0 +124,0 @@ f.apply(void 0, entries); |
@@ -29,3 +29,4 @@ // StringTable entry: | ||
StringTableItem.prototype.get = function (index) { | ||
return this._a[index] || null; | ||
var value = this._a[index]; | ||
return value != null && value !== '' ? value : null; | ||
}; | ||
@@ -41,4 +42,7 @@ StringTableItem.prototype.getAll = function () { | ||
for (var i = 0; i < 16; ++i) { | ||
var item = this._a[i]; | ||
len += 2; | ||
len += 2 * this._a[i].length; // UTF-16 length | ||
if (item != null) { | ||
len += 2 * item.length; // UTF-16 length | ||
} | ||
} | ||
@@ -53,9 +57,11 @@ // 16 alignment | ||
var s = this._a[i]; | ||
var l = s.length > 4097 ? 4097 : s.length; | ||
var l = s == null ? 0 : s.length > 4097 ? 4097 : s.length; | ||
out.setUint16(len, l, true); | ||
len += 2; | ||
for (var j = 0; j < l; ++j) { | ||
// output as UTF-16 | ||
out.setUint16(len, s.charCodeAt(j), true); | ||
len += 2; | ||
if (s != null) { | ||
for (var j = 0; j < l; ++j) { | ||
// output as UTF-16 | ||
out.setUint16(len, s.charCodeAt(j), true); | ||
len += 2; | ||
} | ||
} | ||
@@ -62,0 +68,0 @@ } |
@@ -104,3 +104,6 @@ import { allocatePartialBinary, cloneObject, copyBuffer, readUint32WithLastOffset, roundUp, } from '../util/functions.js'; | ||
for (var key in table.values) { | ||
a[0].values[key] = table.values[key]; | ||
var value = table.values[key]; | ||
if (value != null) { | ||
a[0].values[key] = value; | ||
} | ||
} | ||
@@ -244,2 +247,5 @@ } | ||
var value = table.values[key]; | ||
if (value == null) { | ||
return prev; | ||
} | ||
var childHeaderSize = roundUp(6 + 2 * (key.length + 1), 4); | ||
@@ -268,2 +274,5 @@ var newSize = roundUp(prev + childHeaderSize + 2 * (value.length + 1), 4); | ||
var value = table.values[key]; | ||
if (value == null) { | ||
return; | ||
} | ||
var childHeaderSize = roundUp(6 + 2 * (key.length + 1), 4); | ||
@@ -437,5 +446,9 @@ var newSize = roundUp(childHeaderSize + 2 * (value.length + 1), 4); | ||
// (if unspecified, use default value set by `createFixedInfo`) | ||
for (var fixedInfoKey in fixedInfo) { | ||
for (var _fixedInfoKey in fixedInfo) { | ||
var fixedInfoKey = _fixedInfoKey; | ||
if (fixedInfoKey in fixedInfo) { | ||
vi.data.fixedInfo[fixedInfoKey] = fixedInfo[fixedInfoKey]; | ||
var value = fixedInfo[fixedInfoKey]; | ||
if (value != null) { | ||
vi.data.fixedInfo[fixedInfoKey] = value; | ||
} | ||
} | ||
@@ -549,3 +562,6 @@ } | ||
for (var key in values) { | ||
table.values[key] = values[key]; | ||
var value = values[key]; | ||
if (value != null) { | ||
table.values[key] = value; | ||
} | ||
} | ||
@@ -590,3 +606,5 @@ if (addToAvailableLanguage) { | ||
var e = strings[i]; | ||
if (e.lang === language.lang && e.codepage === language.codepage) { | ||
if (e != null && | ||
e.lang === language.lang && | ||
e.codepage === language.codepage) { | ||
strings.splice(i, 1); | ||
@@ -597,3 +615,4 @@ if (removeFromAvailableLanguage) { | ||
var t = translations[j]; | ||
if (t.lang === language.lang && | ||
if (t != null && | ||
t.lang === language.lang && | ||
t.codepage === language.codepage) { | ||
@@ -622,3 +641,5 @@ translations.splice(j, 1); | ||
var e = strings[i]; | ||
if (e.lang === language.lang && e.codepage === language.codepage) { | ||
if (e != null && | ||
e.lang === language.lang && | ||
e.codepage === language.codepage) { | ||
try { | ||
@@ -636,3 +657,4 @@ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete | ||
var t = translations[j]; | ||
if (t.lang === language.lang && | ||
if (t != null && | ||
t.lang === language.lang && | ||
t.codepage === language.codepage) { | ||
@@ -673,3 +695,6 @@ translations.splice(j, 1); | ||
var e = entries[i]; | ||
if (e.type === 16 && e.id === res.id && e.lang === res.lang) { | ||
if (e != null && | ||
e.type === 16 && | ||
e.id === res.id && | ||
e.lang === res.lang) { | ||
entries[i] = res; | ||
@@ -690,3 +715,3 @@ return; | ||
var a = this.data.strings | ||
.filter(function (e) { return propName in e.values; }) | ||
.filter(function (e) { return propName in e.values && e.values[propName] != null; }) | ||
.map(function (e) { return e.lang; }); | ||
@@ -693,0 +718,0 @@ if (a.length === 1) { |
@@ -14,11 +14,15 @@ import { RawDERObject } from './data/DERObject.js'; | ||
var actualLength = 0; | ||
if (data[offset] < 0x80) { | ||
actualLength = data[offset]; | ||
var value = data[offset]; | ||
if (value == null) { | ||
throw new Error('Invalid "offset" value'); | ||
} | ||
else if (value < 0x80) { | ||
actualLength = value; | ||
++offset; | ||
} | ||
else if (data[offset] === 0x80) { | ||
else if (value === 0x80) { | ||
throw new Error('Not supported certificate data (variable length)'); | ||
} | ||
else { | ||
var c = data[offset] & 0x7f; | ||
var c = value & 0x7f; | ||
++offset; | ||
@@ -25,0 +29,0 @@ while (c--) { |
@@ -14,2 +14,5 @@ import { makeDERLength } from './derUtil.js'; | ||
var r = []; | ||
if (id.length < 2) { | ||
throw new Error("Unexpected 'value' field"); | ||
} | ||
// first byte will be (x * 40 + y) for 'x.y.****' | ||
@@ -16,0 +19,0 @@ r.push(id[0] * 40 + id[1]); |
@@ -42,3 +42,4 @@ import { allocatePartialBinary } from '../util/functions.js'; | ||
} | ||
switch (ub[offset + 2]) { | ||
var status = ub[offset + 2]; | ||
switch (status) { | ||
case 0: // granted | ||
@@ -51,3 +52,3 @@ case 1: // grantedWithMods | ||
case 5: /* revocationNotification */ { | ||
var msg = "Timestamp response has error status " + ub[offset + 2]; | ||
var msg = "Timestamp response has error status " + status; | ||
// PKIStatusInfo.statusString | ||
@@ -85,3 +86,3 @@ if (offset + 3 < timeStampTokenOffset && ub[offset + 3] === 0x30) { | ||
default: | ||
throw new Error("Unexpected PKIStatusInfo.status: " + ub[offset + 2]); | ||
throw new Error("Unexpected PKIStatusInfo.status: " + (status !== null && status !== void 0 ? status : '(unknown)')); | ||
} | ||
@@ -88,0 +89,0 @@ // TimeStampToken ::= ContentInfo |
@@ -1,2 +0,2 @@ | ||
declare const _default: "1.7.0"; | ||
declare const _default: "1.7.1"; | ||
export default _default; |
@@ -1,1 +0,1 @@ | ||
export default '1.7.0'; | ||
export default '1.7.1'; |
@@ -39,4 +39,4 @@ "use strict"; | ||
var idCurrent = 1; | ||
for (var i = 0; i < filteredIDs.length; ++i) { | ||
var id = filteredIDs[i]; | ||
for (var _i = 0, filteredIDs_1 = filteredIDs; _i < filteredIDs_1.length; _i++) { | ||
var id = filteredIDs_1[_i]; | ||
if (idCurrent < id) { | ||
@@ -199,3 +199,3 @@ return { | ||
var e = destEntries[i]; | ||
if (e.type === 3) { | ||
if (e != null && e.type === 3) { | ||
// RT_ICON | ||
@@ -202,0 +202,0 @@ if (!isIconUsed(e, destEntries, entry)) { |
@@ -97,6 +97,6 @@ "use strict"; | ||
var e = dest[i]; | ||
if (e.type === 6 && e.lang === this.lang) { | ||
if (e != null && e.type === 6 && e.lang === this.lang) { | ||
for (var j = dest.length - 1; j >= i; --j) { | ||
var e2 = dest[j]; | ||
if (e2.type === 6 && e2.lang === this.lang) { | ||
if (e2 != null && e2.type === 6 && e2.lang === this.lang) { | ||
dest.splice(j, 1); | ||
@@ -113,3 +113,3 @@ } | ||
var e = dest[i]; | ||
if (e.type === 6 && e.lang < this.lang) { | ||
if (e != null && e.type === 6 && e.lang < this.lang) { | ||
var f = dest.splice.bind(dest, i + 1, 0); | ||
@@ -123,3 +123,3 @@ f.apply(void 0, entries); | ||
var e = dest[i]; | ||
if (e.type === 6) { | ||
if (e != null && e.type === 6) { | ||
var f = dest.splice.bind(dest, i + 1, 0); | ||
@@ -126,0 +126,0 @@ f.apply(void 0, entries); |
@@ -31,3 +31,4 @@ "use strict"; | ||
StringTableItem.prototype.get = function (index) { | ||
return this._a[index] || null; | ||
var value = this._a[index]; | ||
return value != null && value !== '' ? value : null; | ||
}; | ||
@@ -43,4 +44,7 @@ StringTableItem.prototype.getAll = function () { | ||
for (var i = 0; i < 16; ++i) { | ||
var item = this._a[i]; | ||
len += 2; | ||
len += 2 * this._a[i].length; // UTF-16 length | ||
if (item != null) { | ||
len += 2 * item.length; // UTF-16 length | ||
} | ||
} | ||
@@ -55,9 +59,11 @@ // 16 alignment | ||
var s = this._a[i]; | ||
var l = s.length > 4097 ? 4097 : s.length; | ||
var l = s == null ? 0 : s.length > 4097 ? 4097 : s.length; | ||
out.setUint16(len, l, true); | ||
len += 2; | ||
for (var j = 0; j < l; ++j) { | ||
// output as UTF-16 | ||
out.setUint16(len, s.charCodeAt(j), true); | ||
len += 2; | ||
if (s != null) { | ||
for (var j = 0; j < l; ++j) { | ||
// output as UTF-16 | ||
out.setUint16(len, s.charCodeAt(j), true); | ||
len += 2; | ||
} | ||
} | ||
@@ -64,0 +70,0 @@ } |
@@ -106,3 +106,6 @@ "use strict"; | ||
for (var key in table.values) { | ||
a[0].values[key] = table.values[key]; | ||
var value = table.values[key]; | ||
if (value != null) { | ||
a[0].values[key] = value; | ||
} | ||
} | ||
@@ -246,2 +249,5 @@ } | ||
var value = table.values[key]; | ||
if (value == null) { | ||
return prev; | ||
} | ||
var childHeaderSize = functions_js_1.roundUp(6 + 2 * (key.length + 1), 4); | ||
@@ -270,2 +276,5 @@ var newSize = functions_js_1.roundUp(prev + childHeaderSize + 2 * (value.length + 1), 4); | ||
var value = table.values[key]; | ||
if (value == null) { | ||
return; | ||
} | ||
var childHeaderSize = functions_js_1.roundUp(6 + 2 * (key.length + 1), 4); | ||
@@ -439,5 +448,9 @@ var newSize = functions_js_1.roundUp(childHeaderSize + 2 * (value.length + 1), 4); | ||
// (if unspecified, use default value set by `createFixedInfo`) | ||
for (var fixedInfoKey in fixedInfo) { | ||
for (var _fixedInfoKey in fixedInfo) { | ||
var fixedInfoKey = _fixedInfoKey; | ||
if (fixedInfoKey in fixedInfo) { | ||
vi.data.fixedInfo[fixedInfoKey] = fixedInfo[fixedInfoKey]; | ||
var value = fixedInfo[fixedInfoKey]; | ||
if (value != null) { | ||
vi.data.fixedInfo[fixedInfoKey] = value; | ||
} | ||
} | ||
@@ -551,3 +564,6 @@ } | ||
for (var key in values) { | ||
table.values[key] = values[key]; | ||
var value = values[key]; | ||
if (value != null) { | ||
table.values[key] = value; | ||
} | ||
} | ||
@@ -592,3 +608,5 @@ if (addToAvailableLanguage) { | ||
var e = strings[i]; | ||
if (e.lang === language.lang && e.codepage === language.codepage) { | ||
if (e != null && | ||
e.lang === language.lang && | ||
e.codepage === language.codepage) { | ||
strings.splice(i, 1); | ||
@@ -599,3 +617,4 @@ if (removeFromAvailableLanguage) { | ||
var t = translations[j]; | ||
if (t.lang === language.lang && | ||
if (t != null && | ||
t.lang === language.lang && | ||
t.codepage === language.codepage) { | ||
@@ -624,3 +643,5 @@ translations.splice(j, 1); | ||
var e = strings[i]; | ||
if (e.lang === language.lang && e.codepage === language.codepage) { | ||
if (e != null && | ||
e.lang === language.lang && | ||
e.codepage === language.codepage) { | ||
try { | ||
@@ -638,3 +659,4 @@ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete | ||
var t = translations[j]; | ||
if (t.lang === language.lang && | ||
if (t != null && | ||
t.lang === language.lang && | ||
t.codepage === language.codepage) { | ||
@@ -675,3 +697,6 @@ translations.splice(j, 1); | ||
var e = entries[i]; | ||
if (e.type === 16 && e.id === res.id && e.lang === res.lang) { | ||
if (e != null && | ||
e.type === 16 && | ||
e.id === res.id && | ||
e.lang === res.lang) { | ||
entries[i] = res; | ||
@@ -692,3 +717,3 @@ return; | ||
var a = this.data.strings | ||
.filter(function (e) { return propName in e.values; }) | ||
.filter(function (e) { return propName in e.values && e.values[propName] != null; }) | ||
.map(function (e) { return e.lang; }); | ||
@@ -695,0 +720,0 @@ if (a.length === 1) { |
@@ -18,11 +18,15 @@ "use strict"; | ||
var actualLength = 0; | ||
if (data[offset] < 0x80) { | ||
actualLength = data[offset]; | ||
var value = data[offset]; | ||
if (value == null) { | ||
throw new Error('Invalid "offset" value'); | ||
} | ||
else if (value < 0x80) { | ||
actualLength = value; | ||
++offset; | ||
} | ||
else if (data[offset] === 0x80) { | ||
else if (value === 0x80) { | ||
throw new Error('Not supported certificate data (variable length)'); | ||
} | ||
else { | ||
var c = data[offset] & 0x7f; | ||
var c = value & 0x7f; | ||
++offset; | ||
@@ -29,0 +33,0 @@ while (c--) { |
@@ -16,2 +16,5 @@ "use strict"; | ||
var r = []; | ||
if (id.length < 2) { | ||
throw new Error("Unexpected 'value' field"); | ||
} | ||
// first byte will be (x * 40 + y) for 'x.y.****' | ||
@@ -18,0 +21,0 @@ r.push(id[0] * 40 + id[1]); |
@@ -46,3 +46,4 @@ "use strict"; | ||
} | ||
switch (ub[offset + 2]) { | ||
var status = ub[offset + 2]; | ||
switch (status) { | ||
case 0: // granted | ||
@@ -55,3 +56,3 @@ case 1: // grantedWithMods | ||
case 5: /* revocationNotification */ { | ||
var msg = "Timestamp response has error status " + ub[offset + 2]; | ||
var msg = "Timestamp response has error status " + status; | ||
// PKIStatusInfo.statusString | ||
@@ -89,3 +90,3 @@ if (offset + 3 < timeStampTokenOffset && ub[offset + 3] === 0x30) { | ||
default: | ||
throw new Error("Unexpected PKIStatusInfo.status: " + ub[offset + 2]); | ||
throw new Error("Unexpected PKIStatusInfo.status: " + (status !== null && status !== void 0 ? status : '(unknown)')); | ||
} | ||
@@ -92,0 +93,0 @@ // TimeStampToken ::= ContentInfo |
@@ -1,2 +0,2 @@ | ||
declare const _default: "1.7.0"; | ||
declare const _default: "1.7.1"; | ||
export default _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = '1.7.0'; | ||
exports.default = '1.7.1'; |
{ | ||
"name": "resedit", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"engines": { | ||
@@ -40,2 +40,6 @@ "node": ">=12", | ||
}, | ||
"funding": { | ||
"type": "github", | ||
"url": "https://github.com/sponsors/jet2jet" | ||
}, | ||
"scripts": { | ||
@@ -56,6 +60,7 @@ "build": "npm run build:cjs && npm run build:esm", | ||
"test:win-x64": "jest --config ./jest.config.win-x64.js", | ||
"version": "node ./tools/updateVersion.js ./src/main/version.ts && git add -A ./src/main/version.ts" | ||
"version": "node ./tools/updateVersion.js ./src/main/version.ts && git add -A ./src/main/version.ts", | ||
"typecheck": "tsc --project tsconfig.json --noEmit && echo \"Done\"." | ||
}, | ||
"dependencies": { | ||
"pe-library": "^0.4.0" | ||
"pe-library": "^0.4.1" | ||
}, | ||
@@ -62,0 +67,0 @@ "devDependencies": { |
[![NPM version](https://badge.fury.io/js/resedit.svg)](https://www.npmjs.com/package/resedit) | ||
[![Build Status](https://api.travis-ci.com/jet2jet/resedit-js.svg?branch=master)](https://www.travis-ci.com/jet2jet/resedit-js) | ||
[![Build Status](https://github.com/jet2jet/resedit-js/actions/workflows/main-ci.yml/badge.svg)](https://github.com/jet2jet/resedit-js) | ||
@@ -12,2 +12,4 @@ # resedit-js | ||
The demo page: [resedit demo](https://www.pg-fl.jp/program/resedit/index.en.htm) | ||
- [Install](#install) | ||
@@ -14,0 +16,0 @@ - [Supported formats](#supported-formats) |
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
354424
7970
128
Updatedpe-library@^0.4.1