cubicweb/web/data/cubicweb.compat.js
author Denis Laxalde <denis.laxalde@logilab.fr>
Thu, 14 Mar 2019 14:43:18 +0100
changeset 12503 b01dd0ef43aa
parent 11057 0b59724cb3f2
permissions -rw-r--r--
Drop most deprecated code in cubicweb.web This includes both Python and JavaScript code. Most code has been deprecated since a very long time (versions 3.1x mostly, more than 5 years ago, and a few things until 3.24). There are still a few deprecated things, most of which are actually used within cubicweb (or in cubes we depend on for tests). I don't know what to do with these... Removed a couple of unused imports along the way. Changelog entry will come in a later changeset.

/**
 * .. function:: cw.utils.deprecatedFunction(msg, function)
 *
 * jQUery flattens arrays returned by the mapping function: ::
 *
 *   >>> y = ['a:b:c', 'd:e']
 *   >>> jQuery.map(y, function(y) { return y.split(':');})
 *   ["a", "b", "c", "d", "e"]
 *   // where one would expect:
 *   [ ["a", "b", "c"], ["d", "e"] ]
 */
 // XXX why not the same argument order as $.map and forEach ?

function map(func, array) {
    var result = [];
    for (var i = 0, length = array.length; i < length; i++) {
        result.push(func(array[i]));
    }
    return result;
}