Socket
Socket
Sign inDemoInstall

@turf/invariant

Package Overview
Dependencies
Maintainers
4
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/invariant - npm Package Compare versions

Comparing version 5.2.0 to 6.0.0-beta.2

index.mjs

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": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc