Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: translate pm object handler into insomnia object instead of supporting alias - INS-3702 #7253

Merged
merged 4 commits into from
Apr 9, 2024

Conversation

ihexxa
Copy link
Contributor

@ihexxa ihexxa commented Apr 9, 2024

This change enables translating pm objects into insomnia objects in scripts, and disable the original alias.

Changes:

  • Apply translation in importing
  • Add tests

@ihexxa ihexxa self-assigned this Apr 9, 2024
Comment on lines 76 to 87
for (let i = 0; i < scriptContent.length - 2; i++) {
if (scriptContent.slice(i, i + 3) !== 'pm.') {
continue;
}

if (i - 1 >= 0 && /[0-9a-zA-Z\_\$]/.test(scriptContent[i - 1])) {
continue;
} else {
translated = translated.slice(0, i + offset) + 'insomnia.' + translated.slice(i + 3 + offset);
offset += 6;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation is difficult to understand. Could you try to simplify it please.

@ihexxa ihexxa enabled auto-merge (squash) April 9, 2024 13:03
@ihexxa ihexxa merged commit 7f767a8 into develop Apr 9, 2024
5 of 7 checks passed
@ihexxa ihexxa deleted the pre-req-trans-pm branch April 9, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants