asia-weex-vue-render4light
Version:
Web renderer for weex project written in Vue DSL.
49 lines (43 loc) • 1.48 kB
JavaScript
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
const toString = Object.prototype.toString
/**
* Strict object type check. Only returns true
* for plain JavaScript objects.
*
* @param {*} obj
* @return {Boolean}
*/
const OBJECT_STRING = '[object Object]'
export function isPlainObject (obj) {
return toString.call(obj) === OBJECT_STRING
}
const ARRAY_STRING = '[object Array]'
export function isArray (arr) {
return toString.call(arr) === ARRAY_STRING
}
export function isPrimitive (val) {
return typeof value === 'string'
|| typeof value === 'number'
|| typeof value === 'symbol'
|| typeof value === 'boolean'
}
export function isDef (val) {
return val !== undefined && val !== null
}