2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-12 01:12:24 +03:00

refactor: move isArray into is-type

This commit is contained in:
pimlie
2019-03-09 18:28:15 +01:00
committed by Alexander Lichter
parent bfa64af29b
commit c1f97c4ea4
19 changed files with 42 additions and 44 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
import { version } from '../package.json'
import createMixin from './shared/mixin'
import setOptions from './shared/options'
import { isUndefined } from './shared/typeof'
import { isUndefined } from './shared/is-type'
import $meta from './client/$meta'
import hasMetaInfo from './shared/hasMetaInfo'
+1 -1
View File
@@ -1,5 +1,5 @@
import getMetaInfo from '../shared/getMetaInfo'
import { isFunction } from '../shared/typeof'
import { isFunction } from '../shared/is-type'
import updateClientMetaInfo from './updateClientMetaInfo'
export default function _refresh(options = {}) {
+1 -1
View File
@@ -1,5 +1,5 @@
import { metaInfoOptionKeys, metaInfoAttributeKeys } from '../shared/constants'
import isArray from '../shared/isArray'
import { isArray } from '../shared/is-type'
import { updateAttribute, updateTag, updateTitle } from './updaters'
function getTag(tags, tag) {
+1 -1
View File
@@ -1,5 +1,5 @@
import { booleanHtmlAttributes } from '../../shared/constants'
import isArray from '../../shared/isArray'
import { isArray } from '../../shared/is-type'
/**
* Updates the document's html tag attributes
+1 -1
View File
@@ -1,4 +1,4 @@
import { isUndefined } from '../../shared/typeof'
import { isUndefined } from '../../shared/is-type'
/**
* Updates meta tags inside <head> and <body> on the client. Borrowed from `react-helmet`:
+1 -2
View File
@@ -1,6 +1,5 @@
import { booleanHtmlAttributes } from '../../shared/constants'
import { isUndefined } from '../../shared/typeof'
import isArray from '../../shared/isArray'
import { isUndefined, isArray } from '../../shared/is-type'
/**
* Generates tag attributes for use on the server.
+1 -1
View File
@@ -1,5 +1,5 @@
import { booleanHtmlAttributes, tagsWithoutEndTag, tagsWithInnerContent, tagAttributeAsInnerContent } from '../../shared/constants'
import { isUndefined } from '../../shared/typeof'
import { isUndefined } from '../../shared/is-type'
/**
* Generates meta, base, link, style, script, noscript tags for use on the server
+1 -1
View File
@@ -1,4 +1,4 @@
import { isUndefined, isFunction } from './typeof'
import { isUndefined, isFunction } from './is-type'
export default function applyTemplate({ component, metaTemplateKeyName, contentKeyName }, headObject, template, chunk) {
if (isUndefined(template)) {
+1 -2
View File
@@ -1,5 +1,4 @@
import isArray from './isArray'
import { isObject } from './typeof'
import { isArray, isObject } from './is-type'
export function ensureIsArray(arg, key) {
if (!key || !isObject(arg)) {
+1 -2
View File
@@ -1,6 +1,5 @@
import { metaInfoOptionKeys, disableOptionKeys } from './constants'
import isArray from './isArray'
import { isString, isObject } from './typeof'
import { isString, isArray, isObject } from './is-type'
// sanitizes potentially dangerous characters
export default function escape(info, options, escapeOptions) {
+1 -1
View File
@@ -1,7 +1,7 @@
import { merge } from './merge'
import applyTemplate from './applyTemplate'
import inMetaInfoBranch from './inMetaInfoBranch'
import { isFunction, isObject } from './typeof'
import { isFunction, isObject } from './is-type'
/**
* Returns the `opts.option` $option value of the given `opts.component`.
+1 -1
View File
@@ -1,4 +1,4 @@
import { isObject } from './typeof'
import { isObject } from './is-type'
// Vue $root instance has a _vueMeta object property, otherwise its a boolean true
export default function hasMetaInfo(vm = this) {
+1 -1
View File
@@ -1,4 +1,4 @@
import { isUndefined } from './typeof'
import { isUndefined } from './is-type'
// a component is in a metaInfo branch when itself has meta info or one of its (grand-)children has
export default function inMetaInfoBranch(vm = this) {
+26
View File
@@ -0,0 +1,26 @@
/**
* checks if passed argument is an array
* @param {any} arr - the object to check
* @return {Boolean} - true if `arr` is an array
*/
export function isArray(arr) {
return Array.isArray
? Array.isArray(arr)
: Object.prototype.toString.call(arr) === '[object Array]'
}
export function isUndefined(arg) {
return typeof arg === 'undefined'
}
export function isObject(arg) {
return typeof arg === 'object'
}
export function isFunction(arg) {
return typeof arg === 'function'
}
export function isString(arg) {
return typeof arg === 'string'
}
-10
View File
@@ -1,10 +0,0 @@
/**
* checks if passed argument is an array
* @param {any} arr - the object to check
* @return {Boolean} - true if `arr` is an array
*/
export default function isArray(arr) {
return Array.isArray
? Array.isArray(arr)
: Object.prototype.toString.call(arr) === '[object Array]'
}
+1 -1
View File
@@ -1,6 +1,6 @@
import triggerUpdate from '../client/triggerUpdate'
import hasMetaInfo from './hasMetaInfo'
import { isUndefined, isFunction } from './typeof'
import { isUndefined, isFunction } from './is-type'
import { ensuredPush } from './ensure'
export default function createMixin(Vue, options) {
+1 -1
View File
@@ -1,4 +1,4 @@
import { isObject, isFunction } from './typeof'
import { isObject, isFunction } from './is-type'
import {
keyName,
-15
View File
@@ -1,15 +0,0 @@
export function isUndefined(arg) {
return typeof arg === 'undefined'
}
export function isObject(arg) {
return typeof arg === 'object'
}
export function isFunction(arg) {
return typeof arg === 'function'
}
export function isString(arg) {
return typeof arg === 'string'
}
+1 -1
View File
@@ -1,4 +1,4 @@
import { isUndefined } from './typeof'
import { isUndefined } from './is-type'
export function hasGlobalWindowFn() {
try {