Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/invariant

Package Overview
Dependencies
Maintainers
6
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 6.2.0-alpha.2 to 6.2.0-alpha.3

dist/es/package.json

38

dist/es/index.js

@@ -19,3 +19,5 @@ import { isNumber, } from "@turf/helpers";

if (!Array.isArray(coord)) {
if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
if (coord.type === "Feature" &&
coord.geometry !== null &&
coord.geometry.type === "Point") {
return coord.geometry.coordinates;

@@ -27,3 +29,6 @@ }

}
if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
if (Array.isArray(coord) &&
coord.length >= 2 &&
!Array.isArray(coord[0]) &&
!Array.isArray(coord[1])) {
return coord;

@@ -71,3 +76,5 @@ }

export function containsNumber(coordinates) {
if (coordinates.length > 1 && isNumber(coordinates[0]) && isNumber(coordinates[1])) {
if (coordinates.length > 1 &&
isNumber(coordinates[0]) &&
isNumber(coordinates[1])) {
return true;

@@ -94,3 +101,8 @@ }

if (!value || value.type !== type) {
throw new Error("Invalid input to " + name + ": must be a " + type + ", given " + value.type);
throw new Error("Invalid input to " +
name +
": must be a " +
type +
", given " +
value.type);
}

@@ -119,3 +131,8 @@ }

if (!feature.geometry || feature.geometry.type !== type) {
throw new Error("Invalid input to " + name + ": must be a " + type + ", given " + feature.geometry.type);
throw new Error("Invalid input to " +
name +
": must be a " +
type +
", given " +
feature.geometry.type);
}

@@ -149,3 +166,8 @@ }

if (!feature.geometry || feature.geometry.type !== type) {
throw new Error("Invalid input to " + name + ": must be a " + type + ", given " + feature.geometry.type);
throw new Error("Invalid input to " +
name +
": must be a " +
type +
", given " +
feature.geometry.type);
}

@@ -182,3 +204,3 @@ }

* @param {GeoJSON} geojson GeoJSON object
* @param {string} [name="geojson"] name of the variable to display in error message
* @param {string} [name="geojson"] name of the variable to display in error message (unused)
* @returns {string} GeoJSON type

@@ -197,3 +219,3 @@ * @example

*/
export function getType(geojson, name) {
export function getType(geojson, _name) {
if (geojson.type === "FeatureCollection") {

@@ -200,0 +222,0 @@ return "FeatureCollection";

@@ -91,3 +91,3 @@ import { Feature, FeatureCollection, Geometries, GeometryCollection, Point } from "@turf/helpers";

* @param {GeoJSON} geojson GeoJSON object
* @param {string} [name="geojson"] name of the variable to display in error message
* @param {string} [name="geojson"] name of the variable to display in error message (unused)
* @returns {string} GeoJSON type

@@ -106,2 +106,2 @@ * @example

*/
export declare function getType(geojson: Feature<any> | FeatureCollection<any> | Geometries | GeometryCollection, name?: string): string;
export declare function getType(geojson: Feature<any> | FeatureCollection<any> | Geometries | GeometryCollection, _name?: string): string;

@@ -21,3 +21,5 @@ "use strict";

if (!Array.isArray(coord)) {
if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
if (coord.type === "Feature" &&
coord.geometry !== null &&
coord.geometry.type === "Point") {
return coord.geometry.coordinates;

@@ -29,3 +31,6 @@ }

}
if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
if (Array.isArray(coord) &&
coord.length >= 2 &&
!Array.isArray(coord[0]) &&
!Array.isArray(coord[1])) {
return coord;

@@ -75,3 +80,5 @@ }

function containsNumber(coordinates) {
if (coordinates.length > 1 && helpers_1.isNumber(coordinates[0]) && helpers_1.isNumber(coordinates[1])) {
if (coordinates.length > 1 &&
helpers_1.isNumber(coordinates[0]) &&
helpers_1.isNumber(coordinates[1])) {
return true;

@@ -99,3 +106,8 @@ }

if (!value || value.type !== type) {
throw new Error("Invalid input to " + name + ": must be a " + type + ", given " + value.type);
throw new Error("Invalid input to " +
name +
": must be a " +
type +
", given " +
value.type);
}

@@ -125,3 +137,8 @@ }

if (!feature.geometry || feature.geometry.type !== type) {
throw new Error("Invalid input to " + name + ": must be a " + type + ", given " + feature.geometry.type);
throw new Error("Invalid input to " +
name +
": must be a " +
type +
", given " +
feature.geometry.type);
}

@@ -156,3 +173,8 @@ }

if (!feature.geometry || feature.geometry.type !== type) {
throw new Error("Invalid input to " + name + ": must be a " + type + ", given " + feature.geometry.type);
throw new Error("Invalid input to " +
name +
": must be a " +
type +
", given " +
feature.geometry.type);
}

@@ -191,3 +213,3 @@ }

* @param {GeoJSON} geojson GeoJSON object
* @param {string} [name="geojson"] name of the variable to display in error message
* @param {string} [name="geojson"] name of the variable to display in error message (unused)
* @returns {string} GeoJSON type

@@ -206,3 +228,3 @@ * @example

*/
function getType(geojson, name) {
function getType(geojson, _name) {
if (geojson.type === "FeatureCollection") {

@@ -209,0 +231,0 @@ return "FeatureCollection";

{
"name": "@turf/invariant",
"version": "6.2.0-alpha.2",
"version": "6.2.0-alpha.3",
"description": "turf invariant module",

@@ -29,2 +29,6 @@ "author": "Turf Authors",

"module": "dist/es/index.js",
"exports": {
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
},
"types": "dist/js/index.d.ts",

@@ -36,11 +40,10 @@ "sideEffects": false,

"scripts": {
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"bench": "ts-node bench.js",
"build": "npm-run-all build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "node ../../scripts/generate-readmes",
"prepare": "npm-run-all prepare:*",
"prepare:es": "tsc --outDir dist/es --module esnext --declaration false",
"prepare:js": "tsc",
"test": "npm-run-all prepare test:*",
"test:tape": "node -r esm test.js",
"test:types": "tsc --noEmit types.ts"
"test": "npm-run-all test:*",
"test:tape": "ts-node -r esm test.js",
"test:types": "tsc --esModuleInterop --noEmit types.ts"
},

@@ -51,2 +54,3 @@ "devDependencies": {

"tape": "*",
"ts-node": "*",
"tslint": "*",

@@ -56,5 +60,5 @@ "typescript": "*"

"dependencies": {
"@turf/helpers": "^6.2.0-alpha.2"
"@turf/helpers": "^6.2.0-alpha.3"
},
"gitHead": "23d5cb91d77e0c1e2e903a2252f525797f1d0d09"
"gitHead": "dce9edfc705352e8cb9e0083c9330ba0e8d77409"
}
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