@mitsuru793/snippet-executor
v0.0.1
Published
Code block manager. This is useful in a single file as sandbox.
Downloads
3
Readme
Snippet-Executor
This is a closure manager. It's useful when you write some code brocks in one file. You don't have to split the file.
import Codes from 'codes'
const lessons = new Codes()
lessons.push('join array', () => {
const nums = [1]
nums.join([2])
console.log(nums)
})
lessons.push('join string', () => {
const nums = '1'
nums += 2
console.log(nums)
})
lessons.runLast()
// execute 'join string'
// => 12
Methods
push(code: Function): this
push(title: string, code: Function): this
runAt(index: number | string, args: any[] = []): any
runFirst(args: any[] = []): any
runLast(args: any[] = []): any {
runMatch(pattern: RegExp, args: any[] = []): any