Created
February 28, 2019 15:03
-
-
Save lethern/164c8542eac646696eac3d900524d6f3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| endsWith = function (str, suffix) { | |
| if (str.length < suffix.length) | |
| return false; | |
| var suff_i = suffix.length - 1; | |
| var str_i = str.length - 1; | |
| for (; suff_i >= 0;) { | |
| if (str.charAt(str_i) != suffix.charAt(suff_i)) | |
| return false; | |
| --suff_i; | |
| --str_i; | |
| } | |
| return true; | |
| }; | |
| checkGlobalVariables = function () { | |
| var myObjects = [ | |
| 'UTILS', //... | |
| ]; | |
| var arr = Object.keys(window); | |
| var arrNew = []; | |
| var arrIDs = []; | |
| for(var i=0; i<arr.length; ++i){ | |
| var el = arr[i]; | |
| if( myObjects.indexOf(el) >= 0 ) | |
| continue; | |
| if (UTILS.endsWith(el, '_id')) { | |
| arrIDs.push(el); | |
| continue; | |
| } | |
| arrNew.push(el); | |
| } | |
| if (arrNew.length>0) | |
| alert( arrNew.join(', ') ); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment