Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

functional-light

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

functional-light - npm Package Compare versions

Comparing version 0.5.1 to 0.6.0

29

lib/index.js

@@ -134,2 +134,29 @@ /**

module.exports = { cons, first, rest, isEmpty, isList, length, append, filter, map, deepCopy };
/**
* Aplica una función f a cada elemento de la lista. La función f
* recibe el elemento de la lista y el índice en el cual se encuentra.
* El tercer parámetro es un desplazamiento del índice. Por defecto en 0
* @param {Array} l
* @param {function} f
* @param {number} offset
* @example forEach([1, 2, 3], (a, i) => console.log(i + " : " + a));
*/
function forEach(l, f, index = 0) {
if (!isEmpty(l)) {
f(first(l), index);
forEach(rest(l), f, index + 1);
}
}
/**
* Concatena 2 listas.
* @param {Array} list1
* @param {Array} list2
* @returns {Array}
* @example concat([1, 2], [3, 4]); // [1, 2, 3, 4]
*/
function concat(list1, list2) {
if (isEmpty(list1)) return list2;
return cons(first(list1), concat(rest(list1), list2));
}
module.exports = { cons, first, rest, isEmpty, isList, length, append, filter, map, deepCopy, forEach, concat };

2

package.json
{
"name": "functional-light",
"version": "0.5.1",
"version": "0.6.0",
"description": "Librería para el curso de programación funcional con JavaScript",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc