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.1.0 to 0.2.0

48

lib/index.js

@@ -0,1 +1,6 @@

/**
* Agreaga el elemento value al comienzo de la lista.
* @param {*} value
* @param {Array} list
*/
function cons(value, list) {

@@ -7,2 +12,6 @@ let tmp = list.slice(0);

/**
* Retorma el primer elemento de la lista
* @param {Array} list
*/
function first(list) {

@@ -12,2 +21,6 @@ return list.slice(0, 1)[0];

/**
* Retorna todos los elementos de la lista, excepto el primero
* @param {Array} list
*/
function rest(list) {

@@ -17,2 +30,6 @@ return list.slice(1);

/**
* La lista de entrada está vacio?
* @param {Array} list
*/
function isEmpty(list) {

@@ -25,2 +42,6 @@ if (typeof list == 'object') {

/**
* El objeto de entrada es una lista?
* @param {Array} list
*/
function isList(list) {

@@ -30,2 +51,27 @@ return typeof list === 'object' && typeof list.length == 'number' && list.length >= 0;

module.exports = { cons, first, rest, isEmpty, isList };
/**
* Retorna la longitud de un arreglo
* @param {Array} list
*/
function length(list) {
return list.length;
}
/**
* Concatena la list2 al final de la list1. Si list2 no es un arreglo, simplemente agrega
* este elemento al final de list1.
* @param {Array} list1
* @param {Array | Object} list2
*/
function append(list1, list2) {
let tmp = list1.slice();
if (typeof list2 === 'object' && list2.length >= 0) {
tmp.push(...list2);
return tmp;
} else {
tmp.push(list2);
return tmp;
}
}
module.exports = { cons, first, rest, isEmpty, isList, length, append };

2

package.json
{
"name": "functional-light",
"version": "0.1.0",
"version": "0.2.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