Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
792 bytes
|
Line | |
---|
1 | exports.instanceOf = function (value, constructorName) {
|
---|
2 | return Object.prototype.toString.apply(value) === '[object ' + constructorName + ']'
|
---|
3 | }
|
---|
4 |
|
---|
5 | exports.elm = function (id) {
|
---|
6 | return document.getElementById(id)
|
---|
7 | }
|
---|
8 |
|
---|
9 | exports.generateId = function (prefix) {
|
---|
10 | return prefix + Math.floor(Math.random() * 10000)
|
---|
11 | }
|
---|
12 |
|
---|
13 | exports.isUndefined = function (value) {
|
---|
14 | return typeof value === 'undefined'
|
---|
15 | }
|
---|
16 |
|
---|
17 | exports.isDefined = function (value) {
|
---|
18 | return !exports.isUndefined(value)
|
---|
19 | }
|
---|
20 |
|
---|
21 | exports.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.