Skip to content

Commit

Permalink
feat: accept snake_case and camelCase for wasm bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
DimiDumo committed Dec 13, 2024
1 parent 3356bd6 commit 5b357f2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
2 changes: 2 additions & 0 deletions packages/apis/src/extract_substrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
42 changes: 21 additions & 21 deletions packages/apis/tests/extract_substr.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ describe('Extract substr test suite', async () => {
const parts = {
parts: [
{
is_public: true,
regex_def: 'Hello'
isPublic: true,
regexDef: 'Hello'
}
]
};
Expand All @@ -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!'
}
]
};
Expand All @@ -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!'
}
]
};
Expand All @@ -59,8 +59,8 @@ describe('Extract substr test suite', async () => {
const parts = {
parts: [
{
is_public: false,
regex_def: 'Hello'
isPublic: false,
regexDef: 'Hello'
}
]
};
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('Extract substr test suite', async () => {
const parts = {
parts: [
{
is_public: false
isPublic: false
}
]
};
Expand All @@ -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!'
}
]
};
Expand All @@ -148,8 +148,8 @@ describe('Extract substr test suite', async () => {
const parts = {
parts: [
{
is_public: true,
regex_def: 'Hello'
isPublic: true,
regexDef: 'Hello'
}
]
};
Expand All @@ -161,8 +161,8 @@ describe('Extract substr test suite', async () => {
const parts = {
parts: [
{
is_public: false,
regex_def: 'Hello'
isPublic: false,
regexDef: 'Hello'
}
]
};
Expand Down

0 comments on commit 5b357f2

Please sign in to comment.