open-index/open-npm huggingface dataset:
npm package: @lawrence_ch/cloud-utils
Description: A collection of utils
Author: lawrence_ch
Latest version: 0.0.5

# [cloud-utils](https://github.com/lawrence998/cloud-utils)
[![](https://img.shields.io/badge/Powered%20by-cloud--utils-brightgreen.svg)](https://github.com/lawrence998/cloud-utils)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/yanhaijing/jslib-base/blob/master/LICENSE)
[![Build Status](https://travis-ci.org/cklwblove/cloud-utils.svg?branch=master)](https://travis-ci.org/lawrence998/cloud-utils)
[![npm](https://img.shields.io/badge/npm-0.1.0-orange.svg)](https://www.npmjs.com/package/@lawrence_ch/cloud-utils)
[![NPM downloads](http://img.shields.io/npm/dm/cloud-utils.svg?style=flat-square)](http://www.npmtrends.com/@lawrence998/cloud-utils)
[![Coverage Status](https://coveralls.io/repos/github/cklwblove/cloud-utils/badge.svg)](https://coveralls.io/github/lawrence998/cloud-utils)
[![Percentage of issues still open](http://isitmaintained.com/badge/open/cklwblove/cloud-utils.svg)](http://isitmaintained.com/project/lawrence998/cloud-utils "Percentage of issues still open")

常用的 Javascript 工具类方法集合

## 目录介绍

```
.
├── example 使用example
├── dist 编译产出代码
├── docs 项目文档
├── src 源代码目录
├── test 单元测试
├── CHANGELOG.md 变更日志
```

## 如何使用
通过 npm 下载安装代码

```bash
$ npm install --save @lawrence_ch/cloud-utils
```

如果你是 node 环境

```js
var { formatDate } = require('@lawrence_ch/cloud-utils.common');
```

如果你是 webpack 等环境

```js
import { formatDate } from '@lawrence_ch/cloud-utils.esm';
```

如果你是 requirejs 环境

```js
requirejs(['node_modules/@lawrence_ch/cloud-utils/dist/cloud-utils.js'], function (utils) {
    var formatDate = utils.formatDate;
})
```

如果你是浏览器环境

```html
<script src="node_modules/@lawrence_ch/cloud-utils/dist/cloud-utils.min.js"></script>

<script>
    var utils = window['cloud-utils'];
</script>
```

## 文档
[API](https://lawrence998.github.io/cloud-utils/)

## 贡献指南
首次运行需要先安装依赖

```bash
$ npm install
```
开发调试（利用 [rollup-watch](https://github.com/rollup/rollup-watch) ，自动监测源码变更，生成 `dist/cloud-utils.js`）
,在 `src/core` 添加相应的 `**.js` 文件，然后在 `src/main.js` 引用

```bash
$ npm run dev
```

添加测试用例

在 `src/test` 添加相应的测试用例文件， 命名遵循于 `**.spec.js` 规范

一键打包生成生产代码

```bash
$ npm run build
```

运行单元测试，浏览器环境需要手动测试，位于`test/browser`

```bash
$ npm test
```

修改 `package.json` 中的版本号，然后发布新版

```bash
$ npm run release
```
npm package: @lawrence_ch/parse-size-with-unit
Description: A helper to parse 'size like' value into a valid size with unit.
Latest version: 1.0.1

# parse-size-with-unit

A helper to parse 'size like' value into a valid size with unit.

## Install

```bash
yarn add @lawrence_ch/parse-size-with-unit

# or

npm install --save @lawrence_ch/parse-size-with-unit
```

## Usage

```js
import parseSize from '@lawrence_ch/parse-size-with-unit'

parseSize(50) // '50px'
parseSize('50') // '50px'
parseSize('50px') // '50px'
parseSize('50%') // '50%'
parseSize('50.5px') // '50.5px'
parseSize('50.5%') // '50.5%'
parseSize('a') // null

// Default unit. Supports all CSS valid unit.
parseSize(50, 'em') // '50em'
```
npm package: @lawrence_ch/stylelint-config-win
Description: CSS Style guide for lawrence_ch
Author: lawrence_ch
Latest version: 0.1.7

# stylelint-config-win

团队内部的stylelint配置


## 安装

```shell
yarn add @lawrence_ch/stylelint-config-win -D
```  

##  依赖版本
```bash
stylelint ^13.6.1
```
*Tips*：如果项目中没有安装此依赖包或者版本不一致，请安装或者升级。 

## 使用

- 在你的项目的根目录下创建一个 `stylelint.config.js` 文件，并将以下内容复制进去：

```javascript
{
  extends: "@lawrence_ch/stylelint-config-win"
}
``` 

- 项目目录下的 `package.json` 添加检测指令，举个例子

```diff
{
 ...
 "scripts": {
+    "lint:style": "stylelint \"src/**/*.{vue,less,postcss,css,scss}\" --fix --cache --cache-location node_modules/.cache/stylelint/",
 }
 ...
}
``` 

## 引用

- [https://stylelint.io/](https://stylelint.io/)
- [http://stylelint.cn/user-guide/rules/](http://stylelint.cn/user-guide/rules/)
- [stylelint-config-moresec](https://github.com/MoresecFE/stylelint-config-moresec)
- [css-order](https://github.com/cklwblove/note-css-order)


## 环境

> Node.js >= 8

> stylelint >= 13.5.0
npm package: @lawrence_ch/vue-cli-plugin-eslint
Description: eslint plugin for vue-cli
Author: lawrence_ch
Latest version: 1.0.0

# @lawrence_chvue-cli-plugin-eslint

> ESLint plugin for vue-cli

## Injected commands

- **`vue-cli-service lint`**

  ```
  Usage: vue-cli-service lint [options] [...files]

  Options:

    --format [formatter] specify formatter (default: codeframe)
    --no-fix             do not fix errors
  ```

  Lints and fixes files. If no specific files are given, it lints all files in `src` and `test`.

  Other [ESLint CLI options](https://eslint.org/docs/user-guide/command-line-interface#options) are also supported.

## Configuration (.eslintrc.*)

Lint-on-save during development with `eslint-loader` can be enabled with the `lintOnSave` option in `vue.config.js`:

``` js
module.exports = {
  // ...
  lintOnSave: true,
}
```

## Installing in an already created project

``` sh
npm install -D @lawrence_ch/vue-cli-plugin-eslint
vue invoke @lawrence_ch/vue-cli-plugin-eslint
```

> There is also a shorthand to invoke the plugin  
> `vue invoke @lawrence_ch/eslint`  

## Injected webpack-chain rules

- `config.rule('eslint')`
- `config.rule('eslint').use('eslint-loader')`
npm package: @lawrence_ch/vue-cli-plugin-stylelint
Description: stylelint plugin for vue-cli
Author: lawrence_ch
Latest version: 1.0.0

# @lawrence_ch/vue-cli-plugin-stylelint

> stylelint plugin for vue-cli

## Injected commands

- **`vue-cli-service lint:style`**

  ```
  Usage: vue-cli-service lint:style [options] [...files]

  Options:

    --no-fix           do not auto-fix errors
    --options          list additional stylelint cli options
  ```

  Lints and fixes files. If no specific files are given, it lints all vue files, html files, and stylesheets in `src`.

## Configuration (vue.config.js, "vue" in package.json)

Lint on (re)build with `stylelint-webpack-plugin` can be enabled with the `lintStyleOnBuild` option. You can also provide additional options to stylelint. See available options on the stylelint [website](https://stylelint.io/user-guide/node-api/#options).

``` js
module.exports = {
  // ...
  pluginOptions: {
    lintStyleOnBuild: true,
    stylelint: {
      fix: true, // boolean (default: true)
      files: '', // string | [string] (default: ['src/**/*.{vue,htm,html,css,sss,less,scss}'])
      // See https://stylelint.io/developer-guide/formatters/
      formatter: () => {} // function (default: require('stylelint-codeframe-formatter'))
      // etc...
    }
  }
}
```

## Installing in an already created project

```
npm install -D @lawrence_ch/vue-cli-plugin-stylelint
vue invoke @lawrence_ch/vue-cli-plugin-stylelint
```

> There is also a shorthand to invoke the plugin  
> `vue invoke @lawrence_ch/stylelint`

## webpack-chain Injections

- `config.plugin('stylelint')`
- `config.plugin('stylelint').use('stylelint-webpack-plugin')`
- `config.plugin('friendly-errors').tap(/* Adds additional transformer and formatter */)`
npm package: @lawrence_ch/vue-listview
Description: [![Build Status](https://travis-ci.org/laomao800/vue-listview.svg?branch=master)](https://travis-ci.org/laomao800/vue-listview) [![codecov](https://codecov.io/gh/laomao800/vue-listview/branch/master/graph/badge.svg)](https://codecov.io/gh/laomao800/vue-l
Author: lawrence_ch
Latest version: 1.0.2

# Vue Listview

[![Build Status](https://travis-ci.org/laomao800/vue-listview.svg?branch=master)](https://travis-ci.org/laomao800/vue-listview)
[![codecov](https://codecov.io/gh/laomao800/vue-listview/branch/master/graph/badge.svg)](https://codecov.io/gh/laomao800/vue-listview)
[![npm](https://img.shields.io/npm/v/@laomao800/vue-listview.svg)](https://www.npmjs.com/package/@laomao800/vue-listview)

Vue Listview 是一个基于 [Vue.js](https://cn.vuejs.org/) 和 [Element-UI](http://element.eleme.io/) ，可用于生成列表类的页面布局组件。

界面预览：

![预览](./docs/preview.png)

默认为表格类列表页，也可通过 [Slot](/dev/slots.md) 实现自定义列表布局。

## 文档 & Demo

- 文档： <https://lawrence998.github.io/vue-listview/>
- Demo： <https://lawrence998.github.io/vue-listview/demo/layout/all.html>

## 安装

```bash
yarn add @lawrence_ch/vue-listview element-ui

# OR

npm i -S @lawrence_ch/vue-listview element-ui
```

**Element-UI 作为 peerDependencies 需要同步安装。**

## 使用

### 全局注册

可以传入配置对象，用于全局配置 listview 。一般可用于项目接口与默认结构不同的场景，通过全局配置可不用在每个页面内重复写诸如 `validateResponse` 等“项目内通用”的配置。

支持全局配置：

- `validateResponse`
- `resolveResponseErrorMessage`
- `transformRequestData`
- `transformResponseData`
- `contentDataMap`

```js
// main.js
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import Listview from '@lawrence_ch/vue-listview'

Vue.use(ElementUI)
Vue.use(Listview)
/*
Vue.use(Listview, {
  validateResponse: response => response.different_success_status,
  resolveResponseErrorMessage: () => 'global config error',
  transformRequestData: requestData => {
    requestData.addon = 'requestAddon'
    return requestData
  },
  transformResponseData: response => {
    response.addon = 'responseAddon'
    return response
  },
  contentDataMap: {
    addon: 'addon',
    items: 'result.items',
    total: 'result.total_count'
  }
})
*/
```

### 局部注册

```vue
<template>
  <listview />
</template>

<script>
// import Vue from 'vue'
import Listview from '@lawrence_ch/vue-listview'

/*
Vue.prototype.$LISTVIEW = {
  contentDataMap: {
    addon: 'addon',
    items: 'result.items',
    total: 'result.total_count'
  },
  // ...
}
*/

export default {
  components: {
    Listview
  }
}
</script>
```

### UMD

演示： [jsfiddle](https://jsfiddle.net/laomao800/92Lvg1rn/4/)

```html
<div id="app">
  <listview />
</div>

<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/@laomao800/vue-listview/dist/listview.umd.min.js"></script>
<script>
new Vue().$mount('#app')
</script>
```