1loc 中文文档教程
1Loc Lib
机智的 Javascript 单行函数库。 1loc.dev 网站有一组有用的 Javascript 单行代码,现在您可以在 Javascript 项目中使用它们。
One Liners 很棒,但您团队的其他成员会更清楚一点,因此我们为您抽象了它们,作为可读的函数名称,这样您和您的团队成员就可以专注于重要的事情。
TOC
- 1Loc Lib
- TOC
- Coverage
- Getting Started
- Import Any One-liner and use
- Explore a list of possible One-liners
- One Liners
Coverage
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
---|---|---|---|---|---|
All files | 99.12 | 75.68 | 98.61 | 100 | |
array.ts | 100 | 87.5 | 100 | 100 | 8,183,214 |
dom.ts | 94.44 | 53.85 | 88.89 | 100 | 16-61 |
Getting Started
安装 1Loc 库
yarn add 1loc
使用 yarn
或 npm
或使用 npm
npm i 1loc --save
Import Any One-liner and use
import { cloneArray } from '1loc'
const myArray = [{ name: 'me', age: 2}]
const arrayClone = cloneArray(myArray) // [{ name: 'me', age: 2}]
More Examples
import { arrayHasSameValues } from '1loc'
const hasSameValues = arrayHasSameValues([1, 2, 4], [4, 1, 2])
console.log(hasSameValues) // true
Explore a list of possible One-liners
您还可以在此处访问原始的 1loc 网站。
One Liners
这是函数定义及其作用的集合。
1Loc Lib
A library of witty Javascript one-liner functions. The 1loc.dev website has a collection of useful Javascript one-liners, now you get to use them in your Javascript projects.
One Liners are great, but the rest of your team would appreciate a little more clarity, So we've abstracted them for you, as readeable function names, so you and your teammates can focus on important stuff.
TOC
- 1Loc Lib
- TOC
- Coverage
- Getting Started
- Import Any One-liner and use
- Explore a list of possible One-liners
- One Liners
Coverage
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
---|---|---|---|---|---|
All files | 99.12 | 75.68 | 98.61 | 100 | |
array.ts | 100 | 87.5 | 100 | 100 | 8,183,214 |
dom.ts | 94.44 | 53.85 | 88.89 | 100 | 16-61 |
Getting Started
Install the 1Loc library using yarn
or npm
yarn add 1loc
or using npm
npm i 1loc --save
Import Any One-liner and use
import { cloneArray } from '1loc'
const myArray = [{ name: 'me', age: 2}]
const arrayClone = cloneArray(myArray) // [{ name: 'me', age: 2}]
More Examples
import { arrayHasSameValues } from '1loc'
const hasSameValues = arrayHasSameValues([1, 2, 4], [4, 1, 2])
console.log(hasSameValues) // true
Explore a list of possible One-liners
You can also visit the original 1loc website here.
One Liners
Here's a collection of function definitions and what they do.