MCPcopy Index your code
hub / github.com/dataease/SQLBot / formatCertificate

Function formatCertificate

frontend/public/assistant.js:501–524  ·  view source on GitHub ↗
(item)

Source from the content-addressed store, hash-verified

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

Callers 1

parsrCertificateFunction · 0.85

Calls 2

getCookieFunction · 0.85
isEmptyFunction · 0.85

Tested by

no test coverage detected