MCPcopy Create free account
hub / github.com/Automattic/mongoose / convertSortToArray

Function convertSortToArray

lib/query.js:2296–2313  ·  view source on GitHub ↗
(opts)

Source from the content-addressed store, hash-verified

2294 */
2295
2296function convertSortToArray(opts) {
2297 if (Array.isArray(opts.sort)) {
2298 return;
2299 }
2300 if (!utils.isObject(opts.sort)) {
2301 return;
2302 }
2303
2304 var sort = [];
2305
2306 for (var key in opts.sort) {
2307 if (utils.object.hasOwnProperty(opts.sort, key)) {
2308 sort.push([key, opts.sort[key]]);
2309 }
2310 }
2311
2312 opts.sort = sort;
2313}
2314
2315/*!
2316 * Internal thunk for .update()

Callers 1

query.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected