{"id":23286680,"url":"https://github.com/allnulled/superif","last_synced_at":"2025-08-11T22:38:24.181Z","repository":{"id":268378916,"uuid":"904163074","full_name":"allnulled/superif","owner":"allnulled","description":"Clase en JS para crear estructuras IF-ELSE complejas.","archived":false,"fork":false,"pushed_at":"2024-12-16T11:19:03.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T15:43:07.044Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/allnulled.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-16T11:17:55.000Z","updated_at":"2024-12-18T17:51:36.000Z","dependencies_parsed_at":"2024-12-16T12:36:04.615Z","dependency_job_id":null,"html_url":"https://github.com/allnulled/superif","commit_stats":null,"previous_names":["allnulled/superif"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/allnulled/superif","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fsuperif","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fsuperif/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fsuperif/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fsuperif/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allnulled","download_url":"https://codeload.github.com/allnulled/superif/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fsuperif/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269969598,"owners_count":24505430,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-20T02:14:03.069Z","updated_at":"2025-08-11T22:38:24.133Z","avatar_url":"https://github.com/allnulled.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# superif\n\nClase en JS para crear estructuras IF-ELSE complejas.\n\n## Instalación\n\n### Descargar la librería\n\n```\nnpm install -s @allnulled/superif\n```\n\n### Importar la librería\n\n#### Modos de importar la librería\n\nDado que usa otras librerías, y pueden quererse usar desde otros módulos o no, puedes usar el archivo:\n\n  - `superif.js`: este fichero tiene todas las APIs necesarias.\n  - `superif.unbundled.js`: este fichero solo tiene la parte que le es propia, y sobreentiende que cargarás las otras librerías necesarias por tu propia cuenta.\n\n**NOTA:** Por defecto, se usa `superif.unbundled.js`.\n\n#### En node.js\n\nPuedes usar `require` o `import` indistintamente para importar el módulo.\n\n#### En browser\n\n```html\n\u003cscript src=\"node_modules/@allnulled/superif/dist/superif.js\"\u003e\u003c/script\u003e\n```\n\nO alternativamente:\n\n```html\n\u003cscript src=\"node_modules/@allnulled/superif/dist/lib/ufs.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"node_modules/@allnulled/superif/dist/superif.unbundled.js\"\u003e\u003c/script\u003e\n```\n\n## API\n\n### Crear un superif\n\nPara crear un superif, desde node.js puedes:\n\n```js\nconst superif = require(\"@allnulled/superif\").create();\n```\n\nSi estás en browser y no usas módulos, o si estás en node.js y no quieres usar require, puedes:\n\n```js\nconst superif = Superif.create();\n```\n\n### Usar un superif\n\nEste es un ejemplo de uso:\n\n```js\nconst Superif = require(__dirname + \"/../dist/superif.js\");\n\n// Crear una instancia\nconst superif = new Superif();\n\n// Definir condiciones (IFs)\nsuperif\n  .setCondition(\"isGreaterThan10\", async (input) =\u003e input \u003e 10)\n  .setCondition(\"isEven\", async (input) =\u003e input % 2 === 0)\n  .setCondition(\"isAnswer\", async (input) =\u003e input === 42);\n\n// Definir acciones (THENs)\nsuperif\n  .setAction(\"isGreaterThan10\", async (input) =\u003e { console.log(`${input} es mayor que 10.`); })\n  .setAction(\"isEven\", async (input) =\u003e { console.log(`${input} es par.`); })\n  .setAction(\"isAnswer\", async (input) =\u003e { console.log(`${input} es la respuesta a todo.`); });\n\n// Ejecutar\nconst input = 42;\nsuperif.execute(input);\n\n// Quitar una acción\nsuperif.removeAction(\"isEven\");\n\n// Ejecutar nuevamente con una acción menos\nsuperif.execute(44);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallnulled%2Fsuperif","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallnulled%2Fsuperif","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallnulled%2Fsuperif/lists"}