# 1-liners 中文文档

规范地址：https://npmcn.com/package/1-liners/

版本：0\.4\.2
npm 元数据更新时间：2022-06-12T14:05:21.084Z
中文译文更新时间：2026-11-06T08:05:37.660Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/1-liners
原文对照：https://npmcn.com/package/1-liners/?lang=original
项目主页：https://github.com/1-liners/1-liners#readme
源码仓库：https://github.com/1-liners/1-liners

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：152 kB，277 个文件
- TypeScript 类型：未声明
- Node.js 要求：\>=0\.10\.0
- 运行依赖：0 个
- 首次发布：2015-04-19T15:11:38.595Z
- 最新版本发布：2019-06-27T07:38:44.720Z
- 近 30 天下载量：3983（2026-10-04 至 2026-11-02，npm 官方下载统计）
- 已发布版本数：31（近 12 个月 0 个）

## 中文简介

有用的单线和短手函数

## 安装

```sh
npm install 1-liners
```

也可以使用：`pnpm add 1-liners`、`yarn add 1-liners`、`bun add 1-liners`

## README

在瑞士制造

[![Coverage Status](https://coveralls.io/repos/1-liners/1-liners/badge.svg?branch=master)](https://coveralls.io/r/1-liners/1-liners?branch=master) [![Build Status](https://travis-ci.org/1-liners/1-liners.svg?branch=master)](https://travis-ci.org/1-liners/1-liners) [![Dependency Status](https://david-dm.org/1-liners/1-liners.svg)](https://david-dm.org/1-liners/1-liners) [![npm version](https://badge.fury.io/js/1-liners.svg)](http://badge.fury.io/js/1-liners) [![Stability: unstable](https://img.shields.io/badge/stability-unstable-yellowgreen.svg)](https://github.com/1-liners/1-liners/milestones/1.0) [![Join the chat at https://gitter.im/1-liners/1-liners](https://img.shields.io/badge/gitter-join%20chat-1dce73.svg)](https://gitter.im/1-liners/1-liners)

# [  
  
  
![1-liners](https://cdn.rawgit.com/1-liners/Logos/master/logo.png)  
  
  
  
](https://npmcn.com/package/1-liners/documentation/README.md "Functional tools that couldn’t be simpler")

**无法简单化的功能工具.**

我们自豪地呈现 _1行线_ – 一个枯萎的简单功能效用带. **[137个单线函数](https://npmcn.com/package/1-liners/documentation)** (并计. 每一个手工制作的,都有爱和关注.

  
  
  
![](https://cdn.rawgit.com/1-liners/Logos/master/swissknife.gif)  
  
  
  
  
  

## 我们的十诫

你得到一个产品 最高质量的功能 编程技巧。 每个函数都遵循 _儿童状况_ 我们把原则分成十条严格的规则.

我们总是跟着他们 我们保证.

[  
  
![1-liners](https://cdn.rawgit.com/1-liners/Logos/04c6949/megaphone.svg)  
  
  
](https://www.elegantthemes.com/blog/freebie-of-the-week/beautiful-flat-icons-for-free "from Beautiful Flat Icons by Nick Roach")

1.  每项职能均应 **[装入可读行码](https://github.com/1-liners/1-liners/blob/28b02d0939d6bb4034693e48440f450141453ae9/module/flip.js#L18)**  
    – 从源头看一看,你完全知道发生了什么.  
     
    
2.  每项职能均应 **[没有副作用](https://npmcn.com/package/1-liners/documentation#extend)**  
    \- 你可以自信地使用它.  
     
    
3.  每项职能均应 **[有固定的参数](https://npmcn.com/package/1-liners/documentation#shave)**  
    — — 很容易被捆绑、咖喱和快活、部分施放、爆炸和爆炸.  
     
    
4.  每项职能均应 **[以不可改变的方式处理数据](https://npmcn.com/package/1-liners/documentation#put)**  
    \-不再做恶梦了.  
     
    
5.  每项职能均应 **[将数据作为最后一个参数](https://npmcn.com/package/1-liners/documentation#split)**  
    \- 这使得咖喱和编织新功能成为微风.  
     
    
6.  每项职能均应 **[在一个单独的微模块中](https://github.com/1-liners/1-liners/blob/28b02d0939d6bb4034693e48440f450141453ae9/module/compose.js)**  
    \-你只装入/捆绑你需要的单一线车.  
     
    
7.  每项职能均应 **[进行彻底测试](https://coveralls.io/r/1-liners/1-liners?branch=master)**  
    \- 100%的密码覆盖率得到保障。 我们甚至测试每个功能是否适合一行!  
     
    
8.  每项职能均应 **[有大量的文档](https://npmcn.com/package/1-liners/documentation)**  
    – 文档解释用法, 呈现出来源, 并与规格链接 .  
     
    
9.  我们将提供以下功能版本: **[本地对象方法](https://npmcn.com/package/1-liners/documentation#reduce)**  
    \- 喜欢 `reduce(callback, array)` 页:1 `array.reduce(callback)`。 。 。 .  
     
    
10.  我们将提供以下功能版本: **[语言构造](https://npmcn.com/package/1-liners/documentation#plus)**  
     \- 喜欢 `plus(a, b)` 页:1 `a + b`。 。 。 .  
      
     

## 使用量

### 安装

```
$ npm install --save 1-liners
```

### ES5使用率

```js
// The lightweight, recommended way:
var map = require('1-liners/map');

// Sometimes practical:
var map = require('1-liners').map;
```

### ES 2015的用法(原ES 6)

```js
// The lightweight, recommended way:
import map from '1-liners/module/map';

// Sometimes practical:
import { map, filter } from '1-liners/module';
```

## API 密码

检查 [文档](https://npmcn.com/package/1-liners/documentation)

## 维护者

| [![stoeffel](https://avatars.githubusercontent.com/u/1217681?v=3&s=80)](https://github.com/stoeffel) | [![tomekwi](https://avatars.githubusercontent.com/u/4624660?v=3&s=80)](https://github.com/tomekwi) | [![hemanth](https://avatars.githubusercontent.com/u/18315?v=3&s=80)](https://github.com/hemanth) |
| :-: | :-: | :-: |
| [缩写](https://github.com/stoeffel) | [托梅克维](https://github.com/tomekwi) | [汉斯](https://github.com/hemanth) |

| [![davidchase](https://avatars.githubusercontent.com/u/490291?v=3&s=80)](https://github.com/davidchase) | [![tristaaan](https://avatars.githubusercontent.com/u/5470619?v=3&s=80)](https://github.com/tristaaan) |
| :-: | :-: |
| [达维查斯](https://github.com/davidchase) | [三分卫](https://github.com/tristaaan) |

创建于 [gh-贡献者表](https://github.com/stoeffel/gh-contributors-table)

## 许可证

麻省理工学院 [缩写](http://schtoeffel.ch/) [托梅克维](http://github.com/tomekwi) [汉斯](http://www.h3manth.com/) [达维查斯](http://github.com/davidchase) [三分卫](http://github.com/tristaaan)

## 常见问题

### 1-liners 是什么？

有用的单线和短手函数

### 如何安装 1-liners？

在项目目录运行 npm install 1-liners，或使用 pnpm add / yarn add / bun add。

### 1-liners 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/1-liners 是否存在。

### 1-liners 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=0\.10\.0。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### 1-liners 可以商用吗？

1-liners 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### 1-liners 的下载量有多少？

根据 npm 官方下载统计，1-liners 在 2026/10/04 – 2026/11/02 这 30 天内被下载 3,983 次，日均约 133 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### 1-liners 还在维护吗？

最新版本 0\.4\.2 发布于 2019/06/27（7 年前）；至今共发布 31 个版本，其中过去 12 个月发布了 0 个；首次发布于 2015/04/19。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

