How to use the alasql.MAXSQLCACHESIZE function in alasql

To help you get started, we’ve selected a few alasql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github koopjs / winnow / src / sql.js View on Github external
const sql = require('alasql')
const geohash = require('ngeohash')
const centroid = require('@turf/centroid').default
const _ = require('lodash')
const projectCoordinates = require('./geometry/project-coordinates')
const reducePrecision = require('./geometry/reduce-precision')

// Try to require farmhash, as it is an optional depenecy we can fall back to JavaScript only hashing library
let hashFunction
try {
  hashFunction = require('farmhash').hash32
} catch (e) {
  hashFunction = require('string-hash')
}

sql.MAXSQLCACHESIZE = 0

sql.fn.ST_Within = function (feature = {}, filterGeom = {}) {
  if (!(feature && feature.type && feature.coordinates && feature.coordinates.length > 0)) return false
  const filter = new Terraformer.Primitive(filterGeom)
  const TfFeature = new Terraformer.Primitive(feature)
  return TfFeature.within(filter)
}

sql.fn.ST_Contains = function (feature = {}, filterGeom = {}) {
  if (!(feature && feature.type && feature.coordinates && feature.coordinates.length > 0)) return false
  const filter = new Terraformer.Primitive(filterGeom)
  const TfFeature = new Terraformer.Primitive(feature)
  return filter.contains(TfFeature)
}

sql.fn.ST_Intersects = function (feature = {}, filterGeom = {}) {

alasql

Use SQL to select and filter javascript data - including relational joins and search in nested objects (JSON). Export to and import from Excel and CSV

MIT
Latest version published 2 months ago

Package Health Score

87 / 100
Full package analysis