{"id":23283576,"url":"https://github.com/damiancipolat/fish-type-js","last_synced_at":"2026-04-09T09:32:51.108Z","repository":{"id":57155610,"uuid":"180943716","full_name":"damiancipolat/Fish-type-JS","owner":"damiancipolat","description":"Runtime validation of data types in functions call parameters and return in runtime for ES6.","archived":false,"fork":false,"pushed_at":"2019-04-30T04:21:35.000Z","size":149,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-06T14:43:43.385Z","etag":null,"topics":["dynamic","es6","functions","javascript","nodejs","npm","react","typecheck","typechecker"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/damiancipolat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-12T06:23:05.000Z","updated_at":"2019-04-30T04:21:36.000Z","dependencies_parsed_at":"2022-08-26T09:51:02.780Z","dependency_job_id":null,"html_url":"https://github.com/damiancipolat/Fish-type-JS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiancipolat%2FFish-type-JS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiancipolat%2FFish-type-JS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiancipolat%2FFish-type-JS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiancipolat%2FFish-type-JS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damiancipolat","download_url":"https://codeload.github.com/damiancipolat/Fish-type-JS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247500454,"owners_count":20948877,"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","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":["dynamic","es6","functions","javascript","nodejs","npm","react","typecheck","typechecker"],"created_at":"2024-12-20T01:22:32.815Z","updated_at":"2025-12-30T23:06:24.803Z","avatar_url":"https://github.com/damiancipolat.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://github.com/damiancipolat/JS-Dynamic-type-validation/blob/master/doc/fish_2.png?raw=true\" width=\"180px\" align=\"right\" /\u003e\n\n# Fish type JS\n\nData type validation in function calls on **Runtime** to be used in javascript projects.\n\n[![dependencies Status](https://david-dm.org/damiancipolat/Fish-type-JS.svg)](https://david-dm.org/damiancipolat/Fish-type-JS)\n[![license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/damiancipolat/Fish-type-JS/blob/master/LICENSE)\n[![version](https://img.shields.io/badge/version-%3E%3D%201.0.0-green.svg)](https://github.com/damiancipolat/Fish-type-JShttps://github.com/damiancipolat/Fish-type-JS)\n[![build](https://travis-ci.com/damiancipolat/Fish-type-JS.svg?branch=master)](https://travis-ci.com/damiancipolat/Fish-type-JS)\n\n\u003ca href=\"https://www.npmjs.com/package/fish-type-js\"\u003e\u003cimg src=\"https://nodei.co/npm/fish-type-js.png?downloads=true\"\u003e\u003c/a\u003e\n\n**We have the new version 1.1.0 ready!**\n\nIn this version:\n- Improve input function type semantic.\n- Add typedef validation module.\n\n## Objective:\nEvery JS programmer knows how annoying it is to work with static validators of data types. That's why I created this library, to help us and make sure that our function is always executed only with the types of data that we define for it.\n\n## Type data validation:\nThis library uses joi https://github.com/hapijs/joi to handle the type validations, you can use custom primitives data as \"string\", \"bool\", \"number\" or more complex structure to validate if the parameters used to call a function match with the paramters that we define to allow it.\n\n## Usage:\n\n#### Install:\n\nRun this command to install the library from npm.\n```sh\nnpm install fish-type-js\n```\n#### Library:\nThe library export two things, a decorate function that have to be use for decorate a single function and add a automatic call parameters validation, and a list of primitive data types.\n\n**Decorate function - format**\n```javascript\nconst {decorate} = require('fish-type-js');\n\n//I will get the function output.\nconst sumT = decorate({input},output)(sum);\n```\n**Define input and output:**\n\nYou can  specify the types of the parameters that the function receive and the return data of the function.\n\n```javascript\nconst newFunction = decorate({input},output)(Function);\n\n```\n\n**IN**:  paramters structure / **OUT**: type function return\n\n\n**Type parameters**:\nYou can use this type parameters in each parameter key.\n\n* undefined\n* string\n* null\n* boolean\n* number\n* object\n* promise\n\nOr create more complex object schema and mix the function call with a joi schema validation, is important\nto remember include JOI module to use his data types schema.\n\n```javascript\nconst Joi = require('joi');\n\n//Include primitives types.\nconst pointType =  Joi.object().keys({\n  lat: Joi.number(),\n  lng: Joi.number()\n});\n\nconst findGeoT  = decorate({point:pointType})(findGeo);\n\nfindGeoT({lat:1.111,lng:3.01});\n\n```\n#### Examples:\n\nTry this basic example of how to use the library.\n\n```javascript\n//Include lib and types.\nconst {decorate} = require('fish-type-js');\n\n//Basic function.\nconst sum = (a,b)=\u003e{\n  return a+b;\n}\n\n//Decorate the function.\nconst sumT  = decorate({a:'number',b:'number'},'number')(sum);\n\nsumT(10,10);\n\n```\n\nIf you want more examples, go and download the project and go to /samples folder and chek the examples.\n\n## Note:\nThis library is a work in progress project, I'm sure that will be very usefull for any JS developer, but take care that could be changes in the next versions. **We are working in create our custom structure validation engine to avoid use JOI**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamiancipolat%2Ffish-type-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamiancipolat%2Ffish-type-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamiancipolat%2Ffish-type-js/lists"}