jodit
Version:
Jodit is awesome and usefully wysiwyg editor with filebrowser
27 lines (23 loc) • 687 B
text/typescript
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2020 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { isWindow } from './is-window';
import { hasOwn } from '../type';
import { IDictionary } from '../../../types';
/**
* Check if element is simple plaint object
* @param obj
*/
export function isPlainObject<T>(
obj: any | IDictionary<T>
): obj is IDictionary<T> {
if (!obj || typeof obj !== 'object' || obj.nodeType || isWindow(obj)) {
return false;
}
return !(
obj.constructor &&
!hasOwn.call(obj.constructor.prototype, 'isPrototypeOf')
);
}