mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-15 20:35:23 +03:00
chore: remove custom string formatting
String template literals are in built way to handle these cases now
This commit is contained in:
parent
71586c914a
commit
2938c4338d
3 changed files with 36 additions and 37 deletions
|
@ -2,22 +2,6 @@ Number.prototype.clamp = function(min, max) {
|
|||
return Math.min(Math.max(this, min), max);
|
||||
};
|
||||
|
||||
/**
|
||||
* String formatting now supports currying (partial application).
|
||||
* For a format string with N replacement indices, you can call .format
|
||||
* with M <= N arguments. The result is going to be a format string
|
||||
* with N-M replacement indices, properly counting from 0 .. N-M.
|
||||
* The following Example should explain the usage of partial applied format:
|
||||
* "{0}:{1}:{2}".format("a","b","c") === "{0}:{1}:{2}".format("a","b").format("c")
|
||||
* "{0}:{1}:{2}".format("a").format("b").format("c") === "{0}:{1}:{2}".format("a").format("b", "c")
|
||||
**/
|
||||
String.prototype.format = function () {
|
||||
var args = arguments;
|
||||
return this.replace(/\{(\d+)\}/g, function (t, i) {
|
||||
return args[i] !== void 0 ? args[i] : "{"+(i-args.length)+"}";
|
||||
});
|
||||
};
|
||||
|
||||
Array.prototype.push8 = function(val) {
|
||||
this.push(0xFF & val);
|
||||
return this;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue