@ldapjs/messages
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -287,5 +287,6 @@ 'use strict' | ||
/** | ||
* The current search scope value. | ||
* The current search scope value. Can be matched against the exported | ||
* scope statics. | ||
* | ||
* @returns {string} | ||
* @returns {number} | ||
* | ||
@@ -295,10 +296,3 @@ * @throws When the scope is set to an unrecognized scope constant. | ||
get scope () { | ||
switch (this.#scope) { | ||
case search.SCOPE_BASE_OBJECT: | ||
return 'base' | ||
case search.SCOPE_ONE_LEVEL: | ||
return 'single' | ||
case search.SCOPE_SUBTREE: | ||
return 'subtree' | ||
} | ||
return this.#scope | ||
} | ||
@@ -324,2 +318,20 @@ | ||
/** | ||
* The current search scope value as a string name. | ||
* | ||
* @returns {string} One of 'base', 'single', or 'subtree'. | ||
* | ||
* @throws When the scope is set to an unrecognized scope constant. | ||
*/ | ||
get scopeName () { | ||
switch (this.#scope) { | ||
case search.SCOPE_BASE_OBJECT: | ||
return 'base' | ||
case search.SCOPE_ONE_LEVEL: | ||
return 'single' | ||
case search.SCOPE_SUBTREE: | ||
return 'subtree' | ||
} | ||
} | ||
/** | ||
* The number of entries to limit search results to. | ||
@@ -430,3 +442,3 @@ * | ||
obj.baseObject = this.baseObject.toString() | ||
obj.scope = this.scope | ||
obj.scope = this.scopeName | ||
obj.derefAliases = this.derefAliases | ||
@@ -433,0 +445,0 @@ obj.sizeLimit = this.sizeLimit |
@@ -189,15 +189,20 @@ 'use strict' | ||
const req = new SearchRequest() | ||
t.equal(req.scope, 'base') | ||
t.equal(req.scopeName, 'base') | ||
t.equal(req.scope, 0) | ||
req.scope = SearchRequest.SCOPE_SINGLE | ||
t.equal(req.scope, 'single') | ||
t.equal(req.scopeName, 'single') | ||
t.equal(req.scope, 1) | ||
req.scope = SearchRequest.SCOPE_SUBTREE | ||
t.equal(req.scope, 'subtree') | ||
t.equal(req.scopeName, 'subtree') | ||
t.equal(req.scope, 2) | ||
req.scope = 'SUB' | ||
t.equal(req.scope, 'subtree') | ||
t.equal(req.scopeName, 'subtree') | ||
t.equal(req.scope, 2) | ||
req.scope = 'base' | ||
t.equal(req.scope, 'base') | ||
t.equal(req.scopeName, 'base') | ||
t.equal(req.scope, 0) | ||
}) | ||
@@ -204,0 +209,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "API for creating and parsing LDAP messages", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "repository": { |
234157
7728