Socket
Socket
Sign inDemoInstall

react-structured-data

Package Overview
Dependencies
6
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.3 to 0.0.4

7

dist/schemas/Generic.js

@@ -19,2 +19,4 @@ 'use strict';

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

@@ -40,7 +42,10 @@

value: function getJSON() {
var isFirstChildNode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var parseChildren = _get(ChildNode.prototype.__proto__ || Object.getPrototypeOf(ChildNode.prototype), 'parseChildren', this).call(this);
var schema = this.props.schema;
var details = {
'@type': this.props.jsonldtype
};
return _extends.apply(undefined, [details, this.props.schema].concat(_toConsumableArray(parseChildren)));
return isFirstChildNode ? _extends.apply(undefined, [_extends({}, details, schema)].concat(_toConsumableArray(parseChildren))) : _extends(_defineProperty({}, this.props.id, _extends({}, details, schema, parseChildren)));
}

@@ -47,0 +52,0 @@ }]);

8

package.json
{
"name": "react-structured-data",
"version": "0.0.3",
"version": "0.0.4",
"description": "Declarative JSON-LD Structured Data for ReactJS Apps",

@@ -21,2 +21,6 @@ "author": "Ben Taylor <benlt105@gmail.com>",

],
"dependencies": {
"react": "^16.2.0",
"prop-types": "^15.6.0"
},
"devDependencies": {

@@ -63,4 +67,2 @@ "autoprefixer": "7.1.6",

"react-dom": "^16.2.0",
"react-structured-data": "./react-structured-data-0.0.1.tgz",
"react-syntax-highlighter": "^6.1.0",
"sass-loader": "^6.0.6",

@@ -67,0 +69,0 @@ "style-loader": "0.19.0",

@@ -9,7 +9,7 @@ # React Structured Data

run `yarn add react-structured-data`
`yarn add react-structured-data`
### NPM
run `npm install react-structured-data --save`
`npm install react-structured-data --save`

@@ -110,2 +110,20 @@ ## Code Example

If you would like to use a component that is not listed, simply use the Generic component and add the prop jsonldtype.
Generic and GenericCollection allow you to add your own structured data type.
For example, If Review preset didn't exist, you could write:
```
<JSONLD>
<Generic id="review" jsonldtype="Review" schema={{name: "It is awesome", reviewBody: "This is great!"}}>
<Generic id="itemReviewed" jsonldtype="Product" schema={{"@id":"product-x"}} />
<Generic id="author" jsonldtype="Person" schema={{name: "Cool Carl"}}/>
<Generic id="locationCreated" jsonldtype="AdministrativeArea" schema={{name: "Chicago, IL"}}/>
</Generic>
</JSONLD>
```
This may seem not as ideal as using the presets, but this allows completely customizable structured data.
There will also be more preset components to come in future releases to make implementation easier so stay tuned!
### Structured Data and Schema.org

@@ -112,0 +130,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc