{"id":28248685,"url":"https://github.com/lexriver/string-methods","last_synced_at":"2025-06-16T02:39:36.315Z","repository":{"id":102683098,"uuid":"318236708","full_name":"LexRiver/string-methods","owner":"LexRiver","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-25T17:13:27.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-13T10:48:21.054Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/LexRiver.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-12-03T15:27:39.000Z","updated_at":"2024-09-25T17:13:30.000Z","dependencies_parsed_at":"2025-06-13T10:35:07.507Z","dependency_job_id":"34ea30ca-c8d2-4d6e-a18e-890d9324bc07","html_url":"https://github.com/LexRiver/string-methods","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LexRiver/string-methods","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LexRiver%2Fstring-methods","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LexRiver%2Fstring-methods/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LexRiver%2Fstring-methods/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LexRiver%2Fstring-methods/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LexRiver","download_url":"https://codeload.github.com/LexRiver/string-methods/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LexRiver%2Fstring-methods/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260087870,"owners_count":22956984,"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":"2025-05-19T12:16:48.402Z","updated_at":"2025-06-16T02:39:36.309Z","avatar_url":"https://github.com/LexRiver.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# StringMethods\n\nFew methods for working with strings\n\n## Install\n\n```\nnpm install @lexriver/string-methods\n```\n\n## Import\n\n``` typescript\nimport {StringMethods} from '@lexriver/string-methods'\nimport {StringMethods, LocaleSettings} from '@lexriver/string-methods'\n```\n\n## Methods\n\n### `StringMethods.isDigits(x:string):boolean`\n\nChecks if string contains only digits: 0123456790\n\n``` typescript\nStringMethods.isDigits('345') // true\n```\n\n\u003cbr/\u003e\n\n### `StringMethods.isValidEmail(x:any):boolean`\n\nSimple check if string contains some text before @ and at least one dot and text after dot after @\n\n``` typescript\nStringMethods.isValidEmail('test@me.pls') // true\n```\n\n\u003cbr/\u003e\n\n### `StringMethods.getSimpleHash(value:string):number`\n\nGet simple fast hash of a string\nhttps://stackoverflow.com/questions/6122571/simple-non-secure-hash-function-for-javascript\n\n``` typescript\nStringMethods.getSimpleHash('test') === StringMethods.getSimpleHash('test') // true\nStringMethods.getSimpleHash('test') === StringMethods.getSimpleHash('tset') // false\n```\n\n\u003cbr/\u003e\n\n### `StringMethods.formatPluralNumber(p)`\n\nGet a nice string for plural number.\n\nArguments\n\n```typescript\n    StringMethods.formatPluralNumber(p:{\n        number: number,\n         settings: { // StringMethods.LocaleSettings type\n            locale?:string, \n            ifZero:(x:number)=\u003eany, \n            ifOne:(x:number)=\u003eany,\n            ifFew:(x:number)=\u003eany,\n            ifMany:(x:number)=\u003eany\n        }\n    }\n```\n\nExample\n\n```typescript\n    let settings:StringMethods.LocaleSettings = {\n        locale:'ru',\n        ifZero:(x) =\u003e `товары не найдены`,\n        ifOne:(x) =\u003e `${x} товар`,\n        ifFew:(x) =\u003e `${x} товара`,\n        ifMany:(x) =\u003e `${x} товаров`\n   }\n\n   StringMethods.formatPluralNumber({ number: 33, settings })) // 33 товара\n\n```\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flexriver%2Fstring-methods","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flexriver%2Fstring-methods","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flexriver%2Fstring-methods/lists"}