blob: 32216a6b9d857d9a9cd4f2b97f5355f779c6bf07 [file] [log] [blame]
/*
* 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.
*/
// @flow
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?: mixed): boolean {
return toString.call(obj) === OBJECT_STRING
}
const ARRAY_STRING = '[object Array]'
export function isArray (arr?: mixed): boolean {
return toString.call(arr) === ARRAY_STRING
}