mirror of
https://github.com/Turfjs/turf.git
synced 2026-01-25 16:07:00 +00:00
* @typescript-eslint/ban-types * @typescript-eslint/no-empty-function * @typescript-eslint/no-inferrable-types * @typescript-eslint/no-this-alias * no-case-declarations * no-cond-assign * no-dupe-else-if * no-empty * no-explicit-any * no-prototype-builtins * no-undef * no-unreachable * no-useless-escape * prefer-spread * comment the eslintrc * Almost had it * clearly my js trivia is not good enough today Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
29 lines
763 B
JavaScript
29 lines
763 B
JavaScript
const path = require("path");
|
|
const glob = require("glob");
|
|
const Benchmark = require("benchmark");
|
|
const load = require("load-json-file");
|
|
const bbox = require("@turf/bbox").default;
|
|
const isValid = require("./index").default;
|
|
|
|
/**
|
|
* Benchmark Results
|
|
*
|
|
*/
|
|
const suite = new Benchmark.Suite("turf-boolean-is-valid");
|
|
glob
|
|
.sync(path.join(__dirname, "test", "**", "*.geojson"))
|
|
.forEach((filepath) => {
|
|
const { name } = path.parse(filepath);
|
|
const geojson = load.sync(filepath);
|
|
const [feature1] = geojson.features;
|
|
|
|
feature1.bbox = bbox(feature1);
|
|
|
|
console.time(name);
|
|
isValid(feature1);
|
|
console.timeEnd(name);
|
|
suite.add(name, () => isValid(feature1));
|
|
});
|
|
|
|
suite.on("cycle", (e) => console.log(String(e.target))).run();
|