我为我经常使用的一些vim命令编写了一个简短的备忘单,仅供个人参考。当我意识到正则表达式格式中使用了[方括号]时遇到了一个问题,但是我一直在使用它们来显示值。例如,我将替代命令写为
import { API } from "../shared/constants";
import { IBill } from "../models";
// api call to get all categories from db
export const getCategories = async () => {
const response = await fetch(`${API}/categories`);
return await response.json();
};
// api call to get all bills from db with some filtering options
export const getBills = async ({ isBill, page, limit }) => {
const response = await fetch(
`${API}/bills?_sort=name&_order=asc&isBill=${isBill}&_page=${page}&_limit=${limit}`
);
return await response.json();
};
// api call to update bills when `remove` or `add`
export const updateBill = async ({ bills, id }) => {
const oldBill = bills.filter((bill: IBill) => bill.id === id)[0];
const updatedBill = { ...oldBill, isBill: !oldBill.isBill };
await fetch(`${API}/bills/${id}`, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(updatedBill),
});
};
文档中是否存在此类值的标准格式? 预先感谢!
答案 0 :(得分:0)
对于vim,您可以这样写:
%s/<EXISTING STRING>/<REPLACEMENT STRING>/g
方括号通常与perl模板模块结合使用:
[%EXISTING_STRING%]