Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ldap-filters

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ldap-filters - npm Package Compare versions

Comparing version 0.1.6 to 1.0.1

beautify.js

26

lib/filter.js

@@ -30,4 +30,10 @@ var soundex = require('soundex');

},
toString: function() {
return [ '(', this.attrib, this.comp, this.value, ')' ].join('');
toString: function(indent,level) {
if (indent === true) indent = Filter.indent;
else if (parseInt(indent) < 1) indent = 0;
level = level || 0;
return [
' '.repeat(level*indent),
'(', this.attrib, this.comp, this.value, ')'
].join('');
}

@@ -39,2 +45,5 @@ };

/* Default indent for beautify */
Filter.indent = 4;
/* Escape a string value */

@@ -139,4 +148,13 @@ Filter.escape = function(value){

},
toString: function(){
return '(' + this.comp + this.filters.join('') + ')';
toString: function(indent,level){
if (indent === true) indent = Filter.indent;
else if (parseInt(indent) < 1) indent = 0;
var nl = indent ? '\n': '';
level = level || 0;
return ' '.repeat(level*indent) +
'(' + this.comp + nl +
this.filters.map(function(item){
return item.toString(indent,level+1)
}).join(nl) + nl + ' '.repeat(level*indent) +
')';
}

@@ -143,0 +161,0 @@ };

2

package.json
{
"name": "ldap-filters",
"version": "0.1.6",
"version": "1.0.1",
"description": "Library for generating, parsing, and evaluating LDAP filters",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -70,2 +70,31 @@ node-ldap-filters

### Output/print
Whether you've created a filter programatically or by parsing a filter, you
can output with `toString()` method or by concatenating with a string, like so:
query.toString()
query + ''
If you pass a value of `true` or a numeric value to `toString()`, the
output will be beautified:
query.toString(true)
query.toString(2)
Will result in the following output:
```
(&
(givenName=jenny)
(sn=jensen)
(|
(c=us)
(st=ontario)
)
)
```
A value of `true` will use `Filter.indent` property, which defaults to 4.
### Evaluate data against a filter

@@ -72,0 +101,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc