Sha256: a6230cd736d8555fe452954f19fe8277d3f7039fe9392be1a05b626bb33ca23a

Contents?: true

Size: 868 Bytes

Versions: 10

Compression:

Stored size: 868 Bytes

Contents

/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
"use strict";
module.exports = function compareLocations(a, b) {
	if(typeof a === "string") {
		if(typeof b === "string") {
			if(a < b) return -1;
			if(a > b) return 1;
			return 0;
		} else if(typeof b === "object") {
			return 1;
		} else {
			return 0;
		}
	} else if(typeof a === "object") {
		if(typeof b === "string") {
			return -1;
		} else if(typeof b === "object") {
			if(a.start && b.start) {
				const ap = a.start;
				const bp = b.start;
				if(ap.line < bp.line) return -1;
				if(ap.line > bp.line) return 1;
				if(ap.column < bp.column) return -1;
				if(ap.column > bp.column) return 1;
			}
			if(a.index < b.index) return -1;
			if(a.index > b.index) return 1;
			return 0;
		} else {
			return 0;
		}
	}
};

Version data entries

10 entries across 6 versions & 3 rubygems

Version Path
ilog-0.4.1 node_modules/webpack/lib/compareLocations.js
ilog-0.4.0 node_modules/webpack/lib/compareLocations.js
ilog-0.3.3 node_modules/webpack/lib/compareLocations.js
optimacms-0.4.3 spec/dummy/node_modules/@rails/webpacker/node_modules/webpack/node_modules/webpack/lib/compareLocations.js
optimacms-0.4.3 spec/dummy/node_modules/@rails/webpacker/node_modules/webpack/lib/compareLocations.js
optimacms-0.4.3 spec/dummy/node_modules/webpack/lib/compareLocations.js
optimacms-0.4.2 spec/dummy/node_modules/@rails/webpacker/node_modules/webpack/lib/compareLocations.js
optimacms-0.4.2 spec/dummy/node_modules/webpack/lib/compareLocations.js
optimacms-0.4.2 spec/dummy/node_modules/@rails/webpacker/node_modules/webpack/node_modules/webpack/lib/compareLocations.js
cortex-0.1.3 spec/dummy/node_modules/webpack/lib/compareLocations.js