@sincerecloud/sc-utils
sc-utils is a tools source
1,190
| Install | |
|---|---|
npm install @sincerecloud/sc-utils |
|
| Latest Version: | 0.0.29 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Mar 13, 2024 |
| Links: | Repository · npm |
Maintainer: peter---sss
@sincerecloud/sc-utils
- 包含HighAxios 类,对axios 二次封装,处理预定状态码
- 常用object处理方法
- 中英翻译查询方法
- 常用正则表达式
安装
npm install axios
npm install @sincerecloud/sc-utils
具体文档请使用 yarn dev 查看
初始化
初始化baseHttp工厂函数
import { HighAxios, getAxios } from '@sincerecloud/sc-utils'
// getAxios 初始化 工厂函数
const baseHttp = getAxios(config)
// or 通过HigAxios 初始化 工厂函数
// const getAxios = HighAxios(config)
// const baseHttp = getAxios(config)
object
查找方法
/**
* @param {Object} obj 对象
* @param {String} prototype 属性名
* @returns Boolean
*/
export const hasOwn = (obj: Object, prototype: string) => {
return Object.hasOwnProperty.call(obj, prototype);
};
/**
* 深度获取对象的值
* @param collection Data source
* @param keyPath Key path array
* @param notSetValue Default value for not found
*/
export const getObjectIn = (collection: Object, keyPath: string[], notSetValue:unknown = null) => {
return keyPath.reduce((rlt: any, keyIndex: string) => {
return (rlt && rlt[keyIndex] ? rlt[keyIndex] : null)
}, collection) || notSetValue
}
Related Packages
vue-axios-cors
This is http client vue.js plugin for cross origin access without preflight. It...
14,521
5
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.0.29 | ^3.2.47 | MIT | |
| 0.0.28 | ^3.2.47 | MIT | |
| 0.0.27 | ^3.2.47 | MIT | |
| 0.0.26 | ^3.2.47 | MIT | |
| 0.0.25 | ^3.2.47 | MIT | |
| 0.0.24 | ^3.2.47 | MIT | |
| 0.0.23 | ^3.2.47 | MIT | |
| 0.0.22 | ^3.2.47 | MIT | |
| 0.0.21 | ^3.2.47 | MIT | |
| 0.0.20 | ^3.2.47 | MIT | |
| 0.0.19 | ^3.2.47 | MIT | |
| 0.0.18 | ^3.2.47 | MIT | |
| 0.0.17 | ^3.2.47 | MIT | |
| 0.0.16 | ^3.2.47 | MIT | |
| 0.0.15 | ^3.2.47 | MIT | |
| 0.0.14 | ^3.2.47 | MIT | |
| 0.0.13 | ^3.2.47 | MIT | |
| 0.0.12 | ^3.2.47 | MIT | |
| 0.0.11 | ^3.2.47 | MIT | |
| 0.0.10 | ^3.2.47 | MIT | |
| 0.0.9 | ^3.2.47 | MIT | |
| 0.0.8 | ^3.2.47 | MIT | |
| 0.0.7 | ^3.2.47 | MIT | |
| 0.0.6 | ^3.2.47 | MIT | |
| 0.0.5 | ^3.2.47 | MIT | |
| 0.0.4 | ^3.2.47 | MIT | |
| 0.0.3 | ^3.2.47 | MIT | |
| 0.0.2 | ^3.2.47 | MIT | |
| 0.0.1 | ^3.2.47 | MIT |