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] 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])) {