feat: accept snake_case and camelCase for wasm bindings

This commit is contained in:
Dimitri
2024-12-13 14:39:48 +07:00
parent 3356bd6f15
commit 5b357f2c7a
2 changed files with 23 additions and 21 deletions

View File

@@ -12,8 +12,10 @@ pub struct DecomposedRegexConfig {
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RegexPartConfig {
/// A flag indicating whether the substring matching with `regex_def` should be exposed.
#[serde(alias = "isPublic")]
pub is_public: bool,
/// A regex string.
#[serde(alias = "regexDef")]
pub regex_def: String,
}

View File

@@ -8,8 +8,8 @@ describe('Extract substr test suite', async () => {
const parts = {
parts: [
{
is_public: true,
regex_def: 'Hello'
isPublic: true,
regexDef: 'Hello'
}
]
};
@@ -22,12 +22,12 @@ describe('Extract substr test suite', async () => {
const parts = {
parts: [
{
is_public: true,
regex_def: 'Hello '
isPublic: true,
regexDef: 'Hello '
},
{
is_public: false,
regex_def: 'guys!'
isPublic: false,
regexDef: 'guys!'
}
]
};
@@ -40,12 +40,12 @@ describe('Extract substr test suite', async () => {
const parts = {
parts: [
{
is_public: true,
regex_def: 'Hello '
isPublic: true,
regexDef: 'Hello '
},
{
is_public: false,
regex_def: 'guys!'
isPublic: false,
regexDef: 'guys!'
}
]
};
@@ -59,8 +59,8 @@ describe('Extract substr test suite', async () => {
const parts = {
parts: [
{
is_public: false,
regex_def: 'Hello'
isPublic: false,
regexDef: 'Hello'
}
]
};
@@ -106,7 +106,7 @@ describe('Extract substr test suite', async () => {
const parts = {
parts: [
{
is_public: false
isPublic: false
}
]
};
@@ -123,12 +123,12 @@ describe('Extract substr test suite', async () => {
const parts = {
parts: [
{
is_public: true,
regex_def: 'Hello'
isPublic: true,
regexDef: 'Hello'
},
{
is_public: false,
regex_def: 'yall!'
isPublic: false,
regexDef: 'yall!'
}
]
};
@@ -148,8 +148,8 @@ describe('Extract substr test suite', async () => {
const parts = {
parts: [
{
is_public: true,
regex_def: 'Hello'
isPublic: true,
regexDef: 'Hello'
}
]
};
@@ -161,8 +161,8 @@ describe('Extract substr test suite', async () => {
const parts = {
parts: [
{
is_public: false,
regex_def: 'Hello'
isPublic: false,
regexDef: 'Hello'
}
]
};