Skip to content

Commit

Permalink
Merge pull request #514 from coasys/js-client-strict-mode-fixes
Browse files Browse the repository at this point in the history
Make PerspectiveProxy.getSubjectProxy() work in strict mode
  • Loading branch information
lucksus authored Aug 8, 2024
2 parents 8078a3a + 558c79a commit e2a4900
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/src/perspectives/PerspectiveProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,22 +455,22 @@ export class PerspectiveProxy {
// Collect all set functions of the object in a list
let setFunctions = Object.getOwnPropertyNames(obj).filter(key => (typeof obj[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection"))
// Add all set functions of the object's prototype to that list
setFunctions = setFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (typeof obj[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection")))
setFunctions = setFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection")))

// Collect all add functions of the object in a list
let addFunctions = Object.getOwnPropertyNames(obj).filter(key => (typeof obj[key] === "function") && key.startsWith("add"))
let addFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("add"))
// Add all add functions of the object's prototype to that list
addFunctions = addFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (typeof obj[key] === "function") && key.startsWith("add")))
addFunctions = addFunctions.concat(Object.keys(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("add")))

// Collect all remove functions of the object in a list
let removeFunctions = Object.getOwnPropertyNames(obj).filter(key => (typeof obj[key] === "function") && key.startsWith("remove"))
let removeFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("remove"))
// Add all remove functions of the object's prototype to that list
removeFunctions = removeFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (typeof obj[key] === "function") && key.startsWith("remove")))
removeFunctions = removeFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("remove")))

// Collect all add functions of the object in a list
let setCollectionFunctions = Object.getOwnPropertyNames(obj).filter(key => (typeof obj[key] === "function") && key.startsWith("setCollection"))
let setCollectionFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("setCollection"))
// Add all add functions of the object's prototype to that list
setCollectionFunctions = setCollectionFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (typeof obj[key] === "function") && key.startsWith("setCollection")))
setCollectionFunctions = setCollectionFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("setCollection")))

// Construct query to find all subject classes that have the given properties and collections
let query = `subject_class(Class, C)`
Expand Down

0 comments on commit e2a4900

Please sign in to comment.