@iyio/common
Advanced tools
Comparing version 0.7.0 to 0.7.2
@@ -36,2 +36,3 @@ import { getFileExt } from "./fs"; | ||
'js': 'text/javascript', | ||
'jsx': 'text/javascript', | ||
'json': 'application/json', | ||
@@ -68,3 +69,4 @@ 'jsonld': 'application/ld+json', | ||
'tiff': 'image/tiff', | ||
'ts': 'video/mp2t', | ||
'ts': 'application/typescript', | ||
'tsx': 'application/typescript', | ||
'ttf': 'font/ttf', | ||
@@ -71,0 +73,0 @@ 'txt': 'text/plain', |
@@ -20,2 +20,2 @@ /** | ||
export declare const starStringTest: (starString: string, value: string, flags?: string, startEndOfInput?: StarStringStartEndOfInput) => boolean; | ||
export declare const starStringTestCached: (cacheObj: Record<string, any>, starString: string, value: string, flags?: string, startEndOfInput?: StarStringStartEndOfInput) => boolean; | ||
export declare const starStringTestCached: (cacheObj: Record<string, any>, starString: string, value: string, flags?: string, startEndOfInput?: StarStringStartEndOfInput, treatAsNormalReg?: boolean) => boolean; |
@@ -47,5 +47,5 @@ /** | ||
}; | ||
export const starStringTestCached = (cacheObj, starString, value, flags, startEndOfInput = 'both') => { | ||
export const starStringTestCached = (cacheObj, starString, value, flags, startEndOfInput = 'both', treatAsNormalReg) => { | ||
try { | ||
if (starString.includes('*')) { | ||
if (starString.includes('*') || treatAsNormalReg) { | ||
const cache = getCache(); | ||
@@ -55,3 +55,3 @@ let reg = cache.get(cacheObj); | ||
reg = { | ||
reg: starStringToRegex(starString, flags, startEndOfInput), | ||
reg: treatAsNormalReg ? new RegExp(starString, flags) : starStringToRegex(starString, flags, startEndOfInput), | ||
pattern: starString | ||
@@ -58,0 +58,0 @@ }; |
import { safeParseNumber } from "./numbers"; | ||
const jsonPathReg = /^(\w+)\.([^:]+):(\w+)$/; | ||
const castTypes = ['boolean']; | ||
const castTypes = [ | ||
'json', 'jsonb', 'boolean', 'text', 'int', | ||
'json[]', 'jsonb[]', 'boolean[]', 'text[]', 'int[]', | ||
]; | ||
export const escapeSqlString = (value) => "'" + value.replace(/'/g, "''") + "'"; | ||
@@ -14,3 +17,3 @@ export const escapeSqlName = (value) => { | ||
const parts = jMatch[2].split('.').map(v => escapeSqlString(v)); | ||
return `("${jMatch[1].replace(/`/g, '""')}"->${parts.join('->')})::${type}`; | ||
return `("${jMatch[1].replace(/`/g, '""')}"->>${parts.join('->>')})::${type}`; | ||
} | ||
@@ -17,0 +20,0 @@ } |
@@ -14,2 +14,3 @@ import { BehaviorSubject } from "rxjs"; | ||
to?: string; | ||
openLinkInNewWindow?: boolean; | ||
type?: TType; | ||
@@ -16,0 +17,0 @@ action?: (item: UiActionItem<any, any, any>) => void; |
{ | ||
"name": "@iyio/common", | ||
"version": "0.7.0", | ||
"version": "0.7.2", | ||
"sideEffects": false, | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -40,2 +40,3 @@ "use strict"; | ||
'js': 'text/javascript', | ||
'jsx': 'text/javascript', | ||
'json': 'application/json', | ||
@@ -72,3 +73,4 @@ 'jsonld': 'application/ld+json', | ||
'tiff': 'image/tiff', | ||
'ts': 'video/mp2t', | ||
'ts': 'application/typescript', | ||
'tsx': 'application/typescript', | ||
'ttf': 'font/ttf', | ||
@@ -75,0 +77,0 @@ 'txt': 'text/plain', |
@@ -20,2 +20,2 @@ /** | ||
export declare const starStringTest: (starString: string, value: string, flags?: string, startEndOfInput?: StarStringStartEndOfInput) => boolean; | ||
export declare const starStringTestCached: (cacheObj: Record<string, any>, starString: string, value: string, flags?: string, startEndOfInput?: StarStringStartEndOfInput) => boolean; | ||
export declare const starStringTestCached: (cacheObj: Record<string, any>, starString: string, value: string, flags?: string, startEndOfInput?: StarStringStartEndOfInput, treatAsNormalReg?: boolean) => boolean; |
@@ -54,5 +54,5 @@ "use strict"; | ||
exports.starStringTest = starStringTest; | ||
const starStringTestCached = (cacheObj, starString, value, flags, startEndOfInput = 'both') => { | ||
const starStringTestCached = (cacheObj, starString, value, flags, startEndOfInput = 'both', treatAsNormalReg) => { | ||
try { | ||
if (starString.includes('*')) { | ||
if (starString.includes('*') || treatAsNormalReg) { | ||
const cache = getCache(); | ||
@@ -62,3 +62,3 @@ let reg = cache.get(cacheObj); | ||
reg = { | ||
reg: (0, exports.starStringToRegex)(starString, flags, startEndOfInput), | ||
reg: treatAsNormalReg ? new RegExp(starString, flags) : (0, exports.starStringToRegex)(starString, flags, startEndOfInput), | ||
pattern: starString | ||
@@ -65,0 +65,0 @@ }; |
@@ -6,3 +6,6 @@ "use strict"; | ||
const jsonPathReg = /^(\w+)\.([^:]+):(\w+)$/; | ||
const castTypes = ['boolean']; | ||
const castTypes = [ | ||
'json', 'jsonb', 'boolean', 'text', 'int', | ||
'json[]', 'jsonb[]', 'boolean[]', 'text[]', 'int[]', | ||
]; | ||
const escapeSqlString = (value) => "'" + value.replace(/'/g, "''") + "'"; | ||
@@ -19,3 +22,3 @@ exports.escapeSqlString = escapeSqlString; | ||
const parts = jMatch[2].split('.').map(v => (0, exports.escapeSqlString)(v)); | ||
return `("${jMatch[1].replace(/`/g, '""')}"->${parts.join('->')})::${type}`; | ||
return `("${jMatch[1].replace(/`/g, '""')}"->>${parts.join('->>')})::${type}`; | ||
} | ||
@@ -22,0 +25,0 @@ } |
@@ -14,2 +14,3 @@ import { BehaviorSubject } from "rxjs"; | ||
to?: string; | ||
openLinkInNewWindow?: boolean; | ||
type?: TType; | ||
@@ -16,0 +17,0 @@ action?: (item: UiActionItem<any, any, any>) => void; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2882281
46947