1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-08 06:43:49 +00:00

New utility method

Surprising that this seems to be the recommended approach
This commit is contained in:
Jeremy Ruston 2012-11-19 12:55:04 +00:00
parent 4e9dd3123b
commit 0d175d3eeb

View File

@ -12,6 +12,15 @@ Various static utility functions.
/*global $tw: false */ /*global $tw: false */
"use strict"; "use strict";
/*
Return the number of keys in an object
*/
exports.count = function(object) {
var s = 0;
$tw.utils.each(object,function() {s++;});
return s;
};
/* /*
Push entries onto an array, removing them first if they already exist in the array Push entries onto an array, removing them first if they already exist in the array
array: array to modify array: array to modify