faire_un_dump_dans_la_console
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
faire_un_dump_dans_la_console [2022/11/10 20:22] – tickleman | faire_un_dump_dans_la_console [2022/11/25 13:05] (Version actuelle) – tickleman | ||
---|---|---|---|
Ligne 6: | Ligne 6: | ||
<code javascript> | <code javascript> | ||
- | dmp = (what, pre = '', | + | dmp = (what, pre = '', |
- | if (typeof what == ' | + | if (depth === 100) anticyclic = {} |
- | return ' | + | |
- | } | + | if (typeof what == ' |
- | if (typeof what == ' | + | for (const anti in anticyclic) if (anticyclic.hasOwnProperty(anti) && (anticyclic[anti] |
- | return ' | + | |
- | } | + | if (Array.isArray(what)) { |
- | for (const anti of anticyclic) | + | |
- | if (what === anti) { | + | |
- | return ' | + | let key = 0 |
- | } | + | for (const value of what) { |
- | } | + | result += pre + ' |
- | anticyclic.push(what) | + | key ++ |
- | if (depth && | + | } |
- | let result = " | + | return result + ' |
- | let key = 0 | + | } |
- | for (const value of what) { | + | else if (typeof what === ' |
- | result += pre + ' | + | |
- | key ++ | + | |
- | } | + | for (const key in what) if (what.hasOwnProperty(key)) { |
- | return result + ' | + | result += pre + ' |
- | } | + | } |
- | else if (depth && | + | return result + ' |
- | let result = " | + | } |
- | for (const key in what) if (what.hasOwnProperty(key)) { | + | return what.toString() |
- | result += pre + ' | + | |
- | } | + | |
- | return result + ' | + | |
- | } | + | |
- | return what.toString() | + | |
} | } | ||
- | anticyclic = [] | ||
dmp(application) | dmp(application) | ||
</ | </ | ||
- | |||
- |
faire_un_dump_dans_la_console.1668108138.txt.gz · Dernière modification : 2022/11/10 20:22 de tickleman