Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
dms-conversion
Advanced tools
A JavaScript library for converting between decimal degrees and degrees, minutes, and seconds (DMS).
A JavaScript library for converting between decimal degrees and degrees, minutes, and seconds (DMS).
npm install dms-conversion
TypeScript example (from Jasmine test)
import DmsCoordinates, { parseDms } from "dms-conversion";
describe("DmsCoordinates", () => {
const long = -122.902336120571;
const lat = 46.9845854731319;
it(`(${lat}, ${long}) coordinates should be ~ 46°59′5″ N, 122°54′8″ W`, () => {
const dmsCoords = new DmsCoordinates(lat, long);
expect(dmsCoords instanceof DmsCoordinates).toBe(true);
const { longitude, latitude } = dmsCoords.dmsArrays;
let [d, m, s, nsew] = longitude;
expect(d).toBe(122);
expect(m).toBe(54);
expect(Math.round(s)).toBe(8);
expect(nsew).toBe("W");
[d, m, s, nsew] = latitude;
expect(d).toBe(46);
expect(m).toBe(59);
expect(Math.round(s)).toBe(5);
expect(nsew).toBe("N");
expect(dmsCoords.toString()).toMatch(/46°59′4.\d+″ N, 122°54′8.\d+″ W/i);
});
it("Regexp should work", () => {
const v = ["46°59′5″ N", "122°54′8″ W"];
v.forEach((s) => expect(s.match(DmsCoordinates.dmsRe)).toBeTruthy(true));
const [x, y] = v.map(parseDms);
expect(typeof x).toEqual("number");
expect(typeof y).toEqual("number");
});
it("Invalid numbers should throw exception", () => {
const x = parseDms("");
expect(isNaN(x)).toBe(true);
expect(() => {
const dmsc = new DmsCoordinates(lat, x);
}).toThrowError(RangeError);
expect(() => {
const dmsc = new DmsCoordinates("this should fail" as any, long);
}).toThrowError(TypeError);
});
});
FAQs
A JavaScript library for converting between decimal degrees and degrees, minutes, and seconds (DMS).
We found that dms-conversion 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.