)
}
}
)
(
}
{
)
)
(
)
(
(
{
}
)
(
)
}
)
)
{
(
(
)
)
}
)
(
}

Mangler

  1. const lookupReplacements = {
  2.   // entities (like ∑ or Θ - are safer
  3.   // than just putting things inline like ∑ or ®
  4.   'a': ['A', 'Ä', '∆', 'á'],
  5.   'e': ['é', '∃'],
  6.   't': ['⊤', 'Τ'] ,
  7.   'b': ['β'],
  8.   'o': ['∅', '_o_']
  9. }
  10.  
  11. function mangle(s) {
  12.   return s.split``.map(letter => {
  13.     const chars = lookupReplacements[letter]
  14.     return chars ? chars[
  15.       Math.floor(
  16.         chars.length * Math.random()
  17.       )
  18.     ] : letter
  19.   }).join``
  20. }
  21.  
  22. document.body.innerHTML = mangle('Been taking a break from making snippets... might start up again...<hr>')
  23.  
  24. document.body.innerHTML += mangle('Been taking a break from making snippets... might start up again...<hr>')
  25.  
  26. document.body.innerHTML += mangle('Been taking a break from making snippets... might start up again...<hr>')

Substitute some characters in a string with some random choices…

Pass a Class

  1. function callMethods(evt) {
  2.   const e = new evt
  3.   e.one()
  4.   e.two()
  5. }
  6.  
  7. callMethods(class {
  8.   one() {
  9.     console.log('one')
  10.   }
  11.  
  12.   two() {
  13.     console.log('two')
  14.   }
  15. })

This is so tempting for something I want to do… but too strange to use probably… maybe…

snippet.zone ~ 2021-24 /// {s/z}