Digital switching function minimizer written in AngularJS