You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I am using JSVerbalExpressions to extract the specified format of strings,
when the VerEx test() result returns true, some code will be implemented.
But I found a strange problem when I try to separate the format from a different file in ES6 style.
The following code is trying to import a file that included formats that represent in VerEx, then call the test() function from the imported Object variable.
In Format.js
import VerEx from 'verbal-expressions'
let testResult = VerEx().startOfLine().anythingBut('.').find('-').anything().then('.').anything().endOfLine().test('CT-CP-RF-03.CWS.TEMP.1')
export { testResult };
export default {
Format01: {
description: "Metadata with floor information and following [Lo-cat-ion].[element] rule",
example: "AHU-S-3F-02.CHW.FLOW",
separator_lv1: ".",
separator_lv2: ".",
regExp: VerEx().startOfLine().anythingBut('.').find('-').anything().then('.').anything().endOfLine()
},
Format02: {
description: "",
example: "",
separator_lv1: "",
separator_lv2: "",
regExp: VerEx().startOfLine().anythingBut('.').maybe('-').anything().then(':').anythingBut('.-').endOfLine()
},
}
I did many tests in the following file, between local define VerEx and import VerEx, including
check regExp string
test('Hardcode String') by local VerEx,
test('Hardcode String') in import file local,
test('Hardcode String') by import VerEx
check parameter storing value equality before test()
check parameter storing value equality after test()
test(parameter) by local VerEx,
test(parameter) by import VerEx <---- this is the problem
even some tricky thing like
5. force copy string var string_copy = (' ' + metadata).slice(1);
but when I try to use VerEx that import from the other file to test() the parameter (in 4.), it will return false although I checked it is equal with the hardcode string (not all of the parameter having this problem)
Hello,
I am using JSVerbalExpressions to extract the specified format of strings,
when the VerEx test() result returns true, some code will be implemented.
But I found a strange problem when I try to separate the format from a different file in ES6 style.
The following code is trying to import a file that included formats that represent in VerEx, then call the test() function from the imported Object variable.
In Format.js
I did many tests in the following file, between local define VerEx and import VerEx, including
test('Hardcode String') in import file local,
test('Hardcode String') by import VerEx
check parameter storing value equality after test()
test(parameter) by import VerEx <---- this is the problem
even some tricky thing like
5. force copy string
var string_copy = (' ' + metadata).slice(1);
In formatter.js
but when I try to use VerEx that import from the other file to test() the parameter (in 4.), it will return false although I checked it is equal with the hardcode string (not all of the parameter having this problem)
Test Case:
Tested hardcode string === parameter
Local VerEx + hardcode string = pass
Local VerEx + parameter = pass
Import VerEx + hardcode string = pass
Import VerEx + parameter = fail
The text was updated successfully, but these errors were encountered: