From 0075e44e2f16c7cc060f2590752399bb004bf827 Mon Sep 17 00:00:00 2001 From: jianglujian <4077725@qq.com> Date: Mon, 13 Sep 2021 06:55:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1=E3=80=81es7=20{...defaultOptions=20}=20?= =?UTF-8?q?=3D>=20Object.assign?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index d518f1d..f1c7390 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,7 @@ module.exports.test = test function extractor (string, options) { string = string || '' var defaultOptions = { allowUnsafe: false } - options = options instanceof Object ? { ...defaultOptions, ...options } : defaultOptions + options = options instanceof Object ? Object.assign(defaultOptions, options) : defaultOptions options.allowUnsafe = Boolean(options.allowUnsafe) var lines = string.split(/(\r?\n)/) if (lines[0] && /= yaml =|---/.test(lines[0])) { From 0fbbf9ff505c2f8705b0374332768f994eb9e2e9 Mon Sep 17 00:00:00 2001 From: thinkido <4077725@qq.com> Date: Mon, 13 Sep 2021 14:00:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1=E3=80=81=E6=B5=8B=E8=AF=95=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=EF=BC=8C=E7=AE=80=E5=8D=95=E8=AF=B4=E6=98=8E=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=83=A8=E5=88=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index d5399e9..c2a3ef1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ # front-matter + +1、es7 {...defaultOptions } => Object.assign +减少项目有polyfill的需求和问题。 + [![build][build-img]][build-url] [![coverage][coverage-img]][coverage-url] [![npm][npm-img]][npm-url]