mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
KnockoutJS use more Array.isArray
This commit is contained in:
parent
1357a696be
commit
b07bf3ad12
2 changed files with 2 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
ko['observableArray'] = initialValues => {
|
ko['observableArray'] = initialValues => {
|
||||||
initialValues = initialValues || [];
|
initialValues = initialValues || [];
|
||||||
|
|
||||||
if (typeof initialValues != 'object' || !('length' in initialValues))
|
if (!Array.isArray(initialValues))
|
||||||
throw new Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");
|
throw new Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");
|
||||||
|
|
||||||
return Object.setPrototypeOf(ko.observable(initialValues), ko['observableArray']['fn']).extend({'trackArrayChanges':true});
|
return Object.setPrototypeOf(ko.observable(initialValues), ko['observableArray']['fn']).extend({'trackArrayChanges':true});
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@
|
||||||
var renderedNodesArray = renderTemplateSource(makeTemplateSource(template, templateDocument));
|
var renderedNodesArray = renderTemplateSource(makeTemplateSource(template, templateDocument));
|
||||||
|
|
||||||
// Loosely check result is an array of DOM nodes
|
// Loosely check result is an array of DOM nodes
|
||||||
if ((typeof renderedNodesArray.length != "number") || (renderedNodesArray.length > 0 && typeof renderedNodesArray[0].nodeType != "number"))
|
if (!Array.isArray(renderedNodesArray) || (renderedNodesArray.length > 0 && typeof renderedNodesArray[0].nodeType != "number"))
|
||||||
throw new Error("Template engine must return an array of DOM nodes");
|
throw new Error("Template engine must return an array of DOM nodes");
|
||||||
|
|
||||||
if (replaceChildren) {
|
if (replaceChildren) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue