preact-render-to-json
Advanced tools
Comparing version 3.6.4 to 3.6.5
@@ -25,2 +25,12 @@ (function (global, factory) { | ||
var omit = function (object, paths) { | ||
return Object.keys(object).reduce(function (result, key) { | ||
if (!paths.includes(key)) { | ||
result[key] = object[key]; | ||
} | ||
return result; | ||
}, {}); | ||
}; | ||
var SHALLOW = { shallow: true }; | ||
@@ -49,3 +59,3 @@ | ||
if (vnode == null || vnode === false) { | ||
return EMPTY; | ||
return null; | ||
} | ||
@@ -101,5 +111,9 @@ | ||
if (attributes) { | ||
ret.props = attributes; | ||
ret.props = omit(attributes, ['key', 'children']); | ||
} | ||
if (attributes && attributes.key) { | ||
ret.key = attributes.key; | ||
} | ||
if (pieces.length) { | ||
@@ -106,0 +120,0 @@ ret.children = pieces; |
{ | ||
"name": "preact-render-to-json", | ||
"amdName": "preactRenderToJSON", | ||
"version": "3.6.4", | ||
"version": "3.6.5", | ||
"description": "Render JSX and Preact components to JSON", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
@@ -1,2 +0,2 @@ | ||
import { falsey, assign, getNodeProps } from './util'; | ||
import { falsey, assign, getNodeProps, omit } from './util'; | ||
@@ -40,3 +40,3 @@ const SHALLOW = { shallow: true }; | ||
if (vnode==null || vnode===false) { | ||
return EMPTY; | ||
return null; | ||
} | ||
@@ -98,5 +98,9 @@ | ||
if (attributes) { | ||
ret.props = attributes; | ||
ret.props = omit(attributes, ['key', 'children']); | ||
} | ||
if (attributes && attributes.key) { | ||
ret.key = attributes.key; | ||
} | ||
if (pieces.length) { | ||
@@ -103,0 +107,0 @@ ret.children = pieces; |
@@ -16,1 +16,11 @@ | ||
} | ||
export const omit = (object, paths) => | ||
Object.keys(object) | ||
.reduce((result, key) => { | ||
if (!paths.includes(key)) { | ||
result[key] = object[key]; // eslint-disable-line no-param-reassign | ||
} | ||
return result; | ||
}, {}); |
Sorry, the diff of this file is not supported yet
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
23240
309