{"id":37908775,"url":"https://github.com/polyv/fed-common-utils","last_synced_at":"2026-01-16T17:17:20.472Z","repository":{"id":45641550,"uuid":"206262024","full_name":"polyv/fed-common-utils","owner":"polyv","description":"Utility functions of Polyv frontend development.","archived":false,"fork":false,"pushed_at":"2025-12-18T08:19:42.000Z","size":3029,"stargazers_count":4,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-21T15:06:04.497Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/polyv.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-09-04T07:46:20.000Z","updated_at":"2025-12-11T09:22:06.000Z","dependencies_parsed_at":"2024-06-21T16:35:12.801Z","dependency_job_id":"1e4da959-faa1-4b77-86b6-be768866546b","html_url":"https://github.com/polyv/fed-common-utils","commit_stats":{"total_commits":103,"total_committers":2,"mean_commits":51.5,"dds":0.3980582524271845,"last_synced_commit":"13ffdfd1f909c71d284b45c4633de459d19db740"},"previous_names":["polyv/utils"],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/polyv/fed-common-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyv%2Ffed-common-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyv%2Ffed-common-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyv%2Ffed-common-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyv%2Ffed-common-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polyv","download_url":"https://codeload.github.com/polyv/fed-common-utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyv%2Ffed-common-utils/sbom","scorecard":{"id":740586,"data":{"date":"2025-08-11","repo":{"name":"github.com/polyv/fed-common-utils","commit":"636b50b2b67dc37e2fad3614fcc56ebdfc8d350d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":1,"reason":"Found 4/24 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":10,"reason":"26 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'","Warn: branch protection not enabled for branch 'v1-main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 10 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"31 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5","Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp","Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq","Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr","Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765","Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6","Warn: Project is vulnerable to: GHSA-4v9v-hfq4-rm2v","Warn: Project is vulnerable to: GHSA-9jgg-88mc-972h"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T17:19:06.120Z","repository_id":45641550,"created_at":"2025-08-22T17:19:06.120Z","updated_at":"2025-08-22T17:19:06.120Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28480094,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-01-16T17:17:20.388Z","updated_at":"2026-01-16T17:17:20.463Z","avatar_url":"https://github.com/polyv.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# POLYV 工具函数库\n\n本项目提供 Web 前端常用的底层工具函数库，主要用于 POLYV 各类 Web 产品。\n\n## 安装\n\n```\nnpm install @polyv/utils\n```\n\nNPM 包同时提供了 ES 模块以及 CommonJS 模块，分别位于 `es` 和 `cjs` 两个文件夹。它们使用上的区别和优缺点在于：\n\n| 模块类型 | Tree shaking | Babel 编译 |\n| --- | --- | --- |\n| ES 模块 | 有效，只有用到的代码会被打包 | 需要 |\n| CommonJS 模块 | 无效，依赖的文件会被整个打包 | 不需要 |\n\n\n## 使用\n\n### 在基于 Vue.js 框架的项目中使用\n\n以 Vue CLI 3.x 创建的项目为例，编辑 vue.config.js 增加相关配置：\n\n``` javascript\nmodule.exports = {\n  // 省略其他配置\n\n  configureWebpack: {\n    resolve: {\n      alias: {\n        // 配置别名缩短引用路径\n        '@utils': path.resolve(__dirname, './node_modules/@polyv/utils/es')\n      }\n    }\n  },\n\n  // ES 模块需要 Babel 转译\n  transpileDependencies: [\n    '@polyv/utils'\n  ]\n};\n```\n\n在项目代码中引入：\n\n``` javascript\nimport { cutStr } from '@utils/string';\nimport Countdown from '@utils/countdown';\n```\n\n### 在基于 Nuxt.js 框架的项目中使用\n\n以 create-nuxt-app 创建的项目为例，编辑 nuxt.config.js 增加相关配置：\n\n``` javascript\nmodule.exports = {\n  // 省略其他配置\n\n  build: {\n    // ES 模块需要 Babel 转译\n    transpile: [\n      '@polyv/utils'\n    ]\n  },\n\n  extend(config, ctx) {\n    // 配置别名缩短引用路径\n    config.resolve.alias['@utils'] = path.resolve(\n      __dirname, './node_modules/@polyv/utils/es'\n    );\n  }\n};\n```\n\n在项目代码中引入：\n\n``` javascript\nimport { cutStr } from '@utils/string';\nimport { Countdown } from '@utils/countdown';\n```\n\n## 兼容性\n- IE \u003e= 9\n- iOS \u003e= 9 (未测试更低版本)\n- Android \u003e= 5 (未测试更低版本)\n\n## 其他\n- [API 文档（1.x）](https://polyv.github.io/fed-common-utils/1.x/index.html)\n- [API 文档（2.x）](https://polyv.github.io/fed-common-utils/2.x/index.html)\n\n## 2.0.0 版本的变更\n\n2.0.0 与 1.x 相比有较大的变更，如需升级，请参阅下方变更说明：\n\n- 模块变更：\n  - 原 lang 模块已移除，可以使用 [@just4/util](https://www.npmjs.com/package/@just4/util) 或 [lodash-es](https://www.npmjs.com/package/lodash-es) 代替。\n  - 原 browser 模块已移除，可以使用 [@just4/ua-info](https://www.npmjs.com/package/@just4/ua-info) 代替。\n  - 原 cookie 模块已移除，可以使用 [@just4/cookie](https://www.npmjs.com/package/@just4/cookie) 代替。\n  - 原 polling 模块已移除，可以使用 [@just4/polling](https://www.npmjs.com/package/@just4/polling) 代替。\n  - 原 storage 模块已移除，可以使用 [@just4/storage](https://www.npmjs.com/package/@just4/storage) 代替。\n- 部分 API 的变更：\n  - boolean 模块的 `ynToBool` 支持指定默认值。\n  - countdown 模块的 `Countdown` 类增加 `pause` 方法。\n  - string 模块的 `cutStr`、`strLen` 两个方法的选项，不再支持 `mode` 属性。\n  - string 模块新增 `uuidV4` 方法。\n  - validate 模块的 `isPhoneNO` 方法改名为 `isChsPhoneNO`。\n- CommonJS 模块的路径是 `cjs`（原来是 dist），ES 模块的路径是 `es`（原来是 src）。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolyv%2Ffed-common-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolyv%2Ffed-common-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolyv%2Ffed-common-utils/lists"}