Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
coords-formater
Advanced tools
This library is intended to facilitate the use of coordinates, making conversions between formats and preparing the fields to receive this type of data effortlessly.
# NPM
npm install coords-formater --save
# Yarn
yarn add coords-formater
// Es6 module pattern
import coords from 'coords-formater'
// Node module pattern
const coords = require('coords-formater')
// Es6 module pattern
import { convert, parse } from 'coords-formater'
// Node module pattern
const { normalize } = require('coords-formater')
The properties
below can be used to configurate some methods.
Property | Description | Default Value | Type |
---|---|---|---|
degrees | Show degrees. Always true | true | Boolean |
minutes | Show minutes | true | Boolean |
seconds | Show seconds. False if minutes is also false | true | Boolean |
spaces | Show spaces between parts | true | Boolean |
degreeIndicator | Degree part indicator | ° | String |
minuteIndicator | Minute part indicator | ' | String |
secondIndicator | Second part indicator | " | String |
showSign | Configure to show [+/-] sign at start | true | Boolean |
showCompassDirection | Configure to show compass direction at end | true | Boolean |
decimalSeparator | Last part's decimal separator | . | String |
decimalPlaces | Number of decimal places | 5 | Integer |
String
coordinate )Normalizes input coordinate, removing unpattern characters
Name | Type | Optional | Description |
---|---|---|---|
coordinate | String | required | Coordinate in any Accepted Input Formats |
// Import
const { normalize } = require('coords-formater');
// Replaces "º" by "°"
normalize('41º 12.123"')
// Returns
// 41° 12.123"
String
coordinate )Extract coordinates components from passed string
Name | Type | Optional | Description |
---|---|---|---|
coordinate | String | required | Coordinate in any Accepted Input Formats |
const { parse } = require('coords-formater');
parse('S17 33 08.352');
/*Returns
{
compass:"S",
degrees:17,
minutes:33,
seconds:8.352,
signal:"-"
}*/
String
coordinate [ , Object
options ] )Convert cordinate
to other format according options
Name | Type | Optional | Description |
---|---|---|---|
coordinate | String | required | Coordinate in any Accepted Input Formats |
options | Object | optional | Properties object |
const { convert } = require('coords-formater') ;
convert('41° 25\' 01" W', {
showSign: true,
showCompassDirection: false,
minutes: false
}
);
// Returns
// - 41.41694444444445°
Object
parsedCoordinate [ , Object
options ] )Convert the object parsedCordinate
to other format according options
Name | Type | Optional | Description |
---|---|---|---|
parsedCordinate | Object | required | Object of coordinates parts, like returned by parse() |
options | Object | optional | Properties object |
const { toString } = require('coords-formater') ;
// object returned by parse()
const parts = {
compass:"S",
degrees:17,
minutes:33,
seconds:8.352,
signal:"-"
}
// Configuration options
const options = {
showSign:false,
showCompassDirection:true
}
toString(parts, options );
// Returns
// 17° 33' 8.352" S
String
coordinate [ , Object
options ] )Convert cordinate
to numeric format with float type
Name | Type | Optional | Description |
---|---|---|---|
coordinate | String | required | Coordinate in any Accepted Input Formats |
const { toFloat } = require('coords-formater') ;
toFloat('42 12 10')
// Returns
// 42.202777777777776
toFloat('S 42 12 10')
// Returns
// - 42.202777777777776
MIT
(c) klawdyo.com (klawdyo) 2020
FAQs
A coordinates parser and formater
The npm package coords-formater receives a total of 0 weekly downloads. As such, coords-formater popularity was classified as not popular.
We found that coords-formater demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.