{"id":22452639,"url":"https://github.com/totaltechgeek/simple-password-rules","last_synced_at":"2025-03-27T12:42:31.295Z","repository":{"id":148359142,"uuid":"493425387","full_name":"TotalTechGeek/simple-password-rules","owner":"TotalTechGeek","description":null,"archived":false,"fork":false,"pushed_at":"2023-04-29T19:00:31.000Z","size":1355,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T17:13:47.146Z","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/TotalTechGeek.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-17T21:56:57.000Z","updated_at":"2022-05-18T00:44:18.000Z","dependencies_parsed_at":"2023-05-13T05:00:29.396Z","dependency_job_id":null,"html_url":"https://github.com/TotalTechGeek/simple-password-rules","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/TotalTechGeek%2Fsimple-password-rules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TotalTechGeek%2Fsimple-password-rules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TotalTechGeek%2Fsimple-password-rules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TotalTechGeek%2Fsimple-password-rules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TotalTechGeek","download_url":"https://codeload.github.com/TotalTechGeek/simple-password-rules/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245850213,"owners_count":20682635,"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-12-06T06:11:56.778Z","updated_at":"2025-03-27T12:42:31.275Z","avatar_url":"https://github.com/TotalTechGeek.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Simple Password Rules\n\n[![Coverage Status](https://coveralls.io/repos/github/TotalTechGeek/simple-password-rules/badge.svg?branch=master)](https://coveralls.io/github/TotalTechGeek/simple-password-rules?branch=master)\n\nHave you ever needed to implement password policies for your codebase? This module attempts to simplify that.\n\n```js\nimport { password, min, max, hasDigit, hasSpecial } from 'simple-password-rules'\n\nconst check = password(\n    min(8),\n    max(16),\n    hasDigit(1),\n    hasSpecial(1)\n)\n\nconst errors = check('password1')\nif (errors) {\n    throw new Error(errors) //  The password provided does not contain enough \"special\" characters. Needs 1 more. \n}\n```\n\n---\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### password\n\nA function to create a password policy.\n\n#### Parameters\n\n* `rules` **...[Array][27]\\\u003cfunction (str: [string][28]): ([string][28] | [undefined][29])\u003e**\n\nReturns **function (str: any): [string][28]** A string if there is an error, undefined otherwise.\n\n### min\n\n#### Parameters\n\n* `num` **[number][30]**\n\nReturns **function (str: any): [string][28]** A string if there is an error, undefined otherwise.\n\n### max\n\n#### Parameters\n\n* `num` **[number][30]**\n\nReturns **function (str: any): [string][28]** A string if there is an error, undefined otherwise.\n\n### has\n\n#### Parameters\n\n* `charSet` **[string][28]** The characters to check for.\n* `num` **[number][30]?** The minimum characters required.\n* `name` **[string][28]?**\n\nReturns **function (str: any): [string][28]** A string if there is an error, undefined otherwise.\n\n### hasLowerCase\n\n#### Parameters\n\n* `num` **[number][30]?** The minimum characters required.\n\nReturns **function (str: any): [string][28]** A string if there is an error, undefined otherwise.\n\n### hasUpperCase\n\n#### Parameters\n\n* `num` **[number][30]?** The minimum characters required.\n\nReturns **function (str: any): [string][28]** A string if there is an error, undefined otherwise.\n\n### hasSpecial\n\n#### Parameters\n\n* `num` **[number][30]?** The minimum characters required.\n\nReturns **function (str: any): [string][28]** A string if there is an error, undefined otherwise.\n\n### hasDigit\n\n#### Parameters\n\n* `num` **[number][30]?** The minimum characters required.\n\nReturns **function (str: any): [string][28]** A string if there is an error, undefined otherwise.\n\n### includes\n\n#### Parameters\n\n* `requiredText` **([string][28] | [Array][27]\u003c[string][28]\u003e)**\n\nReturns **function (str: any): [string][28]** A string if there is an error, undefined otherwise.\n\n### notIncludes\n\n#### Parameters\n\n* `requiredText` **([string][28] | [Array][27]\u003c[string][28]\u003e)**\n* `substitute` **([string][28] | [boolean][31] | function (text: [string][28]): [string][28])?**\n\nReturns **function (str: any): [string][28]** A string if there is an error, undefined otherwise.\n\n### some\n\nChecks if some of the rules were followed, if a number is included at the end, it will check if at least\nthat many rules were followed.\n\n#### Parameters\n\n* `rules` **...[Array][27]\u003c([number][30] | function (str: [string][28]): ([string][28] | [undefined][29]))\u003e**\n\nReturns **function (str: any): [string][28]** A string if there is an error, undefined otherwise.\n\n### not\n\nInverts the result of a rule, allowing you to specify text.\n\n#### Parameters\n\n* `rule` **function (str: [string][28]): [string][28]**\n* `error` **[string][28]**\n\nReturns **function (str: any): [string][28]** A string if there is an error, undefined otherwise.\n\n### template\n\nParses the string template to make it simple to create templates.\n\"$\" is the magic symbol that lets you reference the argument.\nOnly works with template functions with less than 10 arguments,\nand doesn't let you traverse (input to the function should be strings).\n\n#### Parameters\n\n* `stringTemplate` **[string][28]**\n\nReturns **function (...args: [Array][27]\u003c[string][28]\u003e): [string][28]**\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n[27]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array\n\n[28]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String\n\n[29]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined\n\n[30]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number\n\n[31]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftotaltechgeek%2Fsimple-password-rules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftotaltechgeek%2Fsimple-password-rules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftotaltechgeek%2Fsimple-password-rules/lists"}