{"id":19974417,"url":"https://github.com/alanchenchen/utillist","last_synced_at":"2025-05-04T02:32:40.515Z","repository":{"id":57389023,"uuid":"152211930","full_name":"alanchenchen/utilList","owner":"alanchenchen","description":"Several util modules to optimise your project","archived":false,"fork":false,"pushed_at":"2018-12-25T06:19:44.000Z","size":88,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-20T15:50:33.236Z","etag":null,"topics":["arrayextend","dateformat","eventbus","vuejs2"],"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/alanchenchen.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}},"created_at":"2018-10-09T08:02:58.000Z","updated_at":"2019-03-19T02:33:37.000Z","dependencies_parsed_at":"2022-09-26T16:50:59.178Z","dependency_job_id":null,"html_url":"https://github.com/alanchenchen/utilList","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/alanchenchen%2FutilList","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanchenchen%2FutilList/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanchenchen%2FutilList/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanchenchen%2FutilList/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alanchenchen","download_url":"https://codeload.github.com/alanchenchen/utilList/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252279073,"owners_count":21722833,"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":["arrayextend","dateformat","eventbus","vuejs2"],"created_at":"2024-11-13T03:14:57.876Z","updated_at":"2025-05-04T02:32:40.230Z","avatar_url":"https://github.com/alanchenchen.png","language":"JavaScript","readme":"# utilList\n\n![](https://img.shields.io/npm/v/util-list.svg)\n![](https://img.shields.io/npm/dt/util-list.svg)\n![](https://img.shields.io/github/license/alanchenchen/utilList.svg)\n\nSeveral util modules to optimise your project\n\u003e Author：Alan Chen\n\n\u003e E-mail: 739709491@qq.com\n\n\u003e version: 0.0.4\n\n\u003e date: 2018/12/25\n\n\n## Feature\n* 包含DateFormat、EventBus、ArrayDel、Equal和InjectVue五个方法。\n* DateFormat是个极简的用于日期对象格式化字符串工具，如果需要Date原型链扩展请使用[moment.js](https://github.com/moment/moment)。\n* EventBus是只适用于vue插件的工具，简化了官网推荐的event bus，用于跨组件传递事件。\n* ArrayDel扩展了Array原生的splice，更加符合大部分删除数组元素的使用场景。\n* Equal是个极简的用于判断变量是否严格相等工具，如果需要全数据类型比较，请使用[lodash](https://github.com/lodash/lodash)。\n* 提供一个InjectVue工具，可以快速包装原生js方法，转换成vue插件的对象。\n\n## Component doc\n* [DateFormat](docs/DateFormat.md)\n* [EventBus](docs/EventBus.md)\n* [ArrayDel](docs/ArrayDel.md)\n* [Equal](docs/Equal.md)\n\n## Usage\n* `yarn add util-list` or `npm install util-list --save` 安装npm包\n* import引入\n    ```js\n        import utilList from 'util-list' // 全部引入\n        import { DateFormat, EventBus, ArrayDel, Equal, InjectVue } from 'util-list' // 单个引入\n\n        DateFormat() // 原生js方法使用\n\n        import Vue from 'vue' // 作为vue插件使用\n        const DateUtil = InjectVue(DateFormat)\n        Vue.use(DateUtil)\n    ```\n* `InjectVue`方法提供第2个参数可选，默认为空，当提供第二个参数时，挂在`vue.prototype`上的方法名会被重置。例如: \n    ```js\n        // main.js\n        import Vue from 'vue'\n\n        import { DateFormat, InjectVue } from 'util-list' \n        const DateUtil = InjectVue(DateFormat, 'format')\n        Vue.use(DateUtil)\n\n        // example.vue\n        export default {\n            created() {\n                this.$_format('yy-MM-dd') // 方法名被重置为$_format\n            }\n        }\n    ```\n## Attentions\n1. 模块导出的均为原生js方法(除EventBus以外)，如果想在vue中`Vue.use()`使用，必须先用`InjectVue()`。\n2. EventBus是vue插件，只能在vue中`Vue.use()`使用。\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falanchenchen%2Futillist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falanchenchen%2Futillist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falanchenchen%2Futillist/lists"}