mirror of
https://github.com/codex-team/editor.js
synced 2026-03-15 15:15:47 +01:00
Added typeof method (#812)
* Add typeof method to check exact type of object #805 * Update changelog
This commit is contained in:
parent
5aeb65b06f
commit
33cc273dda
3 changed files with 14 additions and 5 deletions
8
dist/editor.js
vendored
8
dist/editor.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
- `Improvements` — Inline Toolbar now works on mobile devices [#706](https://github.com/codex-team/editor.js/issues/706)
|
||||
- `Improvements` — Toolbar looks better on mobile devices [#706](https://github.com/codex-team/editor.js/issues/706)
|
||||
- `Fix` — Added `typeof` util method to check exact object type [#805](https://github.com/codex-team/editor.js/issues/805)
|
||||
|
||||
### 2.14
|
||||
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ export default class Util {
|
|||
* @return {object}
|
||||
*/
|
||||
public static deepMerge(target, ...sources) {
|
||||
const isObject = (item) => item && typeof item === 'object' && !Array.isArray(item);
|
||||
const isObject = (item) => item && Util.typeof(item) === 'object';
|
||||
|
||||
if (!sources.length) { return target; }
|
||||
const source = sources.shift();
|
||||
|
|
@ -351,4 +351,12 @@ export default class Util {
|
|||
return 'ontouchstart' in document.documentElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return string representation of the object type
|
||||
*
|
||||
* @param {any} object
|
||||
*/
|
||||
public static typeof(object: any): string {
|
||||
return Object.prototype.toString.call(object).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue