{"id":18596989,"url":"https://github.com/focusaurus/joi-summarize","last_synced_at":"2025-05-16T13:33:10.137Z","repository":{"id":57281457,"uuid":"70092029","full_name":"focusaurus/joi-summarize","owner":"focusaurus","description":"Summarize joi validation compound errors into a string","archived":false,"fork":false,"pushed_at":"2016-12-16T17:57:07.000Z","size":5,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T18:02:54.725Z","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/focusaurus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-10-05T19:27:32.000Z","updated_at":"2016-12-16T17:57:08.000Z","dependencies_parsed_at":"2022-09-19T22:14:49.056Z","dependency_job_id":null,"html_url":"https://github.com/focusaurus/joi-summarize","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/focusaurus%2Fjoi-summarize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/focusaurus%2Fjoi-summarize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/focusaurus%2Fjoi-summarize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/focusaurus%2Fjoi-summarize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/focusaurus","download_url":"https://codeload.github.com/focusaurus/joi-summarize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254538477,"owners_count":22087870,"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":[],"created_at":"2024-11-07T01:26:33.178Z","updated_at":"2025-05-16T13:33:10.117Z","avatar_url":"https://github.com/focusaurus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# joi summarize\n\nCombine error messages from a joi error into a summary string.\n\n- Designed to work with joi `result.error` objects created with joi's `abortEarly: false` option\n\n## How to Install\n\n`npm install --save joi-summarize`\n\n## How to Use in node.js\n\n```js\n'use strict'\nconst joi = require('joi')\nconst summarize = require('joi-summarize')\n\nconst badInput = {\n  age: -2,\n  name: 42\n}\nconst schema = joi.object().keys({\n  age: joi.number().integer().min(0),\n  name: joi.string()\n})\nconst result = schema.validate(badInput, {abortEarly: false})\nconsole.log(summarize(result.error))\n/* That will log:\nInvalid input.\n\"age\" must be larger than or equal to 0.\n\"name\" must be a string.\n*/\n\n\n// To customize the first line message, pass as 2nd argument\nconsole.log(summarize(result.error, 'Unacceptable data'))\n/* That will log:\nUnacceptable data.\n\"age\" must be larger than or equal to 0.\n\"name\" must be a string.\n*/\n```\n\n# Invalid arguments\n\n- If you call `summarize` with `null` or `undefined`, it returns `undefined`\n- If you call `summarize` with any other non-object, it throws a `TypeError`\n\n# How to Run Tests\n\n- **Initial setup**\n  - git clone this repository\n  - `npm install`\n- `npm run test` runs unit tests, coverage checks, eslint\n- `npm run test-unit` runs unit tests only\n- `npm run coverage` runs nyc/istanbul code coverage and opens the report\n- `npm run lint` runs eslint static analysis\n\n## Stinking Badges\n![](https://img.shields.io/npm/v/joi-summarize.svg)\n[![Build Status](https://semaphoreci.com/api/v1/focusaurus/joi-summarize/branches/master/badge.svg)](https://semaphoreci.com/focusaurus/joi-summarize)\n[![npm](https://img.shields.io/npm/l/joi-summarize.svg?maxAge=2592000)]()\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n\n# License: MIT\n\nSee [LICENSE]()\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffocusaurus%2Fjoi-summarize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffocusaurus%2Fjoi-summarize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffocusaurus%2Fjoi-summarize/lists"}