Alphabetically sorts every property in an object and in any array values.
182004
function sortObject(object) {
    var keys = Object.keys(object);
    var sorted = {};

    var options = {
      sensitivity: 'base'
    };

    function compare(a, b) {
      return a.localeCompare(b, options);
    }

    keys.sort(compare);

    for (var index in keys) {
      if (keys[index]) {
        var key = keys[index];

        if (Array.isArray(object[key])) {
          sorted[key] = object[key].sort(compare);
        } else if (typeof object[key] === 'object') {
          sorted[key] = sortObject(object[key]);
        } else {
          sorted[key] = object[key];
        }
      }
    }

    return sorted;
  }
1064504
private SortedMap<String, ModelProperty> sort(Map<String, ModelProperty> modelProperties) {

    SortedMap<String, ModelProperty> sortedMap = new TreeMap<String, ModelProperty>(defaultOrdering(modelProperties));
    sortedMap.putAll(modelProperties);
    return sortedMap;
  }
162946
def sortBy(self, val=None):
        
        if val is not None:
            if _(val).isString():
                return self._wrap(sorted(self.obj, key=lambda x,
                                  *args: x.get(val)))
            else:
                return self._wrap(sorted(self.obj, key=val))
        else:
            return self._wrap(sorted(self.obj))
202538
function sort(property) {
  // sort by multiple properties
  function multisort(properties) {
    return function multiCompare(a, b) {
      var i = 0;
      var result = 0;
      var numberOfProperties = properties.length;
      while(result === 0 && i < numberOfProperties) {
        result = sort(properties[i])(a, b);
        i++;
      }
      return result;
    };
  }

  if (_.isArray(property)) return multisort(property);
  debug('sorting by %s', property || '');
  var sortOrder = 1;
  // property may be preparsed object
  if (_.isObject(property)) {
    var propertyKey = _.keys(property)[0];
    sortOrder = property[propertyKey];
    property = propertyKey;
  }
  else if (property[0] === '-') {
    sortOrder = -1;
    property = property.substr(1);
  }
  function compare(a, b) {
    var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;
    return result * sortOrder;
  }
  return compare;
}
636740
function _sortPropertyContainers(obj, key) {
        if (_smellsLikeAPropertyContainer(obj)) {
            return _.mapValues(obj, _sortElements);
        }
        else {
            return obj;
        }
    }
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;
}
69225
function _sortElements(obj, key) {
        if (_smellsLikeArrayOfElements(obj)) {
            obj[1] = obj[1].sort(_compareById);
        }
        return obj;
    }
282520
function (prop, fn) {
    if (typeof prop === 'function') {
      fn = prop;
      prop = undefined;
    }

    var items = this.items;
    this.items = lazy.sortObj(items, {
      prop: prop,
      get: fn
    });
    return this;
  }
1075392
function propertySort(itemsKey, sortPropertiesKey) {
  let activeObserversMap = new WeakMap();
  let sortPropertyDidChangeMap = new WeakMap();

  if (EMBER_METAL_TRACKED_PROPERTIES) {
    let cp = computed(`${itemsKey}.[]`, `${sortPropertiesKey}.[]`, function(key) {
      let sortProperties = get(this, sortPropertiesKey);

      assert(
        `The sort definition for '${key}' on ${this} must be a function or an array of strings`,
        isArray(sortProperties) && sortProperties.every(s => typeof s === 'string')
      );

      let itemsKeyIsAtThis = itemsKey === '@this';
      let normalizedSortProperties = normalizeSortProperties(sortProperties);

      let items = itemsKeyIsAtThis ? this : get(this, itemsKey);
      if (!isArray(items)) {
        return emberA();
      }

      if (normalizedSortProperties.length === 0) {
        return emberA(items.slice());
      } else {
        return sortByNormalizedSortProperties(items, normalizedSortProperties);
      }
    }).readOnly();

    descriptorForDecorator(cp).auto();

    return cp;
  } else {
    return computed(`${sortPropertiesKey}.[]`, function(key) {
      let sortProperties = get(this, sortPropertiesKey);

      assert(
        `The sort definition for '${key}' on ${this} must be a function or an array of strings`,
        isArray(sortProperties) && sortProperties.every(s => typeof s === 'string')
      );

      // Add/remove property observers as required.
      let activeObservers = activeObserversMap.get(this);

      if (!sortPropertyDidChangeMap.has(this)) {
        sortPropertyDidChangeMap.set(this, function() {
          notifyPropertyChange(this, key);
        });
      }

      let sortPropertyDidChange = sortPropertyDidChangeMap.get(this);

      if (activeObservers !== undefined) {
        activeObservers.forEach(path => removeObserver(this, path, sortPropertyDidChange));
      }

      let itemsKeyIsAtThis = itemsKey === '@this';
      let normalizedSortProperties = normalizeSortProperties(sortProperties);
      if (normalizedSortProperties.length === 0) {
        let path = itemsKeyIsAtThis ? `[]` : `${itemsKey}.[]`;
        addObserver(this, path, sortPropertyDidChange);
        activeObservers = [path];
      } else {
        activeObservers = normalizedSortProperties.map(([prop]) => {
          let path = itemsKeyIsAtThis ? `@each.${prop}` : `${itemsKey}.@each.${prop}`;
          addObserver(this, path, sortPropertyDidChange);
          return path;
        });
      }

      activeObserversMap.set(this, activeObservers);

      let items = itemsKeyIsAtThis ? this : get(this, itemsKey);
      if (!isArray(items)) {
        return emberA();
      }

      if (normalizedSortProperties.length === 0) {
        return emberA(items.slice());
      } else {
        return sortByNormalizedSortProperties(items, normalizedSortProperties);
      }
    }).readOnly();
  }
}
1019246
def sort(self, *args, **kwargs):
		""""""
		self._list.sort(*args, **kwargs)
		for index, value in enumerate(self._list):
			self._dict[value] = index
222928
function(items) {
            var hasRelativePositioning = hasNumberProperty(items, 'relativePosition');

            if(hasRelativePositioning) {
                items.sort(function(a, b) {
                    return a.relativePosition - b.relativePosition;
                });
            }
        }
1132997
function sortedKeys(obj, orderedKeys) {
    var keys = Object.keys(obj).sort();
    var fresh = {};

    orderedKeys.forEach(function (key) {
        if (keys.indexOf(key) === -1) {
            return;
        }

        fresh[key] = obj[key];
    });

    keys.forEach(function (key) {
        if (orderedKeys.indexOf(key) !== -1) {
            return;
        }

        fresh[key] = obj[key];
    });

    return fresh;
}
73818
function (locationsarray) {
			this.writeDebug('sortNumerically',arguments);
			var property = (
				this.settings.sortBy !== null &&
				this.settings.sortBy.hasOwnProperty('prop') &&
				typeof this.settings.sortBy.prop !== 'undefined'
			) ?  this.settings.sortBy.prop : 'distance';

			if (this.settings.sortBy !== null && this.settings.sortBy.hasOwnProperty('order') && this.settings.sortBy.order.toString() === 'desc') {
				locationsarray.sort(function (a, b) {
					return ((b[property] < a[property]) ? -1 : ((b[property] > a[property]) ? 1 : 0));
				});
			} else {
				locationsarray.sort(function (a, b) {
					return ((a[property] < b[property]) ? -1 : ((a[property] > b[property]) ? 1 : 0));
				});
			}
		}
1051363
function sortObj(obj) {
    return Object.keys(obj).sort()
        .filter(key => obj[key] || obj[key] === 0)
        .reduce((acc, key) => ({ ...acc, [key]: obj[key] }), {});
}
476413
def csort(objs, key):
    """"""
    idxs = dict((obj, i) for (i, obj) in enumerate(objs))
    return sorted(objs, key=lambda obj: (key(obj), idxs[obj]))
49831
function sort(store, sortKey, descending) {
      var data = store.data.asObject();
      var sortedData = {};
      var keyValueArray = [];
      // Store key value for each data item
      for (var key in data) {
        keyValueArray.push(data[key]);
      }
      // Sort keys
      if (descending) {
        // Use native javascript sort api for string and boolean values
        if (
          typeof keyValueArray[0][sortKey] === "string" ||
          typeof keyValueArray[0][sortKey] === "boolean"
        ) {
          // Default sort
          keyValueArray.sort(function(a, b) {
            return a[sortKey] < b[sortKey] ? 1 : -1;
          });
        } else {
          // Show as object use warning
          vcomet.warn.log(
            "store",
            "asObject() function will reorder sorted data with an integer idProperty"
          );
          // Descending sorting for number values
          keyValueArray.sort(function(a, b) {
            var value =
              (!b[sortKey] ? 0 : b[sortKey]) - (!a[sortKey] ? 0 : a[sortKey]);
            // Avoid empty values
            return value;
          });
        }
      } else {
        // Use native javascript sort api for string and boolean values
        if (
          typeof keyValueArray[0][sortKey] === "string" ||
          typeof keyValueArray[0][sortKey] === "boolean"
        ) {
          // Default ascending sort
          keyValueArray.sort(function(a, b) {
            return a[sortKey] > b[sortKey] ? 1 : -1;
          });
        } else {
          // Show as object use warning
          vcomet.warn.log(
            "store",
            "asObject() function will reorder sorted data with an integer idProperty"
          );
          keyValueArray.sort(function(a, b) {
            var value =
              (!a[sortKey] ? 0 : a[sortKey]) - (!b[sortKey] ? 0 : b[sortKey]);
            // Avoid empty values
            return value === 0 ? 1 : value;
          });
        }
      }
      // Update store data object
      store.data = new Result(keyValueArray, store, true);
    }
289794
function multisort(properties) {
    return function multiCompare(a, b) {
      var i = 0;
      var result = 0;
      var numberOfProperties = properties.length;
      while(result === 0 && i < numberOfProperties) {
        result = sort(properties[i])(a, b);
        i++;
      }
      return result;
    };
  }