node-ldapjs
node-ldapjs copied to clipboard
Strict mode problem
Hello there is a problem with this library when using strict mode.
(node:16368) UnhandledPromiseRejectionWarning: TypeError: Cannot set property value of [object Object] which has only a getter at PagedResultsControl.Control (ldapjs\lib\controls\control.js:29:13) at new PagedResultsControl (Cdapjs\lib\controls\paged_results_control.js:31:11)
I simulated what the library does here
Basically in strict mode you cannot set a property that does not have a setter if you use Object.defineProperty.
I can't provide an example usage because I don't use this library directly, but I use another library that has dependence on it, and I can't use my application if I enable strict mode
Would you be willing to send a PR to resolve this?
Edit: See PR #812 for a better solution.
Here is the diff that solved my problem:
diff --git a/node_modules/ldapjs/lib/controls/control.js b/node_modules/ldapjs/lib/controls/control.js
index 188a8bd..ac0b67f 100644
--- a/node_modules/ldapjs/lib/controls/control.js
+++ b/node_modules/ldapjs/lib/controls/control.js
@@ -23,7 +23,7 @@ function Control (options) {
this.type = options.type || ''
this.criticality = options.critical || options.criticality || false
- this.value = options.value || null
+ // this.value = options.value || null
}
Object.defineProperties(Control.prototype, {
json: {
👋
On February 22, 2023, we released version 3 of this library. As a result, we are closing this issue/pull request.
Please see issue #839 for more information, including how to proceed if you feel this closure is in error.