Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@andrewscwei/mongodb-odm

Package Overview
Dependencies
87
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.44.0 to 0.45.0

32

build/types/index.d.ts

@@ -37,6 +37,2 @@ import { CollectionAggregationOptions, CollectionInsertManyOptions, CollectionInsertOneOptions, CommonOptions, FilterQuery, FindOneAndReplaceOption, IndexOptions, ObjectID, ReplaceOneOptions, UpdateQuery } from 'mongodb';

/**
* Geo coordinate type in the format of [longitude, latitude].
*/
export declare type GeoCoordinate = [number, number];
/**
* Specification for defining a field in the MongoDB collection.

@@ -398,30 +394,2 @@ */

/**
* Checks if a value is a GeoCoordinate. Also ensures the longitude and latitude
* ranges, throws if out of range for either value.
*
* @param value - Value to check.
*
* @returns `true` if value is a GeoCoordinate, `false` otherwise.
*
* @throws {Error} Longitude is less than -180.
* @throws {Error} Longitude is greather than 180.
* @throws {Error} Latitude is less than -90.
* @throws {Error} Latitude is greater than 90.
*/
export declare function typeIsGeoCoordinate(value: any): value is GeoCoordinate;
/**
* Makes a geo coordinate based on the provided params.
*
* @param longitude - Longitude.
* @param latitude - Latitude.
*
* @returns The geo coordinate.
*
* @throws {Error} Params are invalid.
*/
export declare function GeoCoordinateMake({ longitude, latitude }: {
longitude: string | number;
latitude: string | number;
}): GeoCoordinate;
/**
* Makes an ObjectID from a value.

@@ -428,0 +396,0 @@ *

@@ -56,53 +56,2 @@ "use strict";

/**
* Checks if a value is a GeoCoordinate. Also ensures the longitude and latitude
* ranges, throws if out of range for either value.
*
* @param value - Value to check.
*
* @returns `true` if value is a GeoCoordinate, `false` otherwise.
*
* @throws {Error} Longitude is less than -180.
* @throws {Error} Longitude is greather than 180.
* @throws {Error} Latitude is less than -90.
* @throws {Error} Latitude is greater than 90.
*/
function typeIsGeoCoordinate(value) {
if (!is_1.default.array(value))
return false;
if (value.length !== 2)
return false;
if (!is_1.default.number(value[0]))
return false;
if (!is_1.default.number(value[1]))
return false;
const [longitude, latitude] = value;
if (longitude < -180)
throw new Error('Longitude value must not be less than -180 degrees');
if (longitude > 180)
throw new Error('Longitude value must not be greater than 180 degrees');
if (latitude < -90)
throw new Error('Longitude value must not be less than -90 degrees');
if (latitude > 90)
throw new Error('Longitude value must not be greater than 90 degrees');
return true;
}
exports.typeIsGeoCoordinate = typeIsGeoCoordinate;
/**
* Makes a geo coordinate based on the provided params.
*
* @param longitude - Longitude.
* @param latitude - Latitude.
*
* @returns The geo coordinate.
*
* @throws {Error} Params are invalid.
*/
function GeoCoordinateMake({ longitude, latitude }) {
const coord = [Number(longitude), Number(latitude)];
if (!typeIsGeoCoordinate(coord))
throw new Error('Invalid parameters provided');
return coord;
}
exports.GeoCoordinateMake = GeoCoordinateMake;
/**
* Makes an ObjectID from a value.

@@ -109,0 +58,0 @@ *

2

package.json
{
"name": "@andrewscwei/mongodb-odm",
"version": "0.44.0",
"version": "0.45.0",
"description": "ODM for MongoDB",

@@ -5,0 +5,0 @@ "main": "build/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc