Project Blueprint Fake API
The content of this file (static/intro.md) is added at the top of the documentation.
add
How to import?
// From Node.js
const {add} = require('@customcommander/project-blueprint').math;
// From a browser
const {add} = window['@customcommander/project-blueprint'].math;
add(1, 2);
//=> 3
Adds a and b.
| Parameter | Type | Description |
|---|---|---|
| a | number | N/A |
| b | number | N/A |
Returns number.
answer
How to import?
// From Node.js
const {answer} = require('@customcommander/project-blueprint').misc.random;
// From a browser
const {answer} = window['@customcommander/project-blueprint'].misc.random;
The answer to the universe and everything else.
Returns number.
curry
How to import?
// From Node.js
const {curry} = require('@customcommander/project-blueprint');
// From a browser
const {curry} = window['@customcommander/project-blueprint'];
const add3 = curry((a, b, c) => a + b + c);
add3(1, 2, 3);
//=> 6
add3(1)(2)(3);
//=> 6
add3(1)()(2)()(3);
//=> 6
Returns a curried version of fn.
| Parameter | Type | Description |
|---|---|---|
| fn | function | N/A |
Returns function.
dec
How to import?
// From Node.js
const {dec} = require('@customcommander/project-blueprint').math;
// From a browser
const {dec} = window['@customcommander/project-blueprint'].math;
Takes 1 away from x.
| Parameter | Type | Description |
|---|---|---|
| x | number | N/A |
Returns number.
inc
How to import?
// From Node.js
const {inc} = require('@customcommander/project-blueprint').math;
// From a browser
const {inc} = window['@customcommander/project-blueprint'].math;
Adds 1 to x.
| Parameter | Type | Description |
|---|---|---|
| x | number | N/A |
Returns number.
sum
How to import?
// From Node.js
const {sum} = require('@customcommander/project-blueprint').math;
// From a browser
const {sum} = window['@customcommander/project-blueprint'].math;
sum();
//=> 0
sum(1);
//=> 1
sum(1, 2);
//=> 3
sum(1, 2, 3);
//=> 6
Adds all numbers together.
| Parameter | Type | Description |
|---|---|---|
| ...x | number | A list of numbers |
Returns number.
wrap
How to import?
// From Node.js
const {wrap} = require('@customcommander/project-blueprint').string;
// From a browser
const {wrap} = window['@customcommander/project-blueprint'].string;
wrap("foo");
//=> "(foo)"
wrap("foo", "<", ">");
//=> "<foo>"
Wraps str between prefix and suffix.
| Parameter | Type | Description |
|---|---|---|
| str | string | The string to wrap. |
| prefix | string | (Optional) Default "(". |
| suffix | string | (Optional) Default ")". |
Returns string.
See also add