(item)
| 499 | return obj == null || typeof obj == 'undefined' |
| 500 | } |
| 501 | function formatCertificate(item) { |
| 502 | const { type, source, target, target_key, target_val } = item |
| 503 | let source_val = null |
| 504 | if (type.toLocaleLowerCase() == 'localstorage') { |
| 505 | source_val = localStorage.getItem(source) |
| 506 | } |
| 507 | if (type.toLocaleLowerCase() == 'sessionstorage') { |
| 508 | source_val = sessionStorage.getItem(source) |
| 509 | } |
| 510 | if (type.toLocaleLowerCase() == 'cookie') { |
| 511 | source_val = getCookie(source) |
| 512 | } |
| 513 | if (type.toLocaleLowerCase() == 'custom') { |
| 514 | source_val = source |
| 515 | } |
| 516 | if (isEmpty(source_val)) { |
| 517 | return null |
| 518 | } |
| 519 | return { |
| 520 | target, |
| 521 | key: target_key || source, |
| 522 | value: (target_val && eval(target_val)) || source_val, |
| 523 | } |
| 524 | } |
| 525 | function getCookie(key) { |
| 526 | if (!key || !document.cookie) { |
| 527 | return null |
no test coverage detected