# stencila-mini-core

> ### Install

Latest version **0.1.0** (published 2017-10-03) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install stencila-mini-core
pnpm add stencila-mini-core
yarn add stencila-mini-core
bun add stencila-mini-core
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2017-10-03 |
| First published | 2017-10-03 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 5 |
| Maintainers | nokome |

## Links

- npm: https://www.npmjs.com/package/stencila-mini-core
- Repository: https://github.com/stencila/mini-core
- Homepage: https://github.com/stencila/mini-core#readme
- Issues: https://github.com/stencila/mini-core/issues
- npm.io page: https://npm.io/package/stencila-mini-core

## Dependencies (2)

- [jstat](https://npm.io/package/jstat.md) ^1.7.0
- [@stdlib/stdlib](https://npm.io/package/@stdlib/stdlib.md) 0.0.26

## Recent versions

- 0.1.0 (latest) — 2017-10-03

## README

## Mini Core Library functions implemented in Javascript

### Install

```bash
npm install
```

### Create

Each function needs an XML file in the `../xml` folder. If necessary, create a new function using [`../xml/.fun.xml`] as a template. 

### Implement

In the revelant `.fun.xml` file (an existing one, or one which you created above) add a `<implem language="js">` element under `<implems>`. This registers the implementation with the Stencila execution engine.

Create the Javascript function in the relevant `./src/*.js` file with the same name as the Mini function e.g. `function sum(x)...` for `sum.fun.xml`.

If your implementation overloads parameter types then you need to add those type names to the function signature. e.g. `function sum_arraynumber(x)`, `function sum_matrixnumber(x)`

Currently, the following are available in the global environment:

- [jStat](http://jstat.github.io/)
- [stdlib](https://stdlib.io/)

### Test

Run all tests in Node.js:

```bash
npm test
```

Run all tests in the browser:

```bash
npm run test-browser
```

then open `test/index.html`.

### Try

You can try out functions in the browser developer console by building the distribution:

```bash
npm run build
```

then open `index.html`.

### Check

Check that the Javascript functions the you have implemented match the XML definitions:

```bash
npm run check
```

This will also produce `build/func.js` : A dictionary of XML `Function` definitions to be loaded into `stencila/stencila` for function documentation, reflection (e.g. function call tips) and dispatching. Currently, this file contains the entire XML file for each function.

---
_Source: https://npm.io/package/stencila-mini-core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
