scim2-filter
Advanced tools
Comparing version 0.1.2 to 0.2.0
@@ -36,1 +36,2 @@ import * as tester from "./tester"; | ||
export declare function parse(query: string): Filter; | ||
export declare function flatten(f: Filter): Filter; |
@@ -5,2 +5,3 @@ "use strict"; | ||
const tester = require("./tester"); | ||
const fl = require("./flatten"); | ||
exports.Tester = tester.Tester; | ||
@@ -21,2 +22,6 @@ function filter(filter) { | ||
exports.parse = parse; | ||
function flatten(f) { | ||
return fl.log(fl.valfilter(f)); | ||
} | ||
exports.flatten = flatten; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { Filter } from "./index"; | ||
import { Filter } from "."; | ||
declare type TokenType = "Number" | "Quoted" | "Blacket" | "Word" | "EOT"; | ||
@@ -3,0 +3,0 @@ export declare type Token = { |
@@ -1,2 +0,2 @@ | ||
import { Filter, Compare } from "./index"; | ||
import { Filter, Compare } from "."; | ||
declare type CompValue = Compare["compValue"]; | ||
@@ -3,0 +3,0 @@ export declare class Tester { |
@@ -76,6 +76,6 @@ "use strict"; | ||
sw(r, v) { | ||
return typeof v === "string" && r.toString().startsWith(v); | ||
return v !== null && r !== null && r.toString().startsWith(v.toString()); | ||
} | ||
ew(r, v) { | ||
return typeof v === "string" && r.toString().endsWith(v); | ||
return v !== null && r !== null && r.toString().endsWith(v.toString()); | ||
} | ||
@@ -82,0 +82,0 @@ // The entire operator value must be a substring of the attribute value for a match. |
{ | ||
"name": "scim2-filter", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "scim 2.0 filter parser", | ||
@@ -5,0 +5,0 @@ "main": "lib/src/index.js", |
@@ -1,3 +0,4 @@ | ||
import * as toknizer from "./parser" | ||
import * as tester from "./tester" | ||
import * as toknizer from "./parser"; | ||
import * as tester from "./tester"; | ||
import * as fl from "./flatten"; | ||
@@ -42,5 +43,5 @@ /** Filter is filter ast object. There is extends [Operation] */ | ||
export function filter(filter: Filter): (r:any) => boolean { | ||
export function filter(filter: Filter): (r: any) => boolean { | ||
const tester = new Tester(); | ||
return (r:any) => tester.test(r, filter); | ||
return (r: any) => tester.test(r, filter); | ||
} | ||
@@ -55,1 +56,4 @@ export function parse(query: string): Filter { | ||
} | ||
export function flatten(f: Filter): Filter { | ||
return fl.log(fl.valfilter(f)); | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Filter, Compare, NotFilter, Suffix, ValuePath } from "./index"; | ||
import { Filter, Compare, NotFilter, Suffix, ValuePath } from "."; | ||
@@ -3,0 +3,0 @@ type TokenType = "Number" | "Quoted" | "Blacket" | "Word" | "EOT"; |
@@ -1,2 +0,2 @@ | ||
import { Filter, Compare } from "./index"; | ||
import { Filter, Compare } from "."; | ||
@@ -6,3 +6,3 @@ type CompValue = Compare["compValue"]; | ||
export class Tester { | ||
constructor(){} | ||
constructor() {} | ||
static readonly UNDEF = Symbol("undefined"); | ||
@@ -83,6 +83,6 @@ test(r: any, f: Filter): boolean { | ||
sw(r: any, v: CompValue): boolean { | ||
return typeof v === "string" && r.toString().startsWith(v); | ||
return v !== null && r !== null && r.toString().startsWith(v.toString()); | ||
} | ||
ew(r: any, v: CompValue): boolean { | ||
return typeof v === "string" && r.toString().endsWith(v); | ||
return v !== null && r !== null && r.toString().endsWith(v.toString()); | ||
} | ||
@@ -89,0 +89,0 @@ // The entire operator value must be a substring of the attribute value for a match. |
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
45024
23
900