Comparing version 0.1.3 to 0.1.4
{ | ||
"name": "cmd.js", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "A chainable utility toolkit for JavaScript.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -137,11 +137,11 @@ # cmd.js | ||
cmd.max(1, 2, 3, 4, 5); // [5] | ||
cmd.max(1, 2, 3, 4, 5); // 5 | ||
cmd.max([1, 2, 3, 4, 5]); // [5] | ||
cmd.max([1, 2, 3, 4, 5]); // 5 | ||
cmd.max(1, [2, 3], 4, 5); // [5] | ||
cmd.max(1, [2, 3], 4, 5); // 5 | ||
cmd.max([1], 2, [3, 4, 5]); // [5] | ||
cmd.max([1], 2, [3, 4, 5]); // 5 | ||
cmd.max([1], [2], [3], [4], [5]); // [5] | ||
cmd.max([1], [2], [3], [4], [5]); // 5 | ||
``` | ||
@@ -236,2 +236,15 @@ | ||
### cmd.equals | ||
| name | return value | description | | ||
|------------|-------------------------|---------------| | ||
| `equals` | `[true or false, ...]` | Checks if each value passed in equals any of the given arguments. | | ||
The following example checks for values that equal 50: | ||
```js | ||
cmd.equals(30, 50)(100, 20, 50, 30); | ||
// [false, false, true, true] | ||
``` | ||
### cmd.exists | ||
@@ -341,2 +354,28 @@ | ||
### cmd.max | ||
| name | return value | description | | ||
|---------|---------------|---------------| | ||
| `max` | `100` | Returns the maximum of all given values. | | ||
The following example returns the maximum value: | ||
```js | ||
cmd.max(1, 2, 3, 4, 5); | ||
// 5 | ||
``` | ||
### cmd.min | ||
| name | return value | description | | ||
|---------|---------------|---------------| | ||
| `min` | `100` | Returns the minimum of all given values. | | ||
The following example returns the minimum value: | ||
```js | ||
cmd.min(1, 2, 3, 4, 5); | ||
// 1 | ||
``` | ||
### cmd.obj | ||
@@ -394,2 +433,15 @@ | ||
### cmd.product | ||
| name | return value | description | | ||
|-------------|---------------|---------------| | ||
| `product` | `100` | Returns the product of all given values. | | ||
The following example returns the product 1 * 2 * 3 * 4 * 5: | ||
```js | ||
cmd.product(1, 2, 3, 4, 5); | ||
// 120 | ||
``` | ||
### cmd.push.to | ||
@@ -455,6 +507,27 @@ | ||
return x.price; | ||
})({name: 'TV', price: 899.00}, {name: 'Car', price: 16999.00}, {name: 'Spoon', price: 1.29}); | ||
// [{name: "Spoon", price: 1.29}, {name: "TV", price: 899}, {name: "Car", price: 16999}] | ||
})( | ||
{name: 'TV', price: 899.00}, | ||
{name: 'Car', price: 16999.00}, | ||
{name: 'Spoon', price: 1.29} | ||
); | ||
// [ | ||
// {name: "Spoon", price: 1.29}, | ||
// {name: "TV", price: 899}, | ||
// {name: "Car", price: 16999} | ||
// ] | ||
``` | ||
### cmd.sum | ||
| name | return value | description | | ||
|-------------|---------------|---------------| | ||
| `sum` | `100` | Returns the sum of all given values. | | ||
The following example returns the sum 1 + 2 + 3 + 4 + 5: | ||
```js | ||
cmd.sum(1, 2, 3, 4, 5); | ||
// 15 | ||
``` | ||
### cmd.switch | ||
@@ -479,3 +552,10 @@ | ||
msgSwitch(0, 1, 2, 3, 4, 5, 6, 'x'); | ||
// ["You have no messages", "You have a message", "You have a few messages", "You have a few messages", "You have a few messages", "You have five messages", "You have lots of messages", "Unknown"] | ||
// ["You have no messages", | ||
// "You have a message", | ||
// "You have a few messages", | ||
// "You have a few messages", | ||
// "You have a few messages", | ||
// "You have five messages", | ||
// "You have lots of messages", | ||
// "Unknown"] | ||
``` |
@@ -137,11 +137,11 @@ # cmd.js | ||
cmd.max(1, 2, 3, 4, 5); // [5] | ||
cmd.max(1, 2, 3, 4, 5); // 5 | ||
cmd.max([1, 2, 3, 4, 5]); // [5] | ||
cmd.max([1, 2, 3, 4, 5]); // 5 | ||
cmd.max(1, [2, 3], 4, 5); // [5] | ||
cmd.max(1, [2, 3], 4, 5); // 5 | ||
cmd.max([1], 2, [3, 4, 5]); // [5] | ||
cmd.max([1], 2, [3, 4, 5]); // 5 | ||
cmd.max([1], [2], [3], [4], [5]); // [5] | ||
cmd.max([1], [2], [3], [4], [5]); // 5 | ||
``` | ||
@@ -148,0 +148,0 @@ |
@@ -27,4 +27,12 @@ ### cmd.sort | ||
return x.price; | ||
})({name: 'TV', price: 899.00}, {name: 'Car', price: 16999.00}, {name: 'Spoon', price: 1.29}); | ||
// [{name: "Spoon", price: 1.29}, {name: "TV", price: 899}, {name: "Car", price: 16999}] | ||
})( | ||
{name: 'TV', price: 899.00}, | ||
{name: 'Car', price: 16999.00}, | ||
{name: 'Spoon', price: 1.29} | ||
); | ||
// [ | ||
// {name: "Spoon", price: 1.29}, | ||
// {name: "TV", price: 899}, | ||
// {name: "Car", price: 16999} | ||
// ] | ||
``` |
@@ -20,3 +20,10 @@ ### cmd.switch | ||
msgSwitch(0, 1, 2, 3, 4, 5, 6, 'x'); | ||
// ["You have no messages", "You have a message", "You have a few messages", "You have a few messages", "You have a few messages", "You have five messages", "You have lots of messages", "Unknown"] | ||
// ["You have no messages", | ||
// "You have a message", | ||
// "You have a few messages", | ||
// "You have a few messages", | ||
// "You have a few messages", | ||
// "You have five messages", | ||
// "You have lots of messages", | ||
// "Unknown"] | ||
``` |
@@ -25,5 +25,12 @@ /** | ||
var libs = [ | ||
'alert', 'case', 'clone', 'compare', 'exists', 'extend', 'filter', 'format', 'join', | ||
'log', 'logger', 'max', 'min', 'obj', 'pluck', 'product', | ||
'push', 'sort', 'sum', 'switch' | ||
'alert', | ||
'case', 'clone', 'compare', | ||
'equals', 'exists', 'extend', | ||
'filter', 'format', | ||
'join', | ||
'log', 'logger', | ||
'max', 'min', | ||
'obj', | ||
'pluck', 'product', 'push', | ||
'sort', 'sum', 'switch' | ||
]; | ||
@@ -30,0 +37,0 @@ return libs.forEach(function (name) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
81820
77
1440
556