https://github.com/rtorr/sides
https://github.com/rtorr/sides
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rtorr/sides
- Owner: rtorr
- Created: 2018-08-04T09:11:42.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-04T17:14:44.000Z (almost 7 years ago)
- Last Synced: 2025-03-25T02:44:07.241Z (4 months ago)
- Language: JavaScript
- Size: 67.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sides
small (2.29 KB) "safe" program interfaces for JavaScript. Yes, safe is in quotes.
## Use
```bash
yarn add sides
```some program or code to create an interface for
```javascript
import { registerInterface } from 'sides';
import PropTypes from 'prop-types';let count = 0;
function countSomeStuff(n) {
count = count += n ? n.number : 1;
return count;
}const unregister = registerInterface(
{
name: 'program1',
program: countSomeStuff,
types: { number: PropTypes.number.isRequired },
description: 'this is a test program'
},
PropTypes
);
```some other place to interface with that program
```javascript
import sides from 'sides';sides('program1', { number: 2 });
// Throw a nice warning
sides('program1', { number: '1' });
// -> Warning: Failed program type: Invalid program type `number` of type `string` supplied to `program1`, expected `number`.
```## Develop
```bash
git clone [email protected]:rtorr/sides.git
yarn install
yarn start
```