# @ossso/utils

> 一些前端开发过程中常用方法工具包

Latest version **1.2.1** (published 2024-07-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ossso/utils
pnpm add @ossso/utils
yarn add @ossso/utils
bun add @ossso/utils
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2024-07-10 |
| First published | 2022-03-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 151.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | 橙色阳光 |
| Maintainers | inull |

## Links

- npm: https://www.npmjs.com/package/@ossso/utils
- Repository: https://github.com/ossso/es-utils
- Issues: https://github.com/ossso/es-utils/issues
- npm.io page: https://npm.io/package/@ossso/utils

## Recent versions

- 1.2.1 (latest) — 2024-07-10
- 1.2.0 (next) — 2024-07-09
- 1.0.2 (dev) — 2022-03-11
- 1.1.0 — 2024-01-10
- 1.0.4 — 2022-03-14
- 1.0.3 — 2022-03-14
- 1.0.1 — 2022-03-11
- 1.0.0 — 2022-03-11

## README

# 常用工具

## 简介
`@ossso/utils` 是一个常用工具库，提供了一些实用的工具函数，旨在简化日常开发中的常见任务。

## 安装
你可以使用 npm 或 yarn 进行安装：
```bash
npm install @ossso/utils
# 或者
yarn add @ossso/utils
```

## 使用方法

### 导入模块
你可以根据需要导入整个模块或单个工具函数：
```javascript
// 导入整个模块
import * as utils from '@ossso/utils';

// 导入单个工具函数
import { Mapping } from '@ossso/utils';
```

### 示例
以下是一些使用示例：

#### Mapping 类
`Mapping` 类提供了一些用于对象属性映射和获取的方法。

##### mapping 方法
根据给定的键路径从对象中获取值。
```javascript
const obj = { a: { b: { c: 42 } } };
const value = Mapping.mapping(obj, 'a.b.c'); // 返回 42
```

##### get 方法
从对象或数组中获取指定键的值。
```javascript
const obj = { a: [ { b: 42 } ] };
const value = Mapping.get(obj, 'a[0].b'); // 返回 42
```

##### each 方法
根据键映射对象从数据对象中提取值并组装成新的对象。
```javascript
const keys = { x: 'a.b.c', y: 'd.e' };
const data = { a: { b: { c: 42 } }, d: { e: 24 } };
const result = Mapping.each(keys, data); // 返回 { x: 42, y: 24 }
```

[使用说明](https://github.com/ossso/es-utils/tree/master/docs/)

## 许可证
本项目基于 MIT 许可证开源。

## 相关链接
- [仓库地址](https://github.com/ossso/es-utils)
- [问题反馈](https://github.com/ossso/es-utils/issues)
- [主页](https://github.com/ossso/es-utils)

---
_Source: https://npm.io/package/@ossso/utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
