metalsmith-default-values
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -19,2 +19,3 @@ 'use strict'; | ||
const value = get(item, key); | ||
const default_value = defaults[key]; | ||
@@ -27,3 +28,7 @@ // For more verbose debugging enable the following | ||
if (value === void 0 || value === null) { | ||
set(item, key, defaults[key]); | ||
if (typeof default_value === 'function') { | ||
set(item, key, default_value(item)); | ||
} else { | ||
set(item, key, default_value); | ||
} | ||
} | ||
@@ -30,0 +35,0 @@ }); |
{ | ||
"name": "metalsmith-default-values", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "A metalsmith plugin for setting default values for frontmatter metadata.", | ||
@@ -21,10 +21,17 @@ "engines": { | ||
"prettier": "^1.10.2", | ||
"tap": "^11.0.1" | ||
"tap": "^12.0.1" | ||
}, | ||
"greenkeeper": { | ||
"ignore": [ | ||
"joi", | ||
"eslint" | ||
] | ||
}, | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"test": "tap test", | ||
"posttest": "npm run lint", | ||
"pretest": "npm run lint", | ||
"test": "tap test -J", | ||
"lint": "eslint --cache --fix .", | ||
"dev": "nodemon --exec 'npm test'", | ||
"preversion": "npm test", | ||
"postversion": "git push && git push --tags && npm publish" | ||
@@ -31,0 +38,0 @@ }, |
@@ -1,13 +0,11 @@ | ||
# metalsmith-default-values | ||
# Metalsmith Default Values | ||
[![npm version][npm-badge]][npm-url] | ||
[![Build Status][travis-badge]][travis-url] | ||
[![code style: prettier][prettier-badge]][prettier-url] | ||
[![bitHound Dependencies][bithound-badge]][bithound-url] | ||
[![bitHound Dev Dependencies][bithound-dev-badge]][bithound-url] | ||
[![bitHound Code][bithound-code-badge]][bithound-code-url] | ||
[![metalsmith: plugin][metalsmith-badge]][metalsmith-url] | ||
[![Build Status][travis-badge]][travis-url] | ||
[![Known Vulnerabilities][snyk-badge]][synk-url] | ||
[![NSP Status][nsp-badge]][nsp-url] | ||
[![Package Quality][quality-badge]][quality-url] | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/woodyrew/metalsmith-default-values.svg)](https://greenkeeper.io/) | ||
@@ -42,3 +40,6 @@ Metalsmith Plugin for setting default front-matter metadata. | ||
defaults: { | ||
layout: 'post.hbs' | ||
layout: 'post.hbs', | ||
date: function (post) { | ||
return post.stats.ctime; | ||
} | ||
} | ||
@@ -98,10 +99,3 @@ }, | ||
[travis-url]: https://travis-ci.org/woodyrew/metalsmith-default-values | ||
[bithound-badge]: https://www.bithound.io/github/woodyrew/metalsmith-default-values/badges/dependencies.svg | ||
[bithound-dev-badge]: https://www.bithound.io/github/woodyrew/metalsmith-default-values/badges/devDependencies.svg | ||
[bithound-url]: https://www.bithound.io/github/woodyrew/metalsmith-default-values/master/dependencies/npm | ||
[bithound-code-badge]: https://www.bithound.io/github/woodyrew/metalsmith-default-values/badges/code.svg | ||
[bithound-code-url]: https://www.bithound.io/github/woodyrew/metalsmith-default-values | ||
[quality-badge]: http://npm.packagequality.com/shield/metalsmith-default-values.svg | ||
[quality-url]: http://packagequality.com/#?package=metalsmith-default-values | ||
[prettier-badge]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square | ||
[prettier-badge]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg | ||
[prettier-url]: https://github.com/prettier/prettier | ||
@@ -112,1 +106,3 @@ [snyk-badge]: https://snyk.io/test/github/woodyrew/metalsmith-default-values/badge.svg | ||
[nsp-url]: https://nodesecurity.io/orgs/woodyrew/projects/14b90fd0-d8f1-4156-8e1c-d690a8c4f197 | ||
[metalsmith-badge]: https://img.shields.io/badge/metalsmith-plugin-green.svg?longCache=true | ||
[metalsmith-url]: http://metalsmith.io |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
166
45431
14
106