nuxt-jsonld
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -0,1 +1,8 @@ | ||
## [1.5.1](https://github.com/ymmooot/nuxt-jsonld/compare/v1.5.0...v1.5.1) (2021-05-21) | ||
### Bug Fixes | ||
* remove xxhashjs ([d997e57](https://github.com/ymmooot/nuxt-jsonld/commit/d997e573a8f014d6ef57b7818f22647fe0ab8286)), closes [#638](https://github.com/ymmooot/nuxt-jsonld/issues/638) | ||
# [1.5.0](https://github.com/ymmooot/nuxt-jsonld/compare/v1.4.10...v1.5.0) (2020-09-17) | ||
@@ -2,0 +9,0 @@ |
@@ -20,7 +20,3 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var xxhashjs_1 = __importDefault(require("xxhashjs")); | ||
var getOriginalHeadObject = function (that, originalHead) { | ||
@@ -32,2 +28,19 @@ if (typeof originalHead === 'function') { | ||
}; | ||
function hashCode(s) { | ||
/** | ||
* Using the java hashCode function | ||
* https://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/ | ||
* https://www.thejavaprogrammer.com/what-is-hashcode-in-java/ | ||
*/ | ||
var hash = 0; | ||
if (s.length === 0) { | ||
return hash; | ||
} | ||
for (var i = 0; i < s.length; i += 1) { | ||
var char = s.charCodeAt(i); | ||
hash = (hash << 5) - hash + char; // eslint-disable-line no-bitwise | ||
hash &= hash; // eslint-disable-line no-bitwise | ||
} | ||
return hash; | ||
} | ||
var getJsonLdHeadObject = function (that, jsonLdFunc, space) { | ||
@@ -40,3 +53,3 @@ var _a; | ||
var minifiedString = JSON.stringify(jsonLd, null, ''); | ||
var hid = "nuxt-jsonld-" + xxhashjs_1.default.h32(minifiedString, 0).toString(16); | ||
var hid = "nuxt-jsonld-" + hashCode(minifiedString).toString(16); | ||
var stringifiedJson = JSON.stringify(jsonLd, null, space); | ||
@@ -43,0 +56,0 @@ var innerHTML = space === 0 ? stringifiedJson : "\n" + stringifiedJson + "\n"; |
{ | ||
"name": "nuxt-jsonld", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "manage jsonld in Vue component.", | ||
@@ -33,4 +33,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"schema-dts": "^0.7.1", | ||
"xxhashjs": "^0.2.2" | ||
"schema-dts": "^0.8.2" | ||
}, | ||
@@ -56,3 +55,3 @@ "devDependencies": { | ||
"jest": "^26.4.2", | ||
"mem": "6.1.1", | ||
"mem": "8.0.0", | ||
"prettier": "^2.1.1", | ||
@@ -59,0 +58,0 @@ "rimraf": "^3.0.0", |
@@ -78,3 +78,3 @@ # nuxt-jsonld | ||
return { | ||
'@context': 'http://schema.org', | ||
'@context': 'https://schema.org', | ||
'@type': 'BreadcrumbList', | ||
@@ -137,5 +137,5 @@ itemListElement: items, | ||
return { | ||
'@context': 'http://schema.org', | ||
'@type': 'SomeType', | ||
body: foo, | ||
'@context': 'https://schema.org', | ||
'@type': 'Product', | ||
name: 'product name', | ||
}; | ||
@@ -147,3 +147,21 @@ }, | ||
You can return multiple json data as an array. | ||
```js | ||
[ | ||
{ | ||
"@context": "https://schema.org", | ||
"@type": "BreadcrumbList", | ||
"itemListElement": [/* breadcrumb items*/] | ||
}, | ||
{ | ||
"@context": "https://schema.org", | ||
"@type": "NewsArticle", | ||
"mainEntityOfPage": {/* article info */} | ||
}, | ||
] | ||
``` | ||
Or use `@graph` notation. [#247](https://github.com/ymmooot/nuxt-jsonld/issues/247#issuecomment-579851220) | ||
### TypeScript | ||
@@ -158,4 +176,5 @@ | ||
return { | ||
'@context': "http://schema.org", | ||
body: 'some text', | ||
'@context': 'https://schema.org', | ||
'@type': 'Product', | ||
name: 'product name', | ||
}; | ||
@@ -179,4 +198,5 @@ }, | ||
return { | ||
'@context': "http://schema.org", | ||
body: 'some text', | ||
'@context': 'https://schema.org', | ||
'@type': 'Product' | ||
name: 'product name', | ||
}; | ||
@@ -187,1 +207,2 @@ } | ||
``` | ||
18281
1
179
203
+ Addedschema-dts@0.8.3(transitive)
- Removedxxhashjs@^0.2.2
- Removedcuint@0.2.2(transitive)
- Removedschema-dts@0.7.4(transitive)
- Removedxxhashjs@0.2.2(transitive)
Updatedschema-dts@^0.8.2