@turf/invariant
Advanced tools
Comparing version 5.2.0 to 6.0.0-beta.2
36
index.js
@@ -1,3 +0,7 @@ | ||
import { isNumber } from '@turf/helpers'; | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var helpers = require('@turf/helpers'); | ||
/** | ||
@@ -15,3 +19,3 @@ * Unwrap a coordinate from a Point Feature, Geometry or a single coordinate. | ||
*/ | ||
export function getCoord(coord) { | ||
function getCoord(coord) { | ||
if (!coord) throw new Error('coord is required'); | ||
@@ -37,3 +41,3 @@ if (coord.type === 'Feature' && coord.geometry !== null && coord.geometry.type === 'Point') return coord.geometry.coordinates; | ||
*/ | ||
export function getCoords(coords) { | ||
function getCoords(coords) { | ||
if (!coords) throw new Error('coords is required'); | ||
@@ -60,4 +64,4 @@ | ||
*/ | ||
export function containsNumber(coordinates) { | ||
if (coordinates.length > 1 && isNumber(coordinates[0]) && isNumber(coordinates[1])) { | ||
function containsNumber(coordinates) { | ||
if (coordinates.length > 1 && helpers.isNumber(coordinates[0]) && helpers.isNumber(coordinates[1])) { | ||
return true; | ||
@@ -81,3 +85,3 @@ } | ||
*/ | ||
export function geojsonType(value, type, name) { | ||
function geojsonType(value, type, name) { | ||
if (!type || !name) throw new Error('type and name required'); | ||
@@ -100,3 +104,3 @@ | ||
*/ | ||
export function featureOf(feature, type, name) { | ||
function featureOf(feature, type, name) { | ||
if (!feature) throw new Error('No feature passed'); | ||
@@ -122,3 +126,3 @@ if (!name) throw new Error('.featureOf() requires a name'); | ||
*/ | ||
export function collectionOf(featureCollection, type, name) { | ||
function collectionOf(featureCollection, type, name) { | ||
if (!featureCollection) throw new Error('No featureCollection passed'); | ||
@@ -158,3 +162,3 @@ if (!name) throw new Error('.collectionOf() requires a name'); | ||
*/ | ||
export function getGeom(geojson) { | ||
function getGeom(geojson) { | ||
if (!geojson) throw new Error('geojson is required'); | ||
@@ -171,3 +175,3 @@ if (geojson.geometry !== undefined) return geojson.geometry; | ||
*/ | ||
export function getGeomType() { | ||
function getGeomType() { | ||
throw new Error('invariant.getGeomType has been deprecated in v5.0 in favor of invariant.getType'); | ||
@@ -194,3 +198,3 @@ } | ||
*/ | ||
export function getType(geojson, name) { | ||
function getType(geojson, name) { | ||
if (!geojson) throw new Error((name || 'geojson') + ' is required'); | ||
@@ -203,1 +207,11 @@ // GeoJSON Feature & GeometryCollection | ||
} | ||
exports.getCoord = getCoord; | ||
exports.getCoords = getCoords; | ||
exports.containsNumber = containsNumber; | ||
exports.geojsonType = geojsonType; | ||
exports.featureOf = featureOf; | ||
exports.collectionOf = collectionOf; | ||
exports.getGeom = getGeom; | ||
exports.getGeomType = getGeomType; | ||
exports.getType = getType; |
{ | ||
"name": "@turf/invariant", | ||
"version": "5.2.0", | ||
"version": "6.0.0-beta.2", | ||
"description": "turf invariant module", | ||
"main": "main.js", | ||
"module": "main.es.js", | ||
"main": "index", | ||
"types": "index.d.ts", | ||
"files": [ | ||
"index.js", | ||
"index.d.ts", | ||
"main.js", | ||
"main.es.js" | ||
"index.mjs", | ||
"index.d.ts" | ||
], | ||
"scripts": { | ||
"pretest": "rollup -c ../../rollup.config.js", | ||
"test": "node -r @std/esm test.js", | ||
"posttest": "node -r @std/esm ../../scripts/validate-es5-dependencies.js", | ||
"bench": "node -r @std/esm bench.js", | ||
"pretest": "rollup -f cjs -i index.mjs -o index.js", | ||
"test": "node test.js", | ||
"posttest": "node ../../scripts/validate-es5-dependencies.js", | ||
"bench": "node bench.js", | ||
"docs": "node ../../scripts/generate-readmes" | ||
@@ -47,3 +45,3 @@ }, | ||
"dependencies": { | ||
"@turf/helpers": "^5.1.5" | ||
"@turf/helpers": "6.0.0-beta.2" | ||
}, | ||
@@ -50,0 +48,0 @@ "@std/esm": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25246
6
423
1
1
+ Added@turf/helpers@6.0.0-beta.2(transitive)
- Removed@turf/helpers@5.1.5(transitive)
Updated@turf/helpers@6.0.0-beta.2