1/*1789981552000*/ 2/** 3 * Fairly simply, this plug-in will take the data from an API result set 4 * and sum it, returning the summed value. The data can come from any data 5 * source, including column data, cells or rows. 6 * 7 * Note that it will attempt to 'deformat' any string based data that is passed 8 * into it - i.e. it will strip any non-numeric characters in order to make a 9 * best effort attempt to sum all data types. This can be useful when working 10 * with formatting numbers such as currency. However the trade-off is that no 11 * error is thrown if non-numeric data is passed in. You should be aware of this 12 * in case unexpected values are returned - likely the input data is not what is 13 * expected. 14 * 15 * @name sum() 16 * @summary Sum the values in a data set. 17 * @author [Allan Jardine](http://sprymedia.co.uk) 18 * @requires DataTables 1.10+ 19 * 20 * @returns {Number} Summed value 21 * 22 * @example 23 * // Simply get the sum of a column 24 * var table = $('#example').DataTable(); 25 * table.column( 3 ).data().sum(); 26 * 27 * @example 28 * // Insert the sum of a column into the columns footer, for the visible 29 * // data on each draw 30 * $('#example').DataTable( { 31 * drawCallback: function () { 32 * var api = this.api(); 33 * $( api.table().footer() ).html( 34 * api.column( 4, {page:'current'} ).data().sum() 35 * ); 36 * } 37 * } ); 38 */ 39 40jQuery.fn.dataTable.Api.register( 'sum()', function ( ) { 41 return this.flatten().reduce( function ( a, b ) { 42 if ( typeof a === 'string' ) { 43 a = a.replace(/[^\d.-]/g, '') * 1; 44 } 45 if ( typeof b === 'string' ) { 46 b = b.replace(/[^\d.-]/g, '') * 1; 47 } 48 49 return a + b; 50 }, 0 ); 51} ); 52
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.