# @mitsuru793/snippet-executor

> Code block manager. This is useful in a single file as sandbox.

Latest version **0.0.1** (published 2019-02-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mitsuru793/snippet-executor
pnpm add @mitsuru793/snippet-executor
yarn add @mitsuru793/snippet-executor
bun add @mitsuru793/snippet-executor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2019-02-10 |
| First published | 2019-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | mitsuru793 |
| Maintainers | mitsuru793 |

## Links

- npm: https://www.npmjs.com/package/@mitsuru793/snippet-executor
- npm.io page: https://npm.io/package/@mitsuru793/snippet-executor

## Recent versions

- 0.0.1 (latest) — 2019-02-10

## 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.

```javascript
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

```typescript
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
```

---
_Source: https://npm.io/package/@mitsuru793/snippet-executor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
