diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-02-05 20:36:00 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-02-05 20:36:00 +0300 |
commit | 2621ce5ca08445b365508cbd536c0ab6d0b69a25 (patch) | |
tree | 795c3b1b46865c83352e9339d87d273c8a628fae /app/assets/javascripts/lib | |
parent | 77c97e3dd13effec43780f64d947013f951b9f04 (diff) |
Move repeated function to utilities
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js.es6 | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js.es6 b/app/assets/javascripts/lib/utils/common_utils.js.es6 index e3bff2559fd..cde48474906 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js.es6 +++ b/app/assets/javascripts/lib/utils/common_utils.js.es6 @@ -230,5 +230,13 @@ return upperCaseHeaders; }; + + /** + * Transforms a DOMStringMap into a plain object. + */ + w.gl.utils.DOMStringMapToObject = DOMStringMapObject => Object.keys(DOMStringMapObject).reduce((acc, element) => { + acc[element] = DOMStringMapObject[element]; + return acc; + }, {}); })(window); }).call(this); |