Normalize order elements to Query::Direction instances

 @api private
199736
def normalize_order
      return if @order.nil?

      @order = Array(@order).map do |order|
        case order
          when Direction
            order.dup

          when Operator
            target   = order.target
            property = target.kind_of?(Property) ? target : @properties[target]

            Direction.new(property, order.operator)

          when Symbol, String
            Direction.new(@properties[order])

          when Property
            Direction.new(order)

          when Path
            Direction.new(order.property)

          else
            order
        end
      end
    end
257428
function(oCoords, i) {
      return {
        topline: {
          o: oCoords.tl,
          d: oCoords.tr
        },
        rightline: {
          o: oCoords.tr,
          d: oCoords.br
        },
        bottomline: {
          o: oCoords.br,
          d: oCoords.bl
        },
        leftline: {
          o: oCoords.bl,
          d: oCoords.tl
        }
      }
    }
1147745
def sort(self, *sort_tuples):
        ''' 
        '''
        query = self
        for name, direction in sort_tuples:
            field = resolve_name(self.type, name)
            if direction in (ASCENDING, 1):
                query = query.ascending(field)
            elif direction in (DESCENDING, -1):
                query = query.descending(field)
            else:
                raise BadQueryException('Bad sort direction: %s' % direction)
        return query
530218
def _normalize_direction(heading: int) -> int:
        
        while heading > 359:
            heading = int(heading - 359)
        while heading < 0:
            heading = int(heading + 359)
        return heading
828522
function findFirstNonvanishing (M, TOL) {
  const te = M.elements;
  const n = M.dimension;
  let rowCol = {
    row: 0,
    column: 0,
    value: te[0]
  };
  if (Compare.isZero(te[0], TOL)) {
    for (let i = 0; i < n; ++i) {
      for (let j = 0; j < n; ++j) {
        const val = te[i * n + j];
        if (!Compare.isZero(val, TOL)) {
          rowCol.row = j;
          rowCol.column = i;
          rowCol.value = val;
          return rowCol;
        }
      }
    }
  }
  return rowCol;
}
617638
def _normalize_orders(self):
        """"""
        orders = list(self._orders)
        _has_snapshot_cursor = False

        if self._start_at:
            if isinstance(self._start_at[0], document.DocumentSnapshot):
                _has_snapshot_cursor = True

        if self._end_at:
            if isinstance(self._end_at[0], document.DocumentSnapshot):
                _has_snapshot_cursor = True

        if _has_snapshot_cursor:
            should_order = [
                _enum_from_op_string(key)
                for key in _COMPARISON_OPERATORS
                if key not in (_EQ_OP, "array_contains")
            ]
            order_keys = [order.field.field_path for order in orders]
            for filter_ in self._field_filters:
                field = filter_.field.field_path
                if filter_.op in should_order and field not in order_keys:
                    orders.append(self._make_order(field, "ASCENDING"))
            if not orders:
                orders.append(self._make_order("__name__", "ASCENDING"))
            else:
                order_keys = [order.field.field_path for order in orders]
                if "__name__" not in order_keys:
                    direction = orders[-1].direction  # enum?
                    orders.append(self._make_order("__name__", direction))

        return orders
831179
function() {
			var barEl = this.get(BAR_EL);

			switch (this.get(DIRECTION)) {
				case DIRECTION_LTR:
				case DIRECTION_RTL:
					this._barSpace = parseInt(this.get(WIDTH),10) - 
						(parseInt(Dom.getStyle(barEl,'marginLeft'),10) || 0) -
						(parseInt(Dom.getStyle(barEl,'marginRight'),10) || 0);
					break;
				case DIRECTION_TTB:
				case DIRECTION_BTT:
					this._barSpace = parseInt(this.get(HEIGHT),10) -
						(parseInt(Dom.getStyle(barEl,'marginTop'),10) || 0)-
						(parseInt(Dom.getStyle(barEl,'marginBottom'),10) || 0); 
					break;
			}
			this._barFactor = this._barSpace / (this.get(MAX_VALUE) - (this.get(MIN_VALUE) || 0))  || 1;
		}
981742
function( useComputed ) {
			if ( useComputed ) {
				return this.getComputedStyle( 'direction' ) ||
						this.getDirection() ||
						this.getParent() && this.getParent().getDirection( 1 ) ||
						this.getDocument().$.dir ||
						'ltr';
			}
			else {
				return this.getStyle( 'direction' ) || this.getAttribute( 'dir' );
			}
		}
393545
function normalizeDirectives (options) {
  const dirs = options.directives
  if (dirs) {
    for (const key in dirs) {
      const def = dirs[key]
      if (typeof def === 'function') {
        dirs[key] = {bind: def, update: def}
      }
    }
  }
}
936173
function normalize(args) {
  let result = {
    queries:  null,
    callback: null
  };

  if (args.length === 1 && Array.isArray(args[0])) {
    result.queries = args[0];
  } else if (args.length === 2 && Array.isArray(args[0])) {
    result.queries = args[0];

    if (typeof args[1] === 'function') {
      result.callback = args[1];
    }
  } else {
    result.queries = args;

    if (typeof result.queries[result.queries.length - 1] === 'function') {
      result.callback = result.queries.pop();
    }
  }

  return result;
}
897434
def normalize(self):
        
        order = [
            'sld:Title', 'ogc:Filter', 'sld:MinScaleDenominator',
            'sld:MaxScaleDenominator', 'sld:PolygonSymbolizer',
            'sld:LineSymbolizer', 'sld:TextSymbolizer', 'sld:PointSymbolizer']
        for item in order:
            xpath = self._node.xpath(item, namespaces=SLDNode._nsmap)
            for xitem in xpath:
                # move this to the end
                self._node.remove(xitem)
                self._node.append(xitem)
1005161
function(anchor, direction) {
    // Need to do this so that line's properties are not
    // references to the arguments passed in
    anchor = Vector.create(anchor);
    direction = Vector.create(direction);
    if (anchor.elements.length == 2) {anchor.elements.push(0); }
    if (direction.elements.length == 2) { direction.elements.push(0); }
    if (anchor.elements.length > 3 || direction.elements.length > 3) { return null; }
    var mod = direction.modulus();
    if (mod === 0) { return null; }
    this.anchor = anchor;
    this.direction = Vector.create([
      direction.elements[0] / mod,
      direction.elements[1] / mod,
      direction.elements[2] / mod
    ]);
    return this;
  }
109280
function order (d, arr, visited) {
  for (let i in d) {
    if (!visited[i]) {
      let obj = d[i]
      visited[i] = true
      arr = arr.concat(order(obj, [], visited))
      if (css(i)) {
        arr.push(i)
      }
    }
  }
  return arr
}
358857
function orderBy( $column, $direction = "ASC" ) {

        $clone = clone $this;

        if ($direction===true) {
            $clone->orderBy[] = $column;
        }else{
            $clone->orderBy[] = $this->db->quoteIdentifier( $column ) . " " . $direction;
        }

        return $clone;

    }
1110059
public function orderBy($index, $direction = 'desc')
    {
        if ($direction != 'desc') {
            $direction = 'asc';
        }

        if (is_array($index)) {
            $this->attributes['order'][] = $index;
        } else {
            $this->attributes['order'][] = [$index, $direction];
        }

        return $this;
    }
377580
function buildOrderArray (order) {
    var direction = ''
    // check if last element is asc/desc
    if (order[order.length - 1].match(/^asc|desc$/i)) {
        var direction = order.pop().toUpperCase()
    }
    // join columns together and add direction
    this.order.push(
        _.map(order, columnName => {
            // split column on . to see if it has prefix
            var parts = columnName.split('.')
            // column does not have prefix
            if (parts.length === 1) {
                return this.alias+'.'+this.quoteName(this.model.columnName(columnName, true))
            }
            // column has prefix
            else if (parts.length === 2) {
                var prefix = parts[0]
                columnName = parts[1]
                // prefix must be for joined model
                assert.ok(this.joinRelations[prefix])
                // get join for table prefix
                var join = this.joinRelations[prefix]
                // get relation for model
                var relation = this.model.relation(prefix)
                // return order sql
                return join.relationAlias+'.'+this.quoteName(relation.model.columnName(columnName, true))
            }
            // error
            else {
                throw new Error('invalid column in order '+columnName)
            }
        }).join(', ')+' '+direction
    )
}
138896
function orderCoords(coords){
  if (config.coordinateOrder){
    return coords;
  }
  if (coords[2]){
    return [coords[1], coords[0], coords[2]];
  }
  return coords.reverse();
}