2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-21 09:20:33 +03:00

use different escape sequence on client side

This commit is contained in:
Declan de Wet
2016-12-07 13:32:10 +02:00
parent ece3af40c9
commit 801dfaf4b1
3 changed files with 16 additions and 6 deletions
+16 -1
View File
@@ -1,9 +1,24 @@
import deepmerge from 'deepmerge'
import escapeHTML from 'lodash.escape'
import isPlainObject from 'lodash.isplainobject'
import isArray from './isArray'
import getComponentOption from './getComponentOption'
const escapeHTML = (str) => typeof window === 'undefined'
// server-side escape sequence
? String(str)
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#x27;')
// client-side escape sequence
: String(str)
.replace(/&/g, '\u0026')
.replace(/</g, '\u003c')
.replace(/>/g, '\u003e')
.replace(/"/g, '\u0022')
.replace(/'/g, '\u0027')
export default function _getMetaInfo (options = {}) {
const { keyName, tagIDKeyName } = options
/**