mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-17 04:31:22 +08:00
Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
e251179751 | |||
bf114d2ccf | |||
5877c04e57 | |||
cb64b52cda | |||
396037f90a | |||
3ad1e261c2 | |||
915a802060 | |||
b9ca744978 | |||
c514341b29 | |||
9562c34876 | |||
91190ec29a | |||
7b5e77dd30 | |||
a41ec2693e | |||
f915f4c155 | |||
e1bf0f9655 | |||
5728ac71f9 | |||
39fef5e856 | |||
d1b87b9de9 |
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
@ -6,6 +6,7 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository == 'jaywcjlove/reference'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@ -58,7 +59,6 @@ jobs:
|
||||
filter-author: (小弟调调™)
|
||||
filter: (^[\s]+?[R|r]elease)|(^[R|r]elease)
|
||||
|
||||
|
||||
- name: Create Release
|
||||
uses: ncipollo/release-action@v1
|
||||
if: steps.create_tag.outputs.successful
|
||||
@ -69,26 +69,26 @@ jobs:
|
||||
body: |
|
||||
Documentation ${{ needs.build.outputs.create_tag_version }}: https://raw.githack.com/jaywcjlove/reference/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html
|
||||
Comparing Changes: ${{ steps.changelog.outputs.compareurl }}
|
||||
|
||||
|
||||
${{ steps.changelog.outputs.changelog }}
|
||||
|
||||
## Docker
|
||||
[](https://hub.docker.com/r/wcjiang/reference) [](https://hub.docker.com/r/wcjiang/reference) [](https://hub.docker.com/r/wcjiang/reference)
|
||||
|
||||
轻松通过 `docker` 部署 `Quick Reference` 网站。
|
||||
|
||||
|
||||
```bash
|
||||
docker pull wcjiang/reference
|
||||
```
|
||||
|
||||
|
||||
```bash
|
||||
docker run --name reference --rm -d -p 9667:3000 wcjiang/reference:latest
|
||||
# Or
|
||||
docker run --name reference -itd -p 9667:3000 wcjiang/reference:latest
|
||||
```
|
||||
|
||||
|
||||
在浏览器中访问以下 URL
|
||||
|
||||
|
||||
```bash
|
||||
http://localhost:9667/
|
||||
```
|
||||
@ -144,8 +144,6 @@ jobs:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ghcr.io/jaywcjlove/reference:${{steps.changelog.outputs.version}}
|
||||
|
||||
|
||||
|
||||
# # Create Docker Image in Github
|
||||
# - name: Login to GitHub registry
|
||||
# run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||
@ -166,7 +164,7 @@ jobs:
|
||||
# # Create Docker Image
|
||||
# - name: Docker login
|
||||
# run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
|
||||
# - name: Build reference image
|
||||
# run: docker image build -t reference .
|
||||
|
||||
@ -181,4 +179,4 @@ jobs:
|
||||
# run: |
|
||||
# echo "outputs.tag - ${{ steps.changelog.outputs.version }}"
|
||||
# docker tag reference ${{ secrets.DOCKER_USER }}/reference:${{steps.changelog.outputs.version}}
|
||||
# docker push ${{ secrets.DOCKER_USER }}/reference:${{steps.changelog.outputs.version}}
|
||||
# docker push ${{ secrets.DOCKER_USER }}/reference:${{steps.changelog.outputs.version}}
|
||||
|
3
.github/workflows/win.yml
vendored
3
.github/workflows/win.yml
vendored
@ -6,6 +6,7 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository == 'jaywcjlove/reference'
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@ -24,4 +25,4 @@ jobs:
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
path: ${{ github.workspace }}\dist\**\*
|
||||
path: ${{ github.workspace }}\dist\**\*
|
||||
|
@ -193,6 +193,9 @@ REF_LABEL=网站首页
|
||||
<a href="https://github.com/demigodliu" title="DemigodLiu">
|
||||
<img src="https://avatars.githubusercontent.com/u/30372735?v=4" width="42;" alt="DemigodLiu"/>
|
||||
</a>
|
||||
<a href="https://github.com/eeeeeio" title="EEEEE">
|
||||
<img src="https://avatars.githubusercontent.com/u/20723545?v=4" width="42;" alt="EEEEE"/>
|
||||
</a>
|
||||
<a href="https://github.com/jasnzhuang" title="Jason Zhuang">
|
||||
<img src="https://avatars.githubusercontent.com/u/16612921?v=4" width="42;" alt="Jason Zhuang"/>
|
||||
</a>
|
||||
@ -259,6 +262,9 @@ REF_LABEL=网站首页
|
||||
<a href="https://github.com/onewesong" title="onewesong">
|
||||
<img src="https://avatars.githubusercontent.com/u/17920822?v=4" width="42;" alt="onewesong"/>
|
||||
</a>
|
||||
<a href="https://github.com/Mowmowj" title="shelton">
|
||||
<img src="https://avatars.githubusercontent.com/u/24759562?v=4" width="42;" alt="shelton"/>
|
||||
</a>
|
||||
<a href="https://github.com/wjjwkwindy" title="wjjwkwindy">
|
||||
<img src="https://avatars.githubusercontent.com/u/9508591?v=4" width="42;" alt="wjjwkwindy"/>
|
||||
</a>
|
||||
|
@ -86,6 +86,7 @@ Quick Reference
|
||||
[Less.js](./docs/lessjs.md)<!--rehype:style=background: rgb(29 54 93);&class=tag&data-lang=CSS-->
|
||||
[Next.js](./docs/nextjs.md)<!--rehype:style=background: rgb(0 0 0);&class=tag&data-lang=React-->
|
||||
[React](./docs/react.md)<!--rehype:style=background: rgb(34 143 173);-->
|
||||
[React Native](./docs/react-native.md)<!--rehype:style=background: rgb(34 143 173);&class=tag&data-lang=React-->
|
||||
[RegEx 正则表达式](./docs/regex.md)<!--rehype:style=background: rgb(149 36 155);-->
|
||||
[TypeScript](./docs/typescript.md)<!--rehype:style=background: rgb(49 120 198);-->
|
||||
[Vue 2](./docs/vue2.md)<!--rehype:style=background: rgb(64 184 131);-->
|
||||
@ -231,6 +232,9 @@ Quick Reference
|
||||
<a href="https://github.com/demigodliu" title="DemigodLiu">
|
||||
<img src="https://avatars.githubusercontent.com/u/30372735?v=4" width="42;" alt="DemigodLiu"/>
|
||||
</a>
|
||||
<a href="https://github.com/eeeeeio" title="EEEEE">
|
||||
<img src="https://avatars.githubusercontent.com/u/20723545?v=4" width="42;" alt="EEEEE"/>
|
||||
</a>
|
||||
<a href="https://github.com/jasnzhuang" title="Jason Zhuang">
|
||||
<img src="https://avatars.githubusercontent.com/u/16612921?v=4" width="42;" alt="Jason Zhuang"/>
|
||||
</a>
|
||||
@ -297,6 +301,9 @@ Quick Reference
|
||||
<a href="https://github.com/onewesong" title="onewesong">
|
||||
<img src="https://avatars.githubusercontent.com/u/17920822?v=4" width="42;" alt="onewesong"/>
|
||||
</a>
|
||||
<a href="https://github.com/Mowmowj" title="shelton">
|
||||
<img src="https://avatars.githubusercontent.com/u/24759562?v=4" width="42;" alt="shelton"/>
|
||||
</a>
|
||||
<a href="https://github.com/wjjwkwindy" title="wjjwkwindy">
|
||||
<img src="https://avatars.githubusercontent.com/u/9508591?v=4" width="42;" alt="wjjwkwindy"/>
|
||||
</a>
|
||||
|
7
assets/react-native.svg
Normal file
7
assets/react-native.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" height="1em" width="1em">
|
||||
<circle cx="12" cy="11.245" r="1.785"/>
|
||||
<path d="m7.002 14.794-.395-.101c-2.934-.741-4.617-2.001-4.617-3.452 0-1.452 1.684-2.711 4.617-3.452l.395-.1.111.391a19.507 19.507 0 0 0 1.136 2.983l.085.178-.085.178c-.46.963-.841 1.961-1.136 2.985l-.111.39zm-.577-6.095c-2.229.628-3.598 1.586-3.598 2.542 0 .954 1.368 1.913 3.598 2.54.273-.868.603-1.717.985-2.54a20.356 20.356 0 0 1-.985-2.542zm10.572 6.095-.11-.392a19.628 19.628 0 0 0-1.137-2.984l-.085-.177.085-.179c.46-.961.839-1.96 1.137-2.984l.11-.39.395.1c2.935.741 4.617 2 4.617 3.453 0 1.452-1.683 2.711-4.617 3.452l-.395.101zm-.41-3.553c.4.866.733 1.718.987 2.54 2.23-.627 3.599-1.586 3.599-2.54 0-.956-1.368-1.913-3.599-2.542a20.683 20.683 0 0 1-.987 2.542z"/>
|
||||
<path d="m6.419 8.695-.11-.39c-.826-2.908-.576-4.991.687-5.717 1.235-.715 3.222.13 5.303 2.265l.284.292-.284.291a19.718 19.718 0 0 0-2.02 2.474l-.113.162-.196.016a19.646 19.646 0 0 0-3.157.509l-.394.098zm1.582-5.529c-.224 0-.422.049-.589.145-.828.477-.974 2.138-.404 4.38.891-.197 1.79-.338 2.696-.417a21.058 21.058 0 0 1 1.713-2.123c-1.303-1.267-2.533-1.985-3.416-1.985zm7.997 16.984c-1.188 0-2.714-.896-4.298-2.522l-.283-.291.283-.29a19.827 19.827 0 0 0 2.021-2.477l.112-.16.194-.019a19.473 19.473 0 0 0 3.158-.507l.395-.1.111.391c.822 2.906.573 4.992-.688 5.718a1.978 1.978 0 0 1-1.005.257zm-3.415-2.82c1.302 1.267 2.533 1.986 3.415 1.986.225 0 .423-.05.589-.145.829-.478.976-2.142.404-4.384-.89.198-1.79.34-2.698.419a20.526 20.526 0 0 1-1.71 2.124z"/>
|
||||
<path d="m17.58 8.695-.395-.099a19.477 19.477 0 0 0-3.158-.509l-.194-.017-.112-.162A19.551 19.551 0 0 0 11.7 5.434l-.283-.291.283-.29c2.08-2.134 4.066-2.979 5.303-2.265 1.262.727 1.513 2.81.688 5.717l-.111.39zm-3.287-1.421c.954.085 1.858.228 2.698.417.571-2.242.425-3.903-.404-4.381-.824-.477-2.375.253-4.004 1.841.616.67 1.188 1.378 1.71 2.123zM8.001 20.15a1.983 1.983 0 0 1-1.005-.257c-1.263-.726-1.513-2.811-.688-5.718l.108-.391.395.1c.964.243 2.026.414 3.158.507l.194.019.113.16c.604.878 1.28 1.707 2.02 2.477l.284.29-.284.291c-1.583 1.627-3.109 2.522-4.295 2.522zm-.993-5.362c-.57 2.242-.424 3.906.404 4.384.825.47 2.371-.255 4.005-1.842a21.17 21.17 0 0 1-1.713-2.123 20.692 20.692 0 0 1-2.696-.419z"/>
|
||||
<path d="M12 15.313c-.687 0-1.392-.029-2.1-.088l-.196-.017-.113-.162a25.697 25.697 0 0 1-1.126-1.769 26.028 26.028 0 0 1-.971-1.859l-.084-.177.084-.179c.299-.632.622-1.252.971-1.858.347-.596.726-1.192 1.126-1.77l.113-.16.196-.018a25.148 25.148 0 0 1 4.198 0l.194.019.113.16a25.136 25.136 0 0 1 2.1 3.628l.083.179-.083.177a24.742 24.742 0 0 1-2.1 3.628l-.113.162-.194.017c-.706.057-1.412.087-2.098.087zm-1.834-.904c1.235.093 2.433.093 3.667 0a24.469 24.469 0 0 0 1.832-3.168 23.916 23.916 0 0 0-1.832-3.168 23.877 23.877 0 0 0-3.667 0 23.743 23.743 0 0 0-1.832 3.168 24.82 24.82 0 0 0 1.832 3.168z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 2.8 KiB |
@ -11,6 +11,8 @@ CocoaPods 备忘清单
|
||||
|
||||
```bash
|
||||
$ sudo gem install cocoapods
|
||||
# OR
|
||||
$ brew install cocoapods
|
||||
```
|
||||
|
||||
无 Sudo 安装,不想为此过程授予 `RubyGems` 管理员权限
|
||||
|
@ -718,6 +718,30 @@ $ ffmpeg -i test.mp4 -af "loudnorm=I=-5:LRA=1" out.mp4
|
||||
$ ffmpeg -i input.mp3 -af "channelmap=1-0|1-1" output.mp3
|
||||
```
|
||||
|
||||
流处理
|
||||
---
|
||||
|
||||
### 拉流
|
||||
|
||||
```bash
|
||||
# 拉取rtmp流并存储到本地
|
||||
$ ffmpeg -i "rtsp://127.0.0.1/test" test.mp4
|
||||
```
|
||||
|
||||
### 推流
|
||||
|
||||
```bash
|
||||
# 推送test.mp4到远程
|
||||
$ ffmpeg -re -i test.mp4 -f flv rtmp://127.0.0.1/test
|
||||
```
|
||||
|
||||
### 转发
|
||||
|
||||
```bash
|
||||
# 拉取流并转发
|
||||
$ ffmpeg -i "rtsp://127.0.0.1/test" -f mpegts -codec:v mpeg1video http://127.0.0.1/demo
|
||||
```
|
||||
|
||||
另见
|
||||
---
|
||||
|
||||
|
@ -110,6 +110,84 @@ class=tag&data-info=👆看看还缺点儿什么?
|
||||
|
||||
添加 `class=tag&data-lang=Python` 类名和参数,会在卡片右上角标记 _`Python`_
|
||||
|
||||
### Command Help
|
||||
|
||||
```bash
|
||||
Usage: refs-cli [output-dir] [--help|h]
|
||||
|
||||
显示帮助信息
|
||||
|
||||
Options:
|
||||
|
||||
--version, -v 显示版本号
|
||||
--help, -h 显示帮助信息
|
||||
--watch, -w 观看并编译 Markdown 文件
|
||||
--output, -o 输出目录。默认(分布)
|
||||
--force, -f 强制文件重新生成
|
||||
|
||||
Example:
|
||||
|
||||
$ npx refs-cli
|
||||
$ refs-cli --watch
|
||||
$ refs-cli --output website
|
||||
$ refs-cli
|
||||
|
||||
refs-cli@v0.0.1
|
||||
```
|
||||
|
||||
### Config
|
||||
|
||||
```json
|
||||
{
|
||||
"title": "文档网站名称",
|
||||
"description": "{{description}} 网站说明",
|
||||
"keywords": "关键字,refs-cli,refs,cli",
|
||||
"data-info": "👆需要你的参与",
|
||||
"search": {
|
||||
"label": "搜索",
|
||||
"placeholder": "搜索备忘清单",
|
||||
"cancel": "取消"
|
||||
},
|
||||
"editor": {
|
||||
"label": "编辑"
|
||||
},
|
||||
"github": {
|
||||
"url": "https://<github url>"
|
||||
},
|
||||
"home": {
|
||||
"label": "首页",
|
||||
"url": "https://<你的网站>"
|
||||
},
|
||||
"footer": "<br />备案号:支持HTML字符串",
|
||||
"license": "支持 HTML 字符串"
|
||||
}
|
||||
```
|
||||
|
||||
将 `.refsrc.json` 存放在项目的根目录下
|
||||
|
||||
### 环境变量
|
||||
|
||||
导航菜单
|
||||
|
||||
```ini
|
||||
REF_URL=http://ref.ecdata.cn/
|
||||
REF_LABEL=网站首页
|
||||
```
|
||||
|
||||
页脚添加 (支持 HTML 字符串)
|
||||
|
||||
```ini
|
||||
REF_FOOTER=备案号:沪ICP备20220000000号-1
|
||||
```
|
||||
|
||||
修改版权信息 (支持 HTML 字符串)
|
||||
|
||||
```ini
|
||||
LICENSE=Copyright (c) <b>2022</b> 小弟调调™
|
||||
```
|
||||
|
||||
在项目根目录中创建 <pur>**.env**</pur> 文件
|
||||
|
||||
Markdown 语法注释
|
||||
---
|
||||
|
||||
|
1638
docs/react-native.md
Normal file
1638
docs/react-native.md
Normal file
File diff suppressed because it is too large
Load Diff
149
docs/rust.md
149
docs/rust.md
@ -354,6 +354,14 @@ rand.capacity() // => 13
|
||||
|
||||
以字节为单位计算字符串的容量
|
||||
|
||||
### with_capacity()
|
||||
|
||||
```rust
|
||||
let s = String::with_capacity(10);
|
||||
```
|
||||
|
||||
指定一个足够大的容量值,来减少内存拷贝
|
||||
|
||||
### .contains()
|
||||
|
||||
```rust
|
||||
@ -484,6 +492,147 @@ let arr = vec![
|
||||
`drain(range)` | 删除 `vec` 中指定范围的元素,同时返回一个迭代该范围所有元素的迭代器
|
||||
`split_off(index)` | 切分 `vec`,索引左边的元素保留在原 `vec` 中(含索引),索引右边的元素(不含索引)在返回的 `vec` 中
|
||||
|
||||
Rust HashMap\<K,V>
|
||||
--------
|
||||
|
||||
### 使用
|
||||
|
||||
```rust
|
||||
use std::collections::HashMap;
|
||||
|
||||
fn main() {
|
||||
let mut map: HashMap<String, i32> = HashMap::new();
|
||||
map.insert(String::from("blue"), 100);
|
||||
// 查询Yellow对应的值,若不存在则插入默认值
|
||||
let v: &mut i32 =
|
||||
map.entry("Yellow".to_string()).or_insert(5);
|
||||
let v: &mut i32 =
|
||||
map.entry("Yellow".to_string()).or_insert(50); // 不会修改值
|
||||
}
|
||||
```
|
||||
|
||||
### 获取元素
|
||||
|
||||
```rust
|
||||
let mut scores = HashMap::new();
|
||||
|
||||
scores.insert(String::from("Blue"), 10);
|
||||
scores.insert(String::from("Yellow"), 50);
|
||||
|
||||
let team_name = String::from("Blue");
|
||||
let score: Option<&i32> = scores.get(&team_name);
|
||||
```
|
||||
|
||||
### 遍历
|
||||
|
||||
```rust
|
||||
let mut scores = HashMap::new();
|
||||
|
||||
scores.insert(String::from("Blue"), 10);
|
||||
scores.insert(String::from("Yellow"), 50);
|
||||
|
||||
for (key, value) in &scores {
|
||||
println!("{}: {}", key, value);
|
||||
}
|
||||
```
|
||||
|
||||
### vec -> HashMap
|
||||
|
||||
```rust
|
||||
let teams_list = vec![
|
||||
("中国队".to_string(), 100),
|
||||
("美国队".to_string(), 10),
|
||||
("日本队".to_string(), 50),
|
||||
];
|
||||
let teams_map: HashMap<_,_> =
|
||||
teams_list.into_iter().collect();
|
||||
```
|
||||
|
||||
----
|
||||
|
||||
```rust
|
||||
let teams = vec![String::from("blue"),String::from("red")];
|
||||
let intial_scores = vec![10,50];
|
||||
let scores:HashMap<_,_> =
|
||||
teams.iter().zip(intial_scores.iter()).collect();
|
||||
```
|
||||
|
||||
Option & Result
|
||||
--------
|
||||
|
||||
### Option
|
||||
|
||||
```rust
|
||||
enum Option<T> {
|
||||
Some(T),
|
||||
None,
|
||||
}
|
||||
```
|
||||
|
||||
#### 使用
|
||||
|
||||
```rust
|
||||
fn main(){
|
||||
let a = Some(5);
|
||||
// 直接获取原始值
|
||||
println!("{}", a.unwrap());
|
||||
// 给出错误信息
|
||||
let x: Option<&str> = None;
|
||||
x.expect("fruits are healthy"); // panics 带有 `fruits are healthy`
|
||||
}
|
||||
```
|
||||
|
||||
### Result
|
||||
|
||||
```rust
|
||||
enum Result<T, E> {
|
||||
Ok(T),
|
||||
Err(E),
|
||||
}
|
||||
```
|
||||
|
||||
#### 使用
|
||||
|
||||
```rust
|
||||
use std::fs::File;
|
||||
|
||||
fn main() {
|
||||
let f: Result<File,Error> = File::open("hello.txt");
|
||||
let f = match f {
|
||||
Ok(file) => file,
|
||||
Err(error) => {
|
||||
panic!("Problem opening the file: {:?}", error)
|
||||
},
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### 宏 `?`
|
||||
|
||||
`?` 只能用于返回结果是 Result 或者 Option 的函数,或者实现了 Try 类型
|
||||
|
||||
```rust
|
||||
use std::fs::File;
|
||||
use std::io::{self, Read};
|
||||
|
||||
fn read_username_from_file() -> Result<String, io::Error> {
|
||||
let mut s = String::new();
|
||||
File::open("hello.txt")?.read_to_string(&mut s)?;
|
||||
Ok(s)
|
||||
}
|
||||
```
|
||||
|
||||
----
|
||||
|
||||
```rust
|
||||
fn first(arr: &[i32]) -> Option<&i32> {
|
||||
let v = arr.get(0)?;
|
||||
Some(v)
|
||||
}
|
||||
```
|
||||
|
||||
<!--rehype:className=wrap-text -->
|
||||
|
||||
枚举
|
||||
--------
|
||||
|
||||
|
@ -1325,6 +1325,84 @@ const point = [3, 4] as const
|
||||
// type 'readonly [3, 4]'
|
||||
```
|
||||
|
||||
### satisfies
|
||||
|
||||
`satisfies` 允许将验证表达式的类型与某种类型匹配,而无需更改该表达式的结果类型。
|
||||
|
||||
```ts
|
||||
type Colors = 'red' | 'green' | 'blue';
|
||||
|
||||
type RGB = [red: number, green: number, blue: number];
|
||||
|
||||
const palette: Record<Colors, string | RGB> = {
|
||||
red: [255, 0, 0],
|
||||
green: '#00ff00',
|
||||
blue: [0, 0, 255],
|
||||
};
|
||||
|
||||
// 通常的方式会推导出 redComponent 为 string | number | undefined
|
||||
const redComponent = palette.red.at(0);
|
||||
```
|
||||
|
||||
#### 使用 satisfies
|
||||
|
||||
```ts
|
||||
const palette = {
|
||||
red: [255, 0, 0],
|
||||
green: '#00ff00',
|
||||
blue: [0, 0, 255],
|
||||
} satisfies Record<Colors, string | RGB>
|
||||
|
||||
// undefined | number
|
||||
const redComponent = palette.red.at(0)
|
||||
```
|
||||
|
||||
<!--rehype:className=wrap-text-->
|
||||
|
||||
### 范型实例化表达式
|
||||
|
||||
不使用的情况下:
|
||||
|
||||
```ts
|
||||
const errorMap: Map<string, Error> = new Map()
|
||||
// 或者使用 type 定义别名
|
||||
type ErrorMapType = Map<string, Error>
|
||||
```
|
||||
|
||||
使用泛型实例化表达式:
|
||||
|
||||
```ts
|
||||
const ErrorMap = Map<string, Error>
|
||||
const errorMap = new ErrorMap()
|
||||
```
|
||||
|
||||
#### 泛型实例化函数
|
||||
|
||||
```ts
|
||||
function makeBox<T>(value: T) {
|
||||
return { value };
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
不使用:
|
||||
|
||||
```ts
|
||||
function makeHammerBox(hammer: Hammer) {
|
||||
return makeBox(hammer);
|
||||
}
|
||||
// or...
|
||||
const makeWrenchBox: (wrench: Wrench) => Box<Wrench> = makeBox;
|
||||
```
|
||||
|
||||
使用:
|
||||
|
||||
```ts
|
||||
const makeStringBox = makeBox<string>;
|
||||
makeStringBox(42);
|
||||
```
|
||||
|
||||
CLI
|
||||
---
|
||||
|
||||
|
@ -90,7 +90,7 @@ Webstorm Windows & Linux 键盘映射
|
||||
`Alt` `Up` | 转到上一个方法
|
||||
`Alt` `Down` | 转到下一个方法
|
||||
`Ctrl` `]` _/_ `[` | 移动到代码块结束/开始
|
||||
`Cltrl` `Shift` `M` | 将插入符号移动到匹配的大括号
|
||||
`Ctrl` `Shift` `M` | 将插入符号移动到匹配的大括号
|
||||
`Ctrl` `F12` | 文件结构弹出
|
||||
`Ctrl` `H` | 类型层次结构
|
||||
`Ctrl` `Alt` `H` | 调用层次结构
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@wcj/reference",
|
||||
"version": "1.28.0",
|
||||
"version": "1.29.0",
|
||||
"description": "为开发人员分享快速参考备忘单(主要是方便自己)。",
|
||||
"author": "jaywcjlove",
|
||||
"license": "MIT",
|
||||
@ -25,7 +25,7 @@
|
||||
"husky": "^8.0.1",
|
||||
"lint-staged": "^13.0.3",
|
||||
"prettier": "^2.7.1",
|
||||
"refs-cli": "^0.0.11"
|
||||
"refs-cli": "^1.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
|
Reference in New Issue
Block a user