Skip to content

bddjr/scratch-list-data-string-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scratch:

https://scratch.mit.edu/projects/1180636385
https://create.codelab.club/projects/101103


import ScratchListDataString from "scratch-list-data-string";

const input = [
    "0",
    "1",
    "Hello, world!",
    "Hello, scratch!",
    String.raw`test\test`,
    String.raw`\\\,`,
    "true",
    "",
    ""
]
console.log(input)
[
  '0',
  '1',
  'Hello, world!',  
  'Hello, scratch!',
  'test\\test',     
  '\\\\\\,',        
  'true',
  '',
  ''
]
const str = ScratchListDataString.encode(input)
console.log(str)
0,1,Hello\, world!,Hello\, scratch!,test\\test,\\\\\\\,,true,,
const output = ScratchListDataString.decode(str)
console.log(output)
[
  '0',
  '1',
  'Hello, world!',
  'Hello, scratch!',
  'test\\test',
  '\\\\\\,',
  'true',
  '',
  ''
]