Comparing version 6.4.0 to 6.4.1
@@ -307,6 +307,7 @@ "use strict"; | ||
const s = String(sym); | ||
const key = s.substring('Symbol('.length, s.length - 1); | ||
if (s.startsWith('Symbol(Symbol.')) { | ||
// check to see if it's a key on the Symbol global. | ||
// return Symbol.iterator, not Symbol(Symbol.iterator) | ||
const symKey = s.substring('Symbol(Symbol.'.length, s.length - 1); | ||
const symKey = key.substring('Symbol.'.length, s.length - 1); | ||
if (symKey && | ||
@@ -317,3 +318,3 @@ Symbol[symKey] === sym) { | ||
} | ||
return keyFor ? 'Symbol.for' + s.substring('Symbol'.length) : s; | ||
return this.style.symbol(keyFor ? 'Symbol.for' : 'Symbol', key); | ||
} | ||
@@ -643,4 +644,13 @@ printSymbol() { | ||
getPojoKeys(obj = this.object) { | ||
const keys = []; | ||
// always include known non-enumerable properties of Error objects | ||
if (obj instanceof Error) { | ||
const known = ['errors', 'cause']; | ||
for (const prop of known) { | ||
const desc = Object.getOwnPropertyDescriptor(obj, prop); | ||
if (desc && !desc.enumerable) | ||
keys.push(prop); | ||
} | ||
} | ||
if (this.options.includeEnumerable) { | ||
const keys = []; | ||
// optimized fast path, for/in over enumerable string keys only | ||
@@ -656,3 +666,3 @@ for (const i in obj) { | ||
} | ||
const keys = this.#getPojoKeys(obj).concat(this.#getPojoKeys(obj, true)); | ||
keys.push(...this.#getPojoKeys(obj).concat(this.#getPojoKeys(obj, true))); | ||
if (!this.options.includeGetters) { | ||
@@ -659,0 +669,0 @@ return keys; |
@@ -104,2 +104,4 @@ /// <reference types="node" /> | ||
stringTail: (indent: string) => string; | ||
/** printing symbols */ | ||
symbol: (method: string, key: string) => string; | ||
/** indicator as to whether this style is suitable for use in diffs */ | ||
@@ -106,0 +108,0 @@ diffable: boolean; |
@@ -105,2 +105,3 @@ "use strict"; | ||
stringTail: indent => `\n${indent})`, | ||
symbol: (method, key) => `${method}(${key})`, | ||
diffable: true, | ||
@@ -164,2 +165,3 @@ start: (indent, key, sep) => `${indent}${key}${sep}`, | ||
stringTail: indent => `\n${indent})`, | ||
symbol: (method, key) => `${method}(${JSON.stringify(key)})`, | ||
diffable: true, | ||
@@ -212,2 +214,3 @@ start: (indent, key, sep) => `${indent}${key}${sep}`, | ||
stringTail: _ => '', | ||
symbol: (method, key) => `${method}(${JSON.stringify(key)})`, | ||
bufferHead: js.bufferHead, | ||
@@ -214,0 +217,0 @@ bufferKey: js.bufferKey, |
@@ -304,6 +304,7 @@ import { styles } from './styles.js'; | ||
const s = String(sym); | ||
const key = s.substring('Symbol('.length, s.length - 1); | ||
if (s.startsWith('Symbol(Symbol.')) { | ||
// check to see if it's a key on the Symbol global. | ||
// return Symbol.iterator, not Symbol(Symbol.iterator) | ||
const symKey = s.substring('Symbol(Symbol.'.length, s.length - 1); | ||
const symKey = key.substring('Symbol.'.length, s.length - 1); | ||
if (symKey && | ||
@@ -314,3 +315,3 @@ Symbol[symKey] === sym) { | ||
} | ||
return keyFor ? 'Symbol.for' + s.substring('Symbol'.length) : s; | ||
return this.style.symbol(keyFor ? 'Symbol.for' : 'Symbol', key); | ||
} | ||
@@ -640,4 +641,13 @@ printSymbol() { | ||
getPojoKeys(obj = this.object) { | ||
const keys = []; | ||
// always include known non-enumerable properties of Error objects | ||
if (obj instanceof Error) { | ||
const known = ['errors', 'cause']; | ||
for (const prop of known) { | ||
const desc = Object.getOwnPropertyDescriptor(obj, prop); | ||
if (desc && !desc.enumerable) | ||
keys.push(prop); | ||
} | ||
} | ||
if (this.options.includeEnumerable) { | ||
const keys = []; | ||
// optimized fast path, for/in over enumerable string keys only | ||
@@ -653,3 +663,3 @@ for (const i in obj) { | ||
} | ||
const keys = this.#getPojoKeys(obj).concat(this.#getPojoKeys(obj, true)); | ||
keys.push(...this.#getPojoKeys(obj).concat(this.#getPojoKeys(obj, true))); | ||
if (!this.options.includeGetters) { | ||
@@ -656,0 +666,0 @@ return keys; |
@@ -104,2 +104,4 @@ /// <reference types="node" resolution-mode="require"/> | ||
stringTail: (indent: string) => string; | ||
/** printing symbols */ | ||
symbol: (method: string, key: string) => string; | ||
/** indicator as to whether this style is suitable for use in diffs */ | ||
@@ -106,0 +108,0 @@ diffable: boolean; |
@@ -99,2 +99,3 @@ import reactElementToJsxString from './react-element-to-jsx-string.js'; | ||
stringTail: indent => `\n${indent})`, | ||
symbol: (method, key) => `${method}(${key})`, | ||
diffable: true, | ||
@@ -158,2 +159,3 @@ start: (indent, key, sep) => `${indent}${key}${sep}`, | ||
stringTail: indent => `\n${indent})`, | ||
symbol: (method, key) => `${method}(${JSON.stringify(key)})`, | ||
diffable: true, | ||
@@ -206,2 +208,3 @@ start: (indent, key, sep) => `${indent}${key}${sep}`, | ||
stringTail: _ => '', | ||
symbol: (method, key) => `${method}(${JSON.stringify(key)})`, | ||
bufferHead: js.bufferHead, | ||
@@ -208,0 +211,0 @@ bufferKey: js.bufferKey, |
{ | ||
"name": "tcompare", | ||
"version": "6.4.0", | ||
"version": "6.4.1", | ||
"description": "A comprehensive comparison library, for use in test frameworks", | ||
@@ -5,0 +5,0 @@ "tshy": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
483698
5066