Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. JavaScript
  5. [Vorlage] Hilfreiche JavaScript-Funktionen

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    16
    1
    1.8k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    883

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    25
    1
    2.1k

[Vorlage] Hilfreiche JavaScript-Funktionen

Scheduled Pinned Locked Moved JavaScript
javascript
23 Posts 10 Posters 13.1k Views 43 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Superdad
    wrote on last edited by
    #5

    Vielen Dank für deine Arbeit!

    CCU3

    iOBroker auf IntelNUC Proxmox

    1 Reply Last reply
    1
    • M Offline
      M Offline
      Marty56
      wrote on last edited by
      #6

      Große Klasse. Danke dafür. Sofort einen Bookmark gemacht!!

      HW:NUC (16 GB Ram)
      OS: Debian Bullseye, Promox V7, node v16.x npm 8.19.3

      1 Reply Last reply
      1
      • L Offline
        L Offline
        leuchtturm
        wrote on last edited by leuchtturm
        #7

        Auch von mir ein herzliches Danke.
        War auf der Suche nach einer Funktion add Day to Date.
        Und schwupps schon gefunden 😎

        1 Reply Last reply
        1
        • MicM Offline
          MicM Offline
          Mic
          Developer
          wrote on last edited by
          #8

          ein paar Funktionen ergänzt...

          1 Reply Last reply
          0
          • MicM Offline
            MicM Offline
            Mic
            Developer
            wrote on last edited by
            #9

            stateLastUpdated() ergänzt.

            1 Reply Last reply
            0
            • MicM Offline
              MicM Offline
              Mic
              Developer
              wrote on last edited by
              #10

              isState() durch existsState() ersetzt:
              Hinweis (07.01.2019): Bislang gab es hier eine Function isState(), diese ist nun hinfällig, weil es mit existsState() nun (mind. ab JS-Adapter-Version 4.3.4, gg. früher schon) eine neue ioBroker-Funktion gibt, um zu prüfen, ob ein State (Datenpunkt) existiert. Beispiel:

              1 Reply Last reply
              0
              • MicM Offline
                MicM Offline
                Mic
                Developer
                wrote on last edited by
                #11

                createUserStates() ergänzt:

                Mit diesem Script bzw. dieser Funktion können States (Datenpunkte) unter 0_userdata.0 oder unter javascript.x angelegt werden. Dabei können mehrere States gleichzeitig angelegt werden. Sobald alle erfolgreich angelegt wurden, kann danach (per callback) ein beliebiger Code ausgeführt werden, also beispielsweise die Haupt-Funktion des Scripts.

                1 Reply Last reply
                0
                • MicM Offline
                  MicM Offline
                  Mic
                  Developer
                  wrote on last edited by
                  #12

                  isTimeInAstro() und fileExistsSync() ergänzt.

                  1 Reply Last reply
                  0
                  • MicM Offline
                    MicM Offline
                    Mic
                    Developer
                    wrote on last edited by
                    #13

                    Notiz an mich selbst:
                    json2table() hinzufügen, also Umwandlung JSON in HTML-Tabelle.
                    https://forum.iobroker.net/topic/32540/json-zu-html-und-in-datei-schreiben-ablegen

                    1 Reply Last reply
                    0
                    • Matthias StübnerM Offline
                      Matthias StübnerM Offline
                      Matthias Stübner
                      wrote on last edited by
                      #14

                      Ich möchte dateToString(), selbiges wird aber als unbekannt markiert. Muss ich, und wenn ja was, irgendein zusätzliches Modul/Adapter laden?

                      MicM htreckslerH 2 Replies Last reply
                      0
                      • Matthias StübnerM Matthias Stübner

                        Ich möchte dateToString(), selbiges wird aber als unbekannt markiert. Muss ich, und wenn ja was, irgendein zusätzliches Modul/Adapter laden?

                        MicM Offline
                        MicM Offline
                        Mic
                        Developer
                        wrote on last edited by Mic
                        #15

                        @Matthias-Stübner
                        Was meinst du genau mit "als unbekannt markiert"? Am besten bitte Logausgabe hier posten.
                        Du brauchst keine weiteren Adapter ö.ä. hierfür.

                        1 Reply Last reply
                        0
                        • Matthias StübnerM Matthias Stübner

                          Ich möchte dateToString(), selbiges wird aber als unbekannt markiert. Muss ich, und wenn ja was, irgendein zusätzliches Modul/Adapter laden?

                          htreckslerH Offline
                          htreckslerH Offline
                          htrecksler
                          Forum Testing
                          wrote on last edited by
                          #16

                          @Matthias-Stübner das im Editor unterstrichen wird, kannst DU an der Stelle ignorieren.
                          Es sollte dennoch wie erwartet funktionieren.

                          Gruss Hermann

                          ioBroker auf Proxmox (Debian) auf IntelNuc als Produktivsystem

                          moelskiM 1 Reply Last reply
                          0
                          • htreckslerH htrecksler

                            @Matthias-Stübner das im Editor unterstrichen wird, kannst DU an der Stelle ignorieren.
                            Es sollte dennoch wie erwartet funktionieren.

                            moelskiM Offline
                            moelskiM Offline
                            moelski
                            wrote on last edited by
                            #17

                            Danke für die Funktionen !

                            Grüße Dominik

                            1 Reply Last reply
                            0
                            • AlCalzoneA Offline
                              AlCalzoneA Offline
                              AlCalzone
                              Developer
                              wrote on last edited by
                              #18

                              clearStr stimmt nicht mit seiner Beschreibung überein:

                              > String(null)
                              'null'
                              

                              Warum `sudo` böse ist: https://forum.iobroker.net/post/17109

                              MicM 1 Reply Last reply
                              0
                              • AlCalzoneA AlCalzone

                                clearStr stimmt nicht mit seiner Beschreibung überein:

                                > String(null)
                                'null'
                                
                                MicM Offline
                                MicM Offline
                                Mic
                                Developer
                                wrote on last edited by Mic
                                #19

                                @AlCalzone
                                Danke für den Hinweis, hab die Funktion jetzt ersatzlos entfernt :grinning:
                                Ist so "generisch" eher nicht zu gebrauchen, weil z.B. andere Datentypen (wie number) auch nicht behandelt werden und je nach Einsatzzweck was unterschiedliches zu prüfen ist.

                                Christoph1337C 1 Reply Last reply
                                0
                                • MicM Mic

                                  @AlCalzone
                                  Danke für den Hinweis, hab die Funktion jetzt ersatzlos entfernt :grinning:
                                  Ist so "generisch" eher nicht zu gebrauchen, weil z.B. andere Datentypen (wie number) auch nicht behandelt werden und je nach Einsatzzweck was unterschiedliches zu prüfen ist.

                                  Christoph1337C Offline
                                  Christoph1337C Offline
                                  Christoph1337
                                  wrote on last edited by
                                  #20

                                  Moin zusammen,

                                  ich habe mal versucht ein paar der Funktionen bei mir einzufügen.

                                  Allerdings bekomme ich immer folgende Meldung:

                                  script.js.common.Array compile failed: at script.js.common.Array:256

                                  das komische. Das Script geht garnicht bis Zeile 256...

                                  Auch wenn ich dann alle Zeilen aus kommentiere habe ich dieses Problem.

                                  /**
                                   * Remove Duplicates from Array
                                   * Source - https://stackoverflow.com/questions/23237704/nodejs-how-to-remove-duplicates-from-array
                                   * @param {array} inputArray       Array to process
                                   * @return {array}  Array without duplicates.
                                   */
                                  
                                  function GlobalarrayRemoveDublicates(inputArray) {
                                      let uniqueArray;
                                      uniqueArray = inputArray.filter(function(elem, pos) {
                                          return inputArray.indexOf(elem) == pos;
                                      });
                                      return uniqueArray;
                                  }
                                  
                                  /**
                                   * Clean Array: Removes all falsy values: undefined, null, 0, false, NaN and "" (empty string)
                                   * Source: https://stackoverflow.com/questions/281264/remove-empty-elements-from-an-array-in-javascript
                                   * @param {array} inputArray       Array to process
                                   * @return {array}  Cleaned array
                                   */
                                  /*
                                  function GlobalcleanArray(inputArray) {
                                    var newArray = [];
                                    for (let i = 0; i < inputArray.length; i++) {
                                      if (inputArray[i]) {
                                        newArray.push(inputArray[i]);
                                      }
                                    }
                                    return newArray;
                                  }
                                  */
                                  /**
                                   * Removing Array element(s) by input value. 
                                   * @param {array}   arr             the input array
                                   * @param {string}  valRemove       the value to be removed
                                   * @param {boolean} [exact=true]    OPTIONAL: default is true. if true, it must fully match. if false, it matches also if valRemove is part of element string
                                   * @return {array}  the array without the element(s)
                                   */
                                  /*
                                  function GlobalarrayRemoveElementsByValue(arr, valRemove, exact) {
                                   
                                      if (exact === undefined) exact = true;
                                   
                                      for ( let i = 0; i < arr.length; i++){ 
                                          if (exact) {
                                              if ( arr[i] === valRemove) {
                                                  arr.splice(i, 1);
                                                  i--; // required, see https://love2dev.com/blog/javascript-remove-from-array/
                                              }
                                          } else {
                                              if (arr[i].indexOf(valRemove) != -1) {
                                                  arr.splice(i, 1);
                                                  i--; // see above
                                              }
                                          }
                                      }
                                      return arr;
                                  }
                                  */
                                  /**
                                   * Checks if Array or String is not undefined, null or empty.
                                   * 08-Sep-2019: added check for [ and ] to also catch arrays with empty strings.
                                   * @param inputVar - Input Array or String, Number, etc.
                                   * @return true if it is undefined/null/empty, false if it contains value(s)
                                   * Array or String containing just whitespaces or >'< or >"< or >[< or >]< is considered empty
                                   */
                                  /*
                                  function GlobalisLikeEmpty(inputVar) {
                                      if (typeof inputVar !== 'undefined' && inputVar !== null) {
                                          let strTemp = JSON.stringify(inputVar);
                                          strTemp = strTemp.replace(/\s+/g, ''); // remove all whitespaces
                                          strTemp = strTemp.replace(/\"+/g, "");  // remove all >"<
                                          strTemp = strTemp.replace(/\'+/g, "");  // remove all >'<
                                          strTemp = strTemp.replace(/[+/g, "");  // remove all >[<
                                          strTemp = strTemp.replace(/]+/g, "");  // remove all >]<
                                          if (strTemp !== '') {
                                              return false;
                                          } else {
                                              return true;
                                          }
                                      } else {
                                          return true;
                                      }
                                  }
                                  */
                                  
                                  Christoph1337C liv-in-skyL AlCalzoneA 3 Replies Last reply
                                  0
                                  • Christoph1337C Christoph1337

                                    Moin zusammen,

                                    ich habe mal versucht ein paar der Funktionen bei mir einzufügen.

                                    Allerdings bekomme ich immer folgende Meldung:

                                    script.js.common.Array compile failed: at script.js.common.Array:256

                                    das komische. Das Script geht garnicht bis Zeile 256...

                                    Auch wenn ich dann alle Zeilen aus kommentiere habe ich dieses Problem.

                                    /**
                                     * Remove Duplicates from Array
                                     * Source - https://stackoverflow.com/questions/23237704/nodejs-how-to-remove-duplicates-from-array
                                     * @param {array} inputArray       Array to process
                                     * @return {array}  Array without duplicates.
                                     */
                                    
                                    function GlobalarrayRemoveDublicates(inputArray) {
                                        let uniqueArray;
                                        uniqueArray = inputArray.filter(function(elem, pos) {
                                            return inputArray.indexOf(elem) == pos;
                                        });
                                        return uniqueArray;
                                    }
                                    
                                    /**
                                     * Clean Array: Removes all falsy values: undefined, null, 0, false, NaN and "" (empty string)
                                     * Source: https://stackoverflow.com/questions/281264/remove-empty-elements-from-an-array-in-javascript
                                     * @param {array} inputArray       Array to process
                                     * @return {array}  Cleaned array
                                     */
                                    /*
                                    function GlobalcleanArray(inputArray) {
                                      var newArray = [];
                                      for (let i = 0; i < inputArray.length; i++) {
                                        if (inputArray[i]) {
                                          newArray.push(inputArray[i]);
                                        }
                                      }
                                      return newArray;
                                    }
                                    */
                                    /**
                                     * Removing Array element(s) by input value. 
                                     * @param {array}   arr             the input array
                                     * @param {string}  valRemove       the value to be removed
                                     * @param {boolean} [exact=true]    OPTIONAL: default is true. if true, it must fully match. if false, it matches also if valRemove is part of element string
                                     * @return {array}  the array without the element(s)
                                     */
                                    /*
                                    function GlobalarrayRemoveElementsByValue(arr, valRemove, exact) {
                                     
                                        if (exact === undefined) exact = true;
                                     
                                        for ( let i = 0; i < arr.length; i++){ 
                                            if (exact) {
                                                if ( arr[i] === valRemove) {
                                                    arr.splice(i, 1);
                                                    i--; // required, see https://love2dev.com/blog/javascript-remove-from-array/
                                                }
                                            } else {
                                                if (arr[i].indexOf(valRemove) != -1) {
                                                    arr.splice(i, 1);
                                                    i--; // see above
                                                }
                                            }
                                        }
                                        return arr;
                                    }
                                    */
                                    /**
                                     * Checks if Array or String is not undefined, null or empty.
                                     * 08-Sep-2019: added check for [ and ] to also catch arrays with empty strings.
                                     * @param inputVar - Input Array or String, Number, etc.
                                     * @return true if it is undefined/null/empty, false if it contains value(s)
                                     * Array or String containing just whitespaces or >'< or >"< or >[< or >]< is considered empty
                                     */
                                    /*
                                    function GlobalisLikeEmpty(inputVar) {
                                        if (typeof inputVar !== 'undefined' && inputVar !== null) {
                                            let strTemp = JSON.stringify(inputVar);
                                            strTemp = strTemp.replace(/\s+/g, ''); // remove all whitespaces
                                            strTemp = strTemp.replace(/\"+/g, "");  // remove all >"<
                                            strTemp = strTemp.replace(/\'+/g, "");  // remove all >'<
                                            strTemp = strTemp.replace(/[+/g, "");  // remove all >[<
                                            strTemp = strTemp.replace(/]+/g, "");  // remove all >]<
                                            if (strTemp !== '') {
                                                return false;
                                            } else {
                                                return true;
                                            }
                                        } else {
                                            return true;
                                        }
                                    }
                                    */
                                    
                                    Christoph1337C Offline
                                    Christoph1337C Offline
                                    Christoph1337
                                    wrote on last edited by
                                    #21

                                    Hab es selber gelöst:

                                    /** 
                                     * Checks if Array or String is not undefined, null or empty.
                                     * 08-Sep-2019: added check for [ and ] to also catch arrays with empty strings.
                                     * @param inputVar - Input Array or String, Number, etc.
                                     * @return true if it is undefined/null/empty, false if it contains value(s)
                                     * Array or String containing just whitespaces or >'< or >"< or >[< or >]< is considered empty
                                    */
                                    
                                    function GlobalIsLikeEmpty(inputVar) 
                                    {
                                        if (typeof inputVar !== 'undefined' && inputVar !== null) {
                                            let strTemp = JSON.stringify(inputVar);
                                            strTemp = strTemp.replace(/\s+/g, ''); // remove all whitespaces
                                            strTemp = strTemp.replace(/\"+/g, "");  // remove all >"<
                                            strTemp = strTemp.replace(/\'+/g, "");  // remove all >'<
                                            strTemp = strTemp.replace(/\[+/g, "");  // remove all >[<
                                            strTemp = strTemp.replace(/]+/g, "");  // remove all >]<
                                    
                                            if (strTemp !== '') {
                                                return false;
                                            } else {
                                                return true;
                                            }
                                        } else {
                                            return true;
                                        }
                                    }
                                    
                                    1 Reply Last reply
                                    0
                                    • Christoph1337C Christoph1337

                                      Moin zusammen,

                                      ich habe mal versucht ein paar der Funktionen bei mir einzufügen.

                                      Allerdings bekomme ich immer folgende Meldung:

                                      script.js.common.Array compile failed: at script.js.common.Array:256

                                      das komische. Das Script geht garnicht bis Zeile 256...

                                      Auch wenn ich dann alle Zeilen aus kommentiere habe ich dieses Problem.

                                      /**
                                       * Remove Duplicates from Array
                                       * Source - https://stackoverflow.com/questions/23237704/nodejs-how-to-remove-duplicates-from-array
                                       * @param {array} inputArray       Array to process
                                       * @return {array}  Array without duplicates.
                                       */
                                      
                                      function GlobalarrayRemoveDublicates(inputArray) {
                                          let uniqueArray;
                                          uniqueArray = inputArray.filter(function(elem, pos) {
                                              return inputArray.indexOf(elem) == pos;
                                          });
                                          return uniqueArray;
                                      }
                                      
                                      /**
                                       * Clean Array: Removes all falsy values: undefined, null, 0, false, NaN and "" (empty string)
                                       * Source: https://stackoverflow.com/questions/281264/remove-empty-elements-from-an-array-in-javascript
                                       * @param {array} inputArray       Array to process
                                       * @return {array}  Cleaned array
                                       */
                                      /*
                                      function GlobalcleanArray(inputArray) {
                                        var newArray = [];
                                        for (let i = 0; i < inputArray.length; i++) {
                                          if (inputArray[i]) {
                                            newArray.push(inputArray[i]);
                                          }
                                        }
                                        return newArray;
                                      }
                                      */
                                      /**
                                       * Removing Array element(s) by input value. 
                                       * @param {array}   arr             the input array
                                       * @param {string}  valRemove       the value to be removed
                                       * @param {boolean} [exact=true]    OPTIONAL: default is true. if true, it must fully match. if false, it matches also if valRemove is part of element string
                                       * @return {array}  the array without the element(s)
                                       */
                                      /*
                                      function GlobalarrayRemoveElementsByValue(arr, valRemove, exact) {
                                       
                                          if (exact === undefined) exact = true;
                                       
                                          for ( let i = 0; i < arr.length; i++){ 
                                              if (exact) {
                                                  if ( arr[i] === valRemove) {
                                                      arr.splice(i, 1);
                                                      i--; // required, see https://love2dev.com/blog/javascript-remove-from-array/
                                                  }
                                              } else {
                                                  if (arr[i].indexOf(valRemove) != -1) {
                                                      arr.splice(i, 1);
                                                      i--; // see above
                                                  }
                                              }
                                          }
                                          return arr;
                                      }
                                      */
                                      /**
                                       * Checks if Array or String is not undefined, null or empty.
                                       * 08-Sep-2019: added check for [ and ] to also catch arrays with empty strings.
                                       * @param inputVar - Input Array or String, Number, etc.
                                       * @return true if it is undefined/null/empty, false if it contains value(s)
                                       * Array or String containing just whitespaces or >'< or >"< or >[< or >]< is considered empty
                                       */
                                      /*
                                      function GlobalisLikeEmpty(inputVar) {
                                          if (typeof inputVar !== 'undefined' && inputVar !== null) {
                                              let strTemp = JSON.stringify(inputVar);
                                              strTemp = strTemp.replace(/\s+/g, ''); // remove all whitespaces
                                              strTemp = strTemp.replace(/\"+/g, "");  // remove all >"<
                                              strTemp = strTemp.replace(/\'+/g, "");  // remove all >'<
                                              strTemp = strTemp.replace(/[+/g, "");  // remove all >[<
                                              strTemp = strTemp.replace(/]+/g, "");  // remove all >]<
                                              if (strTemp !== '') {
                                                  return false;
                                              } else {
                                                  return true;
                                              }
                                          } else {
                                              return true;
                                          }
                                      }
                                      */
                                      
                                      liv-in-skyL Offline
                                      liv-in-skyL Offline
                                      liv-in-sky
                                      wrote on last edited by liv-in-sky
                                      #22

                                      @christoph1337 sagte in [Vorlage] Hilfreiche JavaScript-Funktionen:

                                      {1}

                                      da sind diese {1}
                                      drin - da ist evtl was beim kopieren schiefgegangen

                                      lösche die mal raus

                                      nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                                      1 Reply Last reply
                                      0
                                      • Christoph1337C Christoph1337

                                        Moin zusammen,

                                        ich habe mal versucht ein paar der Funktionen bei mir einzufügen.

                                        Allerdings bekomme ich immer folgende Meldung:

                                        script.js.common.Array compile failed: at script.js.common.Array:256

                                        das komische. Das Script geht garnicht bis Zeile 256...

                                        Auch wenn ich dann alle Zeilen aus kommentiere habe ich dieses Problem.

                                        /**
                                         * Remove Duplicates from Array
                                         * Source - https://stackoverflow.com/questions/23237704/nodejs-how-to-remove-duplicates-from-array
                                         * @param {array} inputArray       Array to process
                                         * @return {array}  Array without duplicates.
                                         */
                                        
                                        function GlobalarrayRemoveDublicates(inputArray) {
                                            let uniqueArray;
                                            uniqueArray = inputArray.filter(function(elem, pos) {
                                                return inputArray.indexOf(elem) == pos;
                                            });
                                            return uniqueArray;
                                        }
                                        
                                        /**
                                         * Clean Array: Removes all falsy values: undefined, null, 0, false, NaN and "" (empty string)
                                         * Source: https://stackoverflow.com/questions/281264/remove-empty-elements-from-an-array-in-javascript
                                         * @param {array} inputArray       Array to process
                                         * @return {array}  Cleaned array
                                         */
                                        /*
                                        function GlobalcleanArray(inputArray) {
                                          var newArray = [];
                                          for (let i = 0; i < inputArray.length; i++) {
                                            if (inputArray[i]) {
                                              newArray.push(inputArray[i]);
                                            }
                                          }
                                          return newArray;
                                        }
                                        */
                                        /**
                                         * Removing Array element(s) by input value. 
                                         * @param {array}   arr             the input array
                                         * @param {string}  valRemove       the value to be removed
                                         * @param {boolean} [exact=true]    OPTIONAL: default is true. if true, it must fully match. if false, it matches also if valRemove is part of element string
                                         * @return {array}  the array without the element(s)
                                         */
                                        /*
                                        function GlobalarrayRemoveElementsByValue(arr, valRemove, exact) {
                                         
                                            if (exact === undefined) exact = true;
                                         
                                            for ( let i = 0; i < arr.length; i++){ 
                                                if (exact) {
                                                    if ( arr[i] === valRemove) {
                                                        arr.splice(i, 1);
                                                        i--; // required, see https://love2dev.com/blog/javascript-remove-from-array/
                                                    }
                                                } else {
                                                    if (arr[i].indexOf(valRemove) != -1) {
                                                        arr.splice(i, 1);
                                                        i--; // see above
                                                    }
                                                }
                                            }
                                            return arr;
                                        }
                                        */
                                        /**
                                         * Checks if Array or String is not undefined, null or empty.
                                         * 08-Sep-2019: added check for [ and ] to also catch arrays with empty strings.
                                         * @param inputVar - Input Array or String, Number, etc.
                                         * @return true if it is undefined/null/empty, false if it contains value(s)
                                         * Array or String containing just whitespaces or >'< or >"< or >[< or >]< is considered empty
                                         */
                                        /*
                                        function GlobalisLikeEmpty(inputVar) {
                                            if (typeof inputVar !== 'undefined' && inputVar !== null) {
                                                let strTemp = JSON.stringify(inputVar);
                                                strTemp = strTemp.replace(/\s+/g, ''); // remove all whitespaces
                                                strTemp = strTemp.replace(/\"+/g, "");  // remove all >"<
                                                strTemp = strTemp.replace(/\'+/g, "");  // remove all >'<
                                                strTemp = strTemp.replace(/[+/g, "");  // remove all >[<
                                                strTemp = strTemp.replace(/]+/g, "");  // remove all >]<
                                                if (strTemp !== '') {
                                                    return false;
                                                } else {
                                                    return true;
                                                }
                                            } else {
                                                return true;
                                            }
                                        }
                                        */
                                        
                                        AlCalzoneA Offline
                                        AlCalzoneA Offline
                                        AlCalzone
                                        Developer
                                        wrote on last edited by
                                        #23

                                        @christoph1337 sagte in [Vorlage] Hilfreiche JavaScript-Funktionen:

                                        Das Script geht garnicht bis Zeile 256...

                                        Hast du globale Skripte?

                                        Warum `sudo` böse ist: https://forum.iobroker.net/post/17109

                                        1 Reply Last reply
                                        0
                                        Reply
                                        • Reply as topic
                                        Log in to reply
                                        • Oldest to Newest
                                        • Newest to Oldest
                                        • Most Votes


                                        Support us

                                        ioBroker
                                        Community Adapters
                                        Donate

                                        680

                                        Online

                                        32.6k

                                        Users

                                        82.1k

                                        Topics

                                        1.3m

                                        Posts
                                        Community
                                        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                        ioBroker Community 2014-2025
                                        logo
                                        • Login

                                        • Don't have an account? Register

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Home
                                        • Recent
                                        • Tags
                                        • Unread 0
                                        • Categories
                                        • Unreplied
                                        • Popular
                                        • GitHub
                                        • Docu
                                        • Hilfe