katex 0.18.1 → 0.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/katex.mjs CHANGED
@@ -248,15 +248,16 @@ function getImplicitDefault(type) {
248
248
  }
249
249
  }
250
250
  function getDefaultValue(schema) {
251
- if (schema.default !== undefined) {
251
+ if (Object.prototype.hasOwnProperty.call(schema, "default") && schema.default !== undefined) {
252
252
  return schema.default;
253
253
  }
254
254
  var type = Array.isArray(schema.type) ? schema.type[0] : schema.type;
255
255
  return getImplicitDefault(type);
256
256
  }
257
257
  function applySetting(target, prop, options, schema) {
258
- var optionValue = options[prop];
259
- target[prop] = optionValue !== undefined ? schema.processor ? schema.processor(optionValue) : optionValue : getDefaultValue(schema);
258
+ var optionValue = Object.prototype.hasOwnProperty.call(options, prop) ? options[prop] : undefined;
259
+ var processor = Object.prototype.hasOwnProperty.call(schema, "processor") ? schema.processor : undefined;
260
+ target[prop] = optionValue !== undefined ? processor ? processor(optionValue) : optionValue : getDefaultValue(schema);
260
261
  }
261
262
  /**
262
263
  * The main Settings object
@@ -13336,8 +13337,10 @@ class Namespace {
13336
13337
  get(name) {
13337
13338
  if (Object.prototype.hasOwnProperty.call(this.current, name)) {
13338
13339
  return this.current[name];
13339
- } else {
13340
+ } else if (Object.prototype.hasOwnProperty.call(this.builtins, name)) {
13340
13341
  return this.builtins[name];
13342
+ } else {
13343
+ return undefined;
13341
13344
  }
13342
13345
  }
13343
13346
  /**
@@ -13368,7 +13371,7 @@ class Namespace {
13368
13371
  // value is the correct one.
13369
13372
  var top = this.undefStack[this.undefStack.length - 1];
13370
13373
  if (top && !Object.prototype.hasOwnProperty.call(top, name)) {
13371
- top[name] = this.current[name];
13374
+ top[name] = Object.prototype.hasOwnProperty.call(this.current, name) ? this.current[name] : undefined;
13372
13375
  }
13373
13376
  }
13374
13377
  if (value == null) {
@@ -16262,7 +16265,7 @@ var renderToHTMLTree = function renderToHTMLTree(expression, options) {
16262
16265
  return renderError(error, expression, settings);
16263
16266
  }
16264
16267
  };
16265
- var version = "0.18.1";
16268
+ var version = "0.18.2";
16266
16269
  var __domTree = {
16267
16270
  Span,
16268
16271
  Anchor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "katex",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
4
4
  "description": "Fast math typesetting for the web.",
5
5
  "main": "dist/katex.js",
6
6
  "types": "types/katex.d.ts",
package/src/Namespace.ts CHANGED
@@ -81,8 +81,10 @@ export default class Namespace<Value> {
81
81
  get(name: string): Value | undefined {
82
82
  if (Object.prototype.hasOwnProperty.call(this.current, name)) {
83
83
  return this.current[name];
84
- } else {
84
+ } else if (Object.prototype.hasOwnProperty.call(this.builtins, name)) {
85
85
  return this.builtins[name];
86
+ } else {
87
+ return undefined;
86
88
  }
87
89
  }
88
90
 
@@ -111,7 +113,8 @@ export default class Namespace<Value> {
111
113
  // value is the correct one.
112
114
  const top = this.undefStack[this.undefStack.length - 1];
113
115
  if (top && !Object.prototype.hasOwnProperty.call(top, name)) {
114
- top[name] = this.current[name];
116
+ top[name] = Object.prototype.hasOwnProperty.call(
117
+ this.current, name) ? this.current[name] : undefined;
115
118
  }
116
119
  }
117
120
  if (value == null) {
package/src/Settings.ts CHANGED
@@ -326,7 +326,8 @@ function getDefaultValue<K extends keyof SettingsOptions>(
326
326
  schema: SchemaEntry<K>,
327
327
  ): Settings[K];
328
328
  function getDefaultValue(schema: SchemaEntry<keyof SettingsOptions>): DefaultValue {
329
- if (schema.default !== undefined) {
329
+ if (Object.prototype.hasOwnProperty.call(schema, "default") &&
330
+ schema.default !== undefined) {
330
331
  return schema.default;
331
332
  }
332
333
  const type = Array.isArray(schema.type) ? schema.type[0] : schema.type;
@@ -339,10 +340,13 @@ function applySetting<K extends keyof SettingsOptions>(
339
340
  options: SettingsOptions,
340
341
  schema: SchemaEntry<K>,
341
342
  ) {
342
- const optionValue = options[prop];
343
+ const optionValue = Object.prototype.hasOwnProperty.call(options, prop)
344
+ ? options[prop] : undefined;
345
+ const processor = Object.prototype.hasOwnProperty.call(schema, "processor")
346
+ ? schema.processor : undefined;
343
347
  target[prop] = optionValue !== undefined
344
- ? (schema.processor
345
- ? schema.processor(optionValue)
348
+ ? (processor
349
+ ? processor(optionValue)
346
350
  : optionValue)
347
351
  : getDefaultValue(schema);
348
352
  }