source: trip-planner-front/node_modules/karma/common/util.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 792 bytes
RevLine 
[6a3a178]1exports.instanceOf = function (value, constructorName) {
2 return Object.prototype.toString.apply(value) === '[object ' + constructorName + ']'
3}
4
5exports.elm = function (id) {
6 return document.getElementById(id)
7}
8
9exports.generateId = function (prefix) {
10 return prefix + Math.floor(Math.random() * 10000)
11}
12
13exports.isUndefined = function (value) {
14 return typeof value === 'undefined'
15}
16
17exports.isDefined = function (value) {
18 return !exports.isUndefined(value)
19}
20
21exports.parseQueryParams = function (locationSearch) {
22 var params = {}
23 var pairs = locationSearch.substr(1).split('&')
24 var keyValue
25
26 for (var i = 0; i < pairs.length; i++) {
27 keyValue = pairs[i].split('=')
28 params[decodeURIComponent(keyValue[0])] = decodeURIComponent(keyValue[1])
29 }
30
31 return params
32}
Note: See TracBrowser for help on using the repository browser.