Last active
July 26, 2017 02:04
-
-
Save Dinir/79cd92169bede28318b95d31d149e33b to your computer and use it in GitHub Desktop.
IE10 π‘
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
| /** | |
| * μ€λΈμ νΈκ° λΉμ΄μλμ§ νμΈν©λλ€. | |
| * | |
| * @param {object} obj | |
| * @returns {boolean} | |
| */ | |
| var isEmptyObj = function (obj) { | |
| if(obj) | |
| return Object.keys(obj).length === 0 && obj.constructor === Object; | |
| else | |
| return true; | |
| }; | |
| /** | |
| * IEμμ `Object.values(obj)` λ₯Ό λμ ν΄μ μΈ μ μλ ν¨μμ λλ€. | |
| * | |
| * @param {object} obj | |
| * @returns {Array} | |
| */ | |
| var objectValues = function (obj) { | |
| var values = Object.keys(obj).map(function (k) { | |
| return obj[k]; | |
| }); | |
| return values; | |
| }; | |
| /** | |
| * @callback forEach~forEachCallback | |
| * @param {!number} index | |
| * @param value | |
| */ | |
| /** | |
| * `[].forEach()` λ₯Ό λμ ν΄μ μΈ μ μλ ν¨μμ λλ€. | |
| * | |
| * https://toddmotto.com/ditch-the-array-foreach-call-nodelist-hack/#recommendations | |
| * | |
| * @param {!Array.} array | |
| * @param {!forEach~forEachCallback} callback | |
| * @param [scope] | |
| */ | |
| var forEach = function (array, callback, scope) { | |
| for (var i = 0; i < array.length; i++) { | |
| callback.call(scope, i, array[i]); | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment