v-regexp
Version:
JavaScript Regular Expression Parser and Visualizer.
88 lines (86 loc) • 2.39 kB
TypeScript
declare namespace _default {
export { sortUnique };
export { idUnique };
export { hashUnique };
export { Set };
export { repeats };
export { negate };
export { coalesce };
export { classify };
export { parseCharset };
export { chr };
export { ord };
export { pred };
export { succ };
export { toPrint };
export { flatten2 };
export { isBrowser };
export { locals };
}
export default _default;
/**
Return sorted Set.
This function will corrupt the original array
Proper usage: a=sortUnique(a);
a
new unique sorted array
*/
declare function sortUnique(a: any): any;
/**
Object id unique.
This function will corrupt the original array.
Correct usage: a=idUnique(a);
NonPrimitive Array
*/
declare function idUnique(a: any): any;
/**
Unique by toString.
This function will corrupt the original array but preserve the original order.
*/
declare function hashUnique(a: any): any;
/**
Build sorted Set from array.
This function will corrupt the original array
Proper usage:a=Set(a);
*/
declare function Set(a: any, _sorted: any): any;
declare function repeats(s: any, n: any): string;
/**
Convert exclude ranges to include ranges
Example: ^b-y, ['by'] to ["\0a","z\uffff"]
@return Sorted disjoint ranges
*/
declare function negate(ranges: any): any[];
/**
Coalesce closed ranges.
['ac','d','ez'] will be coalesced to ['az']
ranges Sorted disjoint ranges return by `classify`.
Compressed ranges
*/
declare function coalesce(ranges: any): any;
/**
Classify charsets to non-overlapping sorted disjoint ranges.
Example: classify(['az','09','a','bb']) => {
ranges:['a','b','cz','09'],
map:{'az':['a','b','cz'],'09':['09'],'a':['a'],'b':['b']}
}
*/
declare function classify(ranges: any): {
ranges: string[];
map: any;
};
/**
Parse simple regex style charset string like '^a-bcdf' to disjoint ranges.
Character classes like "\w\s" are not supported!
charset Valid regex charset [^a-z0-9_] input as "^a-z0-9_".
return sorted disjoint ranges
*/
declare function parseCharset(charset: any): any[];
declare function chr(n: any): string;
declare function ord(c: any): any;
declare function pred(c: any): string;
declare function succ(c: any): string;
declare function toPrint(s: any, isRaw: any): any;
declare function flatten2(a: any): any;
declare const isBrowser: boolean;
declare function locals(f: any): string;