Sorts data if orderingFunction is specified
@param  {BarChartData}     clean unordered data
@return  {BarChartData}    clean ordered data
@private
977702
function sortData(unorderedData) {
            let {data, dataZeroed} = unorderedData;

            if (orderingFunction) {
                data.sort(orderingFunction);
                dataZeroed.sort(orderingFunction)
            }

            return { data, dataZeroed };
        }
458505
private static Sort first(String columnName, Sort.Order order) {
        return Sort.on(columnName, order);
    }
200237
def clean(self, data):
        """"""
        cleaned_data = list()

        if not isinstance(data, list):
            data = [data]

        for item in data:
            date = datetime.datetime.strptime(item['Date'], '%Y-%m-%d').date()
            cleaned_data.append(dict(price=item['Adj_Close'], date=date))

        return cleaned_data
392692
function cleanData(originalData) {
            return originalData.reduce((acc, d) => {
                d.name = String(d[nameKey]);
                d.x = d[xKey];
                d.y = d[yKey];

                return [...acc, d];
            }, []);
        }
1122124
function getComparator(sortOrder) {
  if (typeof sortOrder === 'function') {
    return sortOrder;
  }

  const comparators = {
    [ASC]: ascendingSort,
    [DESC]: descendingSort,
    [ASC_LENGTH]: lengthSort,
    [DESC_LENGTH]: lengthReverseSort
  };

  return comparators[sortOrder];
}
449734
function sortitem()
{
  var self = this;
  
  /* ATTRIBUTES */
  
  /* passed html title binding */
  this.title = "";
  
  /* passed active item binding */
  this.active = false;
  
  /* passed onsort method to be used when clicked */
  this.onSort = function(){};
  
  /* toggles class based on this.active */
  this.filters.activeText = function(v)
  {
    return (v ? 'active' : 'inactive');
  }
  
  /* the actual click event */
  this.sortClick = function(e)
  {
    self.onSort(self.title);
  };
}
180678
function sortObj(obj) {
  if (typeof obj === 'object' && obj !== null) {
    var sorted = {};
    Object.keys(obj).sort().forEach(function(k) {
      sorted[k] = sortObj(obj[k]);
    });
    return sorted;
  } else if (Array.isArray(obj)) {
    return obj.sort().map(sortObj);
  }
  return obj;
}
21148
function () {
                var sortKeyGetter = this.sortKeyGetter;
                var items = this.items;
                var itemsLength = items.length;
                for (var i = 0; i < itemsLength; i++) {
                    var elt = items[i];
                    elt.sortKey = sortKeyGetter.fn.call(sortKeyGetter.scope, elt, sortKeyGetter.args);
                }
                items.sort(this.sortOrder == this.SORT_ASCENDING
                        ? __ascendingSortingFunction
                        : __descendingSortingFunction);
                var curState = this._currentState;
                curState.sortKeyGetter = this.sortKeyGetter;
                curState.sortOrder = this.sortOrder;
                curState.sortName = this.sortName;
                this._changes = this._changes | this._CHANGED_PAGE_DATA;
            }
673903
function sortByOrdinal(extensions, done) {
    const sorted = extensions.sort((a, b) => {
        if (a.ordinal || b.ordinal) {
            if (!a.ordinal) return 1;
            if (!b.ordinal) return -1;
            if (a.ordinal < b.ordinal) return -1;
            return 1;
        }
        return a.pluginId.localeCompare(b.pluginId);
    });

    if (done) {
        done(sorted);
    }

    return sorted;
}
543807
function getSortedColumns(tableStructure, sortColumn, compareFunction) {
  // With help from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
  var mappedArray = sortColumn.julianDatesOrValues.map(function(value, i) {
    return { index: i, value: value };
  });
  if (!defined(compareFunction)) {
    if (sortColumn.type === VarType.TIME) {
      compareFunction = function(a, b) {
        if (defined(a) && defined(b)) {
          return JulianDate.compare(a, b);
        }
        return defined(a) ? -1 : defined(b) ? 1 : 0; // so that undefined > defined, ie. all undefined dates go to the end.
      };
    } else {
      compareFunction = function(a, b) {
        return +(a > b) || +(a === b) - 1;
      };
    }
  }
  mappedArray.sort(function(a, b) {
    return compareFunction(a.value, b.value);
  });
  return tableStructure.columns.map(column => {
    var sortedValues = mappedArray.map(element => column.values[element.index]);
    return new TableColumn(column.name, sortedValues, column.getFullOptions());
  });
}
1280356
function sortCompare (x, y) {
  // 1. If x and y are both undefined, return +0.
  if (x === undefined && y === undefined) {
    return 0;
  }

  // 2. If x is undefined, return 1.
  if (x === undefined) {
    return 1;
  }

  // 3. If y is undefined, return -1.
  if (y === undefined) {
    return -1;
  }

  // 5. Let xString be ? ToString(x).
  x = String(x);

  // 6. Let yString be ? ToString(y).
  y = String(y);

  // 7. Let xSmaller be the result of performing Abstract Relational
  //    Comparison xString < yString.
  // 8. If xSmaller is true, return -1.
  // 9. Let ySmaller be the result of performing Abstract Relational
  //    Comparison yString < xString.
  // 10. If ySmaller is true, return 1.
  // 11. Return +0.
  return (x < y) ? -1 : (x > y) ? 1 : 0;
}
1270776
function sortObject(originalSrc, options, done) {
  var callback

  if (options === undefined) {
    // do nothing
  } else if (typeof options === "function") {
    callback = options
  } else {
    callback = done
  }

  if (callback) {
    process.nextTick(function() {
      done(work(originalSrc))
    })
    return
  }

  function work(obj) {
    try {
      // Uses module to sort all objects key names based on standard
      // string ordering.
      var deepSorted = deep_sort_object(obj)

      // Once object keys are sorted, we still need to check for arrays.
      var out = deepInspect(deepSorted)
      return out
    } catch (e) {
      console.log(e)
      throw e
    }
  }

  return work(originalSrc)
}
125431
function(to_clean) {
    _.map(to_clean, function(value, key, to_clean) {
      if (value === undefined) {
        delete to_clean[key];
      }
    });
    return to_clean;
  }
1310167
function orderAndSort(sortConf) {
    return {
        sortFieldName: sortConf.sortBy,
        sortDesc: sortConf.sortAsc === undefined ? false : !sortConf.sortAsc
    };
}
1027612
function orderBy(expression) {

        //Check arguments
        if (!expression)
            throw new Error("Expression is invalid");
		
		//Define sort action estracting values from objects
		var sortAction = function(a, b){
		
			//Get value for "a" and "b" element
			var aValue = expression(a);
			var bValue = expression(b);
		
			//Check if one element is greater then the second one
			if(aValue < bValue) return -1;
			if(aValue > bValue) return 1;
			return 0;
		};
		
		//Copy array in order to avoid modifications on original
		var outData = [];
		for(var i = 0; i < this.items.length; i++){
			outData.push(this.items[i]);
		}

        //Define output array
        var sortedData = outData.sort(sortAction);
        
        //Return for chaining
        return new jslinq(sortedData);
    }
1344278
function cleanData({dataByTopic, dataByDate, data}) {
            if (!dataByTopic && !data) {
                throw new Error('Data needs to have a dataByTopic or data property. See more in http://eventbrite.github.io/britecharts/global.html#LineChartData__anchor');
            }

            // If dataByTopic or data are not present, we generate them
            if (!dataByTopic) {
                dataByTopic = d3Collection.nest()
                    .key(getVariableTopicName)
                    .entries(data)
                    .map(d => ({
                            topic: d.values[0]['name'],
                            topicName: d.key,
                            dates: d.values
                        })
                    );
            } else {
                data = dataByTopic.reduce((accum, topic) => {
                    topic.dates.forEach((date) => {
                        accum.push({
                            topicName: topic[topicNameLabel],
                            name: topic[topicLabel],
                            date: date[dateLabel],
                            value: date[valueLabel]
                        });
                    });

                    return accum;
                }, []);
            }

            // Nest data by date and format
            dataByDate = d3Collection.nest()
                .key(getDate)
                .entries(data)
                .map((d) => {
                    return {
                        date: new Date(d.key),
                        topics: d.values
                    }
                });

            const normalizedDataByTopic = dataByTopic.reduce((accum, topic) => {
                let {dates, ...restProps} = topic;

                let newDates = dates.map(d => ({
                       date: new Date(d[dateLabel]),
                       value: +d[valueLabel]
                }));

                accum.push({ dates: newDates, ...restProps });

                return accum;
            }, []);

            return {
                dataByTopic: normalizedDataByTopic,
                dataByDate
            };
        }
1070854
function sortAttrs(arr) {
	const attrs = {};
	for (let i = 0, l = arr.length; i < l; i++) {
		if (/=/.test(arr[i])) {
			const firstEquals = arr[i].indexOf('=');
			const attr = arr[i].substr(0, firstEquals);
			const value = arr[i].substr(firstEquals + 1);
			let current = attrs[attr];
			if (current) {
				current += " " + value;
			} else {
				current = value;
			}
			attrs[attr] = current;
		}
	}
	return attrs;
}