Return ordered list of Backbone.js Models. This output can be fed into
SailsBackboneClient.parse().

@see <https://github.com/tjwebb/sails-backbone#browser-client>
344164
function (req, res) {
    BackboneModel
      .find(_.extend({ limit: 999 }, req.query))
      .then(function (models) {
        res.json(_.pluck(models, 'json'));
      })
      .catch(function (error) {
        sails.log.error(error);
        res.status(500).json(error);
      });
  }
499206
function loadModels() {
  const modelSpecsPath = path.join(process.cwd(), plugin.config.modelsPath);

  return plugin.myrmex.fire('beforeModelsLoad')
  .spread(() => {
    return Promise.promisify(fs.readdir)(modelSpecsPath);
  })
  .then(fileNames => {
    // Load all the model specifications
    return Promise.map(fileNames, fileName => {
      const modelSpecPath = path.join(modelSpecsPath, fileName);
      const modelName = path.parse(fileName).name;
      return loadModel(modelSpecPath, modelName);
    });
  })
  .then(models => {
    return plugin.myrmex.fire('afterModelsLoad', models);
  })
  .spread(models => {
    return Promise.resolve(models);
  })
  .catch(e => {
    if (e.code === 'ENOENT' && path.basename(e.path) === path.basename(plugin.config.modelsPath)) {
      return Promise.resolve([]);
    }
    Promise.reject(e);
  });
}
917209
function(model, value, context) {
      value || (value = this.comparator);
      var iterator = _.isFunction(value) ? value : function(model) {
        return model.get(value);
      };
      return _.sortedIndex(this.models, model, iterator, context);
    }
770740
def get_list_header(self):
        
        model = self.object_list.model
        result = []
        if not self.get_fields():
            result.append(
                {"name": "", "verbose": str(model._meta.verbose_name)}
            )
        else:
            prefix = self.get_prefix()
            ordering_fields = self.get_ordering_fields()
            for field_name in self.get_fields():
                item = {}
                if isinstance(field_name, tuple):
                    # custom property that is not a field of the model
                    name = field_name[0]
                    item["label"] = field_name[1]
                else:
                    name = field_name
                    try:
                        field_meta = find_field_meta(model, field_name)
                        if field_meta._verbose_name:  # noqa
                            # explicitly set on the model, so don't change
                            item["label"] = field_meta._verbose_name  # noqa
                        else:
                            # title-case the field name (issue #80)
                            item["label"] = field_meta.verbose_name.title()
                    except FieldDoesNotExist:
                        item["label"] = field_name
                    except AttributeError:
                        item["label"] = field_name
                item["name"] = prefix + name
                if name in ordering_fields:
                    item["order_url"], item[
                        "order_direction"
                    ] = self.ordering_url(name)
                result.append(item)

        return result
607682
function(models){
        var currentLen = this.length;

        // Cloning after converting to an Array because it should be dereferenced
        // in order to continue the while loop when erasing from this._models
        models = Array.from(models).slice();

        this.act(function(){
            var l = models.length,
                i = 0;

            while(l--){
                this._remove(models[i++]);
            }
        });

        // Signal change when the collection of models change
        if (!this.isActive() && this._changed) {
             this.signalChange();

             this.resetChange();
        }

        return this;
    }
1144419
function getModel (app, name, Model) {
  const mongooseClient = app.get('mongoose');
  assert(mongooseClient, 'mongoose client not set by app');
  const modelNames = mongooseClient.modelNames();
  if (modelNames.includes(name)) {
    return mongooseClient.model(name);
  } else {
    assert(Model && typeof Model === 'function', 'Model function not privided.');
    return Model(app, name);
  }
}
947085
private List<OrderSpecifier> getOrderByList(HttpServletRequest request) throws Exception {
		String[] orderByStrings = request.getParameterValues("orderBy");
		if( null == orderByStrings ) {
			return null;
		}
		if( 0 == orderByStrings.length ) {
			return null;
		}
		
		List<OrderSpecifier> result = new Vector<OrderSpecifier>();
		
		for(String orderByString : orderByStrings) {
			OrderSpecifier orderSpecifier = parseOrderSpecifier(orderByString);
			result.add(orderSpecifier);
		}

		return result;
	}
1238443
function (bbsource) {
    var parts = {
      Header: '',
      Setup: '// Initial Setup',
      Events: '// Backbone.Events',
      Model: '// Backbone.Model',
      Collection: '// Backbone.Collection',
      Router: '// Backbone.Router',
      History: '// Backbone.History',
      View: '// Backbone.View',
      Sync: '// Backbone.sync',
      Helpers: '// Helpers'
    };


    // index & module helper
    var lastPos = 0;
    var temp = 0;
    var keys = Object.keys(parts);

    // extract every module
    keys.forEach(function (key, idx) {
      temp = typeof keys[idx + 1] !== 'undefined' ? bbsource.search(parts[keys[idx + 1]]) : bbsource.length;
      parts[key] = extract(bbsource, lastPos, temp);
      lastPos = temp;
    });

    return parts;
  }
363049
function() {
			// If this Model has already been fully serialized in this branch once, return to avoid loops
			if ( this.isLocked() ) {
				return this.id;
			}
			
			this.acquire();
			var json = Backbone.Model.prototype.toJSON.call( this );
			
			if ( this.constructor._superModel && !( this.constructor._subModelTypeAttribute in json ) ) {
				json[ this.constructor._subModelTypeAttribute ] = this.constructor._subModelTypeValue;
			}
			
			_.each( this._relations, function( rel ) {
					var value = json[ rel.key ];

					if ( rel.options.includeInJSON === true) {
						if ( value && _.isFunction( value.toJSON ) ) {
							json[ rel.keyDestination ] = value.toJSON();
						}
						else {
							json[ rel.keyDestination ] = null;
						}
					}
					else if ( _.isString( rel.options.includeInJSON ) ) {
						if ( value instanceof Backbone.Collection ) {
							json[ rel.keyDestination ] = value.pluck( rel.options.includeInJSON );
						}
						else if ( value instanceof Backbone.Model ) {
							json[ rel.keyDestination ] = value.get( rel.options.includeInJSON );
						}	
						else {
							json[ rel.keyDestination ] = null;
						}
					}
					else if ( _.isArray( rel.options.includeInJSON ) ) {
						if ( value instanceof Backbone.Collection ) {
							var valueSub = [];
							value.each( function( model ) {
								var curJson = {};
								_.each( rel.options.includeInJSON, function( key ) {
									curJson[ key ] = model.get( key );
								});
								valueSub.push( curJson );
							});
							json[ rel.keyDestination ] = valueSub;
						}
						else if ( value instanceof Backbone.Model ) {
							var valueSub = {};
							_.each( rel.options.includeInJSON, function( key ) {
								valueSub[ key ] = value.get( key );
							});
							json[ rel.keyDestination ] = valueSub;
						}
						else {
							json[ rel.keyDestination ] = null;
						}
					}
					else {
						delete json[ rel.key ];
					}

					if ( rel.keyDestination !== rel.key ) {
						delete json[ rel.key ];
					}
				});
			
			this.release();
			return json;
		}
128818
function getDbIndexes(modelKlass) {
    const modelName = modelKlass.constructor.name;
    return modelName === "Model"
        ? typed_conversions_1.hashToArray(exports.indexesForModel[modelName])
        : (typed_conversions_1.hashToArray(exports.indexesForModel[modelName]) || []).concat(typed_conversions_1.hashToArray(exports.indexesForModel.Model));
}
1299645
def _compile_models(custom_models):
    
    ordered_models = sorted(custom_models.values(), key=lambda model: model.full_name)
    custom_impls = {}

    dependencies = []
    for model in ordered_models:
        dependencies.extend(list(model.dependencies.items()))

    if dependencies:
        dependencies = sorted(dependencies, key=lambda name_version: name_version[0])
        _run_npmjs(["install", "--no-progress"] + [ name + "@" + version for (name, version) in dependencies ])

    for model in ordered_models:
        impl = model.implementation
        compiled = _CACHING_IMPLEMENTATION(model, impl)
        if compiled is None:
            compiled = nodejs_compile(impl.code, lang=impl.lang, file=impl.file)

        if "error" in compiled:
            raise CompilationError(compiled.error)

        custom_impls[model.full_name] = compiled

    return custom_impls
818995
function(req) {

    // Ensure a model can be deduced from the request options.
    var model = req.options.model || req.options.controller;
    if (!model) {
      throw new Error('No "model" specified in route options.');
    }

    var Model = req._sails.models[model];
    if (!Model) {
      throw new Error('Invalid route option, "model". No model named: ' + model);
    }

    return Model;
  }
743420
function(model) {
    var fields = _.keys(model);
    var updated = {};

    _.each(fields, function(field) {
        var updatedField = {};
        var modelField = {};
        if (!(field === Object(field))) {
            updatedField.field = field;
            if (!(model[field] === Object(model[field]))) {
                modelField = { type: model[field] };
            } else {
                modelField = model[field];
            }
            updatedField = _.defaults(updatedField, modelField);
        } else {
            updatedField = field;
        }
        updated[updatedField.field] = updatedField;
    });

    return updated;
}
544583
def list(self):
        
        resp = self.client.api.plugins()
        return [self.prepare_model(r) for r in resp]
57890
def sort_models(self):
        
        model_names = [
            table.name for table in self.Base.metadata.sorted_tables if table.name in self.models
        ]
        logger.debug("Unsorted models: %s", model_names)
        model_count = len(model_names)

        swapped = True
        sort_round = 0
        while swapped:
            sort_round += 1
            logger.debug('Sorting round: %d (%s)', sort_round, model_names)

            sorted_models = []
            for i in range(model_count):
                model = self.models[model_names[i]]
                # check if this model has any dependencies which haven't been taken care of in this round
                for foreign_model_name in model.foreign_models:
                    if foreign_model_name not in sorted_models:
                        sorted_models.append(foreign_model_name)

                if model.name not in sorted_models:
                    sorted_models.append(model.name)

            # we're done here (no changes after this sorting round)
            if model_names == sorted_models:
                swapped = False

            model_names = sorted_models

        logger.debug("Sorted models: %s (%d rounds)", model_names, sort_round)
        return model_names
1361079
public function getModels()
    {
        // First, we will simply get the raw results from the query builders which we
        // can use to populate an array with Eloquent models. We will pass columns
        // that should be selected as well, which are typically just everything.
        $results = $this->query->get();

        $connection = $this->model->getConnectionName();

        $models = [];

        // Once we have the results, we can spin through them and instantiate a fresh
        // model instance for each records we retrieved from the database. We will
        // also set the proper connection name for the model after we create it.
        foreach ($results as $result) {
            $models[] = $model = $this->model->newFromBuilder($result);

            $model->setConnection($connection);
        }

        return $models;
    }
602513
def _get_next_or_previous_by_order(self, is_next, **kwargs):
        
        lookup = self.with_respect_to()
        lookup["_order"] = self._order + (1 if is_next else -1)
        concrete_model = base_concrete_model(Orderable, self)
        try:
            queryset = concrete_model.objects.published
        except AttributeError:
            queryset = concrete_model.objects.filter
        try:
            return queryset(**kwargs).get(**lookup)
        except concrete_model.DoesNotExist:
            pass