{"id":22982345,"url":"https://github.com/niradler/params-check","last_synced_at":"2025-07-15T12:35:50.977Z","repository":{"id":57318921,"uuid":"155288765","full_name":"niradler/params-check","owner":"niradler","description":"JS function param check, use reusable adapters to check function params, for native js projects.","archived":false,"fork":false,"pushed_at":"2020-02-07T14:26:45.000Z","size":35,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-16T01:43:46.059Z","etag":null,"topics":["function","params","params-check","params-validate"],"latest_commit_sha":null,"homepage":"","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/niradler.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}},"created_at":"2018-10-29T22:17:55.000Z","updated_at":"2018-10-30T21:36:23.000Z","dependencies_parsed_at":"2022-08-25T22:41:50.900Z","dependency_job_id":null,"html_url":"https://github.com/niradler/params-check","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/niradler/params-check","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niradler%2Fparams-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niradler%2Fparams-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niradler%2Fparams-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niradler%2Fparams-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niradler","download_url":"https://codeload.github.com/niradler/params-check/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niradler%2Fparams-check/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265436917,"owners_count":23765063,"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":["function","params","params-check","params-validate"],"created_at":"2024-12-15T02:17:58.452Z","updated_at":"2025-07-15T12:35:50.935Z","avatar_url":"https://github.com/niradler.png","language":"JavaScript","readme":"### Params Check\n\n```javascript\n//npm i -S params-check --production\nconst ParamsCheck = require('params-check')\n//optional container to catch the error throw;\nconst funcContainer = ParamsCheck.funcContainer;\n// test adapter to check number of params send to function\nconst adapter = (params, schema) =\u003e {\n  if(params.length == schema.numberOfParams) {\n    return {error:null}\n  } \n  return {error:'missing params!'}\n}; \n// create instance with adapter for validation\nconst paramsCheck = new ParamsCheck(adapter); \n// test function\nconst testFunc = (a, b, c) =\u003e a + b + c; \nconst validationRules = {\n  numberOfParams:3\n}\n// composition \nconst testedFunc = paramsCheck.withValidation(testFunc.name, validationRules, testFunc); \n\ntest('to throw', () =\u003e { \n  let isThrow = false;\n  //will throw error missing param, got 2 instead of 3;\n  funcContainer(()=\u003etestedFunc(1, 2),(error)=\u003e {console.log(error); isThrow = true;}); \n  expect(isThrow).toBe(true);\n});\n\ntest('to pass', () =\u003e {\n  expect(testedFunc(1, 2, 3)).toBe(6);\n});\n```\n\n## Demo\n\n[runkit](https://runkit.com/niradler/5bd797402b601900123e01c4)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniradler%2Fparams-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniradler%2Fparams-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniradler%2Fparams-check/lists"}