{"id":21401443,"url":"https://github.com/spoonx/request-helpers","last_synced_at":"2025-07-23T16:09:17.160Z","repository":{"id":20222302,"uuid":"23494058","full_name":"SpoonX/request-helpers","owner":"SpoonX","description":"A collection of request helpers. Usable with express js (and consequently, sails.js).","archived":false,"fork":false,"pushed_at":"2016-03-24T12:36:13.000Z","size":289,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-07T13:41:47.051Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SpoonX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-30T15:01:36.000Z","updated_at":"2017-02-03T10:51:40.000Z","dependencies_parsed_at":"2022-08-29T20:30:37.121Z","dependency_job_id":null,"html_url":"https://github.com/SpoonX/request-helpers","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/SpoonX/request-helpers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Frequest-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Frequest-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Frequest-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Frequest-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpoonX","download_url":"https://codeload.github.com/SpoonX/request-helpers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Frequest-helpers/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266708514,"owners_count":23971946,"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-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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-11-22T15:27:46.532Z","updated_at":"2025-07-23T16:09:17.127Z","avatar_url":"https://github.com/SpoonX.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Request helpers\nA collection of request helpers. Usable with express js (and consequently, sails.js).\n\n## Installation\n`npm install --save request-helpers`\n\n## Methods\nCurrently only 1.\n\n### secureParameters (params, req|object[, forceCollect = false])\nAllows you to create a `Parameters` instance from the params sent with the request.\nThis method allows you to easily populate the parameters, making sure all required params were sent.\n\n**Note:** This method also supports the use of a simple object in stead of using `req`.\nThis can be useful when you wish to secureParameters from parseCriteria (sails.js).\n\n**Example:**\n\n```javascript\nvar paramBlueprint = [\n  'username',                           // Required\n  'password',                           // Required.\n  {param: 'name', required: false},     // Optional. Default: null\n  {param: 'nickname', default: 'anon'}, // Optional. Default: anon\n  {param: 'enable', cast: 'boolean'}    // Cast value to boolean\n];\n\nvar params = helpers.secureParameters(paramBlueprint, req);\n\nparams.isValid(); // true\nparams.asObject(); // Returns POJO of parameters\nparams.get('key'); // Returns value for parameter `key`\nparams.getMissing(); // Returns an array of missing parameters\nparams.getMissingParameter(); // Returns the first missing parameter.\n\n// With forceCollect (third argument) you tell secureParameters to not stop collecting when it finds a missing parameter.\nDefaults to false.\nparams = helpers.secureParameters(paramBlueprint, req);\n```\n\n## Contributing\nGo for it. Submit a PR, with the tests, and watch the magic.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoonx%2Frequest-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspoonx%2Frequest-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoonx%2Frequest-helpers/lists"}