functionallibrary
Advanced tools
Comparing version
const { allAreTrue } = require("./functions/allAreTrue"); | ||
const { find, findIndex, forEach, map, reduce } = require("./functions/arrayPrototypes"); | ||
const { atLeastOneTrue } = require("./functions/atLeastOneTrue"); | ||
@@ -8,3 +9,2 @@ const { commonsItemsBetweenArrays } = require("./functions/commonsItemsBetweenArrays"); | ||
const { equality } = require("./functions/equality"); | ||
const { getDeeper } = require("./functions/getDeeper"); | ||
const { getPropertysValue } = require("./functions/getPropertysValue"); | ||
@@ -15,6 +15,6 @@ const { isEmpty } = require("./functions/isEmpty"); | ||
const { removeItemFromArrayByIndex } = require("./functions/removeItemFromArrayByIndex"); | ||
const { removeItemFromArrayByProp } = require("./functions/removeItemFromArrayByProp"); | ||
const { returnUniqueArraysItems } = require("./functions/returnUniqueArraysItems"); | ||
const { round } = require("./functions/round"); | ||
const { setNewProperty } = require("./functions/setNewProperty"); | ||
const { find, findIndex, forEach, map, reduce } = require("./functions/arrayPrototypes"); | ||
@@ -32,3 +32,2 @@ module.exports = { | ||
forEach, | ||
getDeeper, | ||
getPropertysValue, | ||
@@ -41,2 +40,3 @@ isEmpty, | ||
removeItemFromArrayByIndex, | ||
removeItemFromArrayByProp, | ||
returnUniqueArraysItems, | ||
@@ -43,0 +43,0 @@ round, |
{ | ||
"name": "functionallibrary", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "funciones a usar en programacion funcional", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# Functional Library | ||
Librería de funciones usadas para programación funcional. | ||
**functional programming functions.** | ||
(Librería de funciones usadas para programación funcional.) | ||
## Install | ||
```code | ||
npm i functionallibrary | ||
``` | ||
## Use | ||
import ***functionallibrary*** in your `.js` file | ||
```js | ||
import { map, setNewProperty, compose } from 'functionallibrary'; | ||
``` | ||
## Vuejs use | ||
in your `.vue` file | ||
```js | ||
<script> | ||
import { map, setNewProperty, compose } from 'functionallibrary'; | ||
function updateDocuments() { | ||
this.documents = map( | ||
compose( | ||
setNewProperty('createdAt', new Date()), | ||
setNewProperty('customer', this.customer), | ||
), | ||
this.documents, | ||
) | ||
} | ||
function data() { | ||
return { | ||
customer: { | ||
name: 'jhon Doe', | ||
id: '00001', | ||
}, | ||
documents: [ | ||
{ | ||
id: 1, | ||
num: '1234', | ||
description: 'new shoes', | ||
type: 'sale', | ||
}, | ||
{ | ||
id: 2, | ||
num: '2345', | ||
description: 'new t-shirt', | ||
type: 'sale', | ||
}, | ||
], | ||
}, | ||
} | ||
export default { | ||
name: 'vue-component', | ||
data, | ||
methods: { | ||
updateDocuments, | ||
}, | ||
} | ||
</script> | ||
``` | ||
the `updateDocument` function result: | ||
```js | ||
this.documents = [ | ||
{ | ||
id: 1, | ||
num: '1234', | ||
description: 'new shoes', | ||
type: 'sale', | ||
createdAt: '2019-12-28', | ||
customer: { | ||
name: 'jhon Doe', | ||
id: '00001', | ||
}, | ||
}, | ||
{ | ||
id: 2, | ||
num: '2345', | ||
description: 'new t-shirt', | ||
type: 'sale', | ||
createdAt: '2019-12-28', | ||
customer: { | ||
name: 'jhon Doe', | ||
id: '00001', | ||
}, | ||
}, | ||
]; | ||
``` | ||
# Functions | ||
## allAreTrue | ||
@@ -5,0 +94,0 @@ ```js |
@@ -15,2 +15,3 @@ const allAreTrue = require('./allAreTrue.spec'); | ||
const returnUniqueArraysItems = require('./returnUniqueArraysItems.spec'); | ||
const round = require('./round.spec'); | ||
const round = require('./round.spec'); | ||
const examples = require('./examples.spec'); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
30528
9.6%38
2.7%728
9.31%396
28.99%0
-100%