Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Commit bb14fd1

Browse files
fix defaults on create-slug
1 parent 947d078 commit bb14fd1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/hooks/create-slug.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ const slug = require('slug');
33
const getUniqueSlug = require('../helper/get-unique-slug');
44
const { isEmpty } = require('lodash');
55

6-
module.exports = function (options = { field: null, overwrite: false, unique: true }) {
6+
module.exports = function (options = {}) {
77
return function (hook) {
8+
options = Object.assign({ field: null, overwrite: false, unique: true }, options);
9+
810
if (!options.field || !hook.data[options.field]) return hook;
911

1012
// do not overwrite existing slug

0 commit comments

Comments
 (0)