{"id":27158062,"url":"https://github.com/yhtml5/utils","last_synced_at":"2025-10-24T19:08:39.285Z","repository":{"id":124513254,"uuid":"195817362","full_name":"yhtml5/utils","owner":"yhtml5","description":"A modern JavaScript utility library delivering modularity, performance, \u0026 extras.","archived":false,"fork":false,"pushed_at":"2023-11-24T14:14:11.000Z","size":50,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-29T05:48:34.448Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yhtml5.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}},"created_at":"2019-07-08T13:27:55.000Z","updated_at":"2023-11-05T13:39:12.000Z","dependencies_parsed_at":"2023-11-24T15:28:57.773Z","dependency_job_id":"51579bed-5796-4ded-ae85-77ed81e3c44f","html_url":"https://github.com/yhtml5/utils","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yhtml5/utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhtml5%2Futils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhtml5%2Futils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhtml5%2Futils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhtml5%2Futils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yhtml5","download_url":"https://codeload.github.com/yhtml5/utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhtml5%2Futils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280850244,"owners_count":26401929,"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-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":"2025-04-08T21:54:47.003Z","updated_at":"2025-10-24T19:08:39.253Z","avatar_url":"https://github.com/yhtml5.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Common utils\n\n[![Build Status](https://travis-ci.org/yhtml5/utils.svg?branch=master)](https://travis-ci.org/yhtml5/utils)\n[![Coverage Status](https://coveralls.io/repos/github/yhtml5/utils/badge.svg?branch=master)](https://coveralls.io/github/yhtml5/utils?branch=master)\n\nThis repository contains common utility functions for front-end development.\n\n## isType\n\nThis file exports various functions for type checking. Here are the available functions:\n\n- isUndefined: Checks if the value is undefined.\n- isNull: Checks if the value is null.\n- isNumber: Checks if the value is a number.\n- isString: Checks if the value is a string.\n- isSymbol: Checks if the value is a symbol.\n- isFunction: Checks if the value is a function.\n- isArray: Checks if the value is an array.\n- isArrayEmpty: Checks if the array is empty.\n- isArrayNotEmpty: Checks if the array is not empty.\n- isObject: Checks if the value is an object.\n- isObjectEmpty: Checks if the object is empty.\n\n## formatNumber\n\nThis file exports a function formatNumber(number: number | string, option: Config) that formats a number according to the specified options. The available options are:\n\n- decimals: How many decimal places to keep, default is 0.\n- decPoint: Decimal point symbol, default is '.'.\n- roundtag: Rounding parameter, can be 'ceil' (round up), 'floor' (round down), 'round' (round), default is 'round'.\n- thousandsSep: Thousands separator symbol, default is an empty string.\n- util: How many digits to switch units, default is 10,000.\n\n## formatTime\n\nThis file exports a function formatTime(time: Date, format: string) that formats a date object according to the specified format. The format string can include the following placeholders:\n\n- M+: Month (1-12)\n- D+: Day of the month (1-31)\n- h+: Hour (0-23)\n- m+: Minute (0-59)\n- s+: Second (0-59)\n- q+: Quarter (1-4)\n- S: Milliseconds\n\nThe format string can also include the placeholder y+ for the year. For example, the format string 'yyyy-MM-dd hh:mm:ss' will format the date as '2022-01-01 12:00:00'.\n\n## validator.ts\n\nThis file exports various functions for validating different types of data. Here are the available functions:\n\n- isBankCardNum(str: string): boolean: Checks if the string is a valid bank card number.\n- isChinaName(str: string): boolean: Checks if the string is a valid Chinese name.\n- isChinaPhone(str: string): boolean: Checks if the string is a valid Chinese phone number.\n- isEmail(str: string): boolean: Checks if the string is a valid email address.\n- isIdCard(str: string): boolean: Checks if the string is a valid ID card number.\n- isNum(str: string): boolean: Checks if the string consists of only numbers.\n- isNumSixToTwenty(str: string): boolean: Checks if the string is a valid number with 6 to 20 characters.\n\nPlease refer to the code comments for more details on each function.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyhtml5%2Futils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyhtml5%2Futils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyhtml5%2Futils/lists"}