Skip to content

Commit

Permalink
Merge pull request #3 from CloudCannon/fix/page-check
Browse files Browse the repository at this point in the history
Fix for page detection in some cases
  • Loading branch information
rycoll committed Jun 17, 2024
2 parents 8056615 + 135e8a4 commit 2fb544b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/util/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ const { configure } = require('safe-stable-stringify');

const stringify = configure({ deterministic: false });

function replacer(key, value) {
const isNotPage = !value
|| typeof value !== 'object'
|| !Object.prototype.hasOwnProperty.call(value, 'template')
|| !Object.prototype.hasOwnProperty.call(value, 'inputPath')
|| !Object.prototype.hasOwnProperty.call(value, 'fileSlug')
|| !Object.prototype.hasOwnProperty.call(value, 'filePathStem')
|| !Object.prototype.hasOwnProperty.call(value, 'data')
|| !Object.prototype.hasOwnProperty.call(value, 'templateContent');
function replacer(_key, value) {
const isPage = value
&& typeof value === 'object'
&& Object.prototype.hasOwnProperty.call(value, 'template')
&& Object.prototype.hasOwnProperty.call(value, 'inputPath')
&& Object.prototype.hasOwnProperty.call(value, 'fileSlug')
&& Object.prototype.hasOwnProperty.call(value, 'filePathStem')
&& Object.prototype.hasOwnProperty.call(value, 'data')
&& Object.prototype.hasOwnProperty.call(value, 'templateContent');

return isNotPage ? value : '[FILTERED]';
return isPage ? '[FILTERED]' : value;
}

function stringifyJson(obj, fallback) {
Expand Down

0 comments on commit 2fb544b

Please sign in to comment.