Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-schemaorg

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-schemaorg - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

3

dist/json-ld.d.ts

@@ -35,2 +35,3 @@ /**

* }}
* space={2}
* />

@@ -41,4 +42,6 @@ * ```

item: WithContext<T>;
/** Adds indentation, white space, and line break characters to JSON-LD output. {@link JSON.stringify} */
space?: string | number;
}> {
render(): JSX.Element;
}

45

dist/json-ld.js

@@ -17,4 +17,17 @@ "use strict";

*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const React = require("react");
var React = require("react");
/**

@@ -37,12 +50,18 @@ * Component that inline-includes a JSON-LD script where specified.

* }}
* space={2}
* />
* ```
*/
class JsonLd extends React.Component {
render() {
var JsonLd = /** @class */ (function (_super) {
__extends(JsonLd, _super);
function JsonLd() {
return _super !== null && _super.apply(this, arguments) || this;
}
JsonLd.prototype.render = function () {
return (React.createElement("script", { type: "application/ld+json", dangerouslySetInnerHTML: {
__html: JSON.stringify(this.props.item, safeJsonLdReplacer)
__html: JSON.stringify(this.props.item, safeJsonLdReplacer, this.props.space)
} }));
}
}
};
return JsonLd;
}(React.Component));
exports.JsonLd = JsonLd;

@@ -53,6 +72,6 @@ /**

*/
const safeJsonLdReplacer = (() => {
var safeJsonLdReplacer = (function () {
// Replace per https://www.w3.org/TR/json-ld11/#restrictions-for-contents-of-json-ld-script-elements
// Solution from https://stackoverflow.com/a/5499821/864313
const entities = Object.freeze({
var entities = Object.freeze({
"&": "&amp;",

@@ -64,6 +83,12 @@ "<": "&lt;",

});
const replace = (t) => entities[t] || t;
return (_, value) => {
var replace = function (t) {
return entities[t] || t;
};
return function (_, value) {
switch (typeof value) {
case "object":
// Omit null values.
if (value === null) {
return undefined;
}
return value; // JSON.stringify will recursively call replacer.

@@ -70,0 +95,0 @@ case "number":

{
"name": "react-schemaorg",
"version": "1.0.1",
"version": "1.0.2",
"displayName": "React: Schema.org",

@@ -5,0 +5,0 @@ "description": "Typed Schema.org JSON-LD in React",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc