A simple tool used to invert conditions for all modern programming languages and frameworks!
Highlight conditions that you want to invert:
Invert conditions in ternary operators, for loops, and more:
Invert conditions inside html templates:
Highlight the area of code that you want to invert and press the following key combination on your keyboard:
Operating System | Keys |
---|---|
Windows/Ubuntu | ctrl + shift + i |
Mac | cmd + shift + i |
You can alternatively rebind the key combination to your preference by searching for the following command inside the VSCode's Keyboard Shortcuts section: condition-inverter.invert
.
This tool has been designed to take an input condition, analyze it and produce a new condition that would yield an absolute opposite result. This is illustrated by the following example:
Properties | Original condition | Result | Inverted condition | Result |
---|---|---|---|---|
dog = true, cat = false | dog && cat | false | !dog | | !cat | true |
dog = 3, cat = 2 | dog < cat | false | dog >= cat | true |
Condition Inverter supports all modern progrogramming languages and frameworks. This includes technologies that have been ranked as the most popular on the Stack Overflow Developer Survey.
Disclaimer - this tool does not currently support query, shell scripting or assembly based languages.
# Requirements: Node version 11+ and NPM version 6+
# Install node dependencies:
$ npm install
# Compile dependencies and run the project in watch mode:
$ npm run compile:watch
# To run tests
# First navigate to the ../shared directory and install its node dependencies:
$ npm install
# Navigate back to the ./extension directory and run the tests:
$ npm run test
# Run tests with coverage:
$ npm run test:coverage
Open source is built by the community for the community. All contributions to this project are welcome!
Additionally, if you have any suggestions for enhancements, ideas on how to take the project further or have discovered a bug, do not hesitate to create a new issue ticket and we will look into it as soon as possible!