
Security News
Meet Socket at Black Hat Europe and BSides London 2025
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.
@hscmap/angle
Advanced tools
Simple angle unit converter for TypeScript
npm install --save @hscmap/angle
import { Angle, EquatorialCoord } from "@hscmap/angle"
function equal(a: number, b: number) {
return Math.abs(a / b - 1) <= 1.e-6 || Math.abs((a - 1) / (b - 1) - 1) <= 1.e-6
}
function assertEqual(a: number, b: number) {
console.assert(equal(a, b))
}
function assetArrayEqual(a: number[], b: number[]) {
console.assert(a.every((c, i) => equal(c, b[i])))
}
assertEqual(Angle.fromRad(Math.PI / 4).deg, 45)
assertEqual(Angle.fromDeg(45).rad, Math.PI / 4)
assertEqual(Angle.fromAmin(60).deg, 1)
assertEqual(Angle.fromAsec(1).deg, 1 / 3600)
assertEqual(Angle.fromDeg(1).amin, 60)
assertEqual(Angle.fromDeg(1).asec, 3600)
!(function eq2xyz() {
assetArrayEqual(EquatorialCoord.fromDeg(0, 0).xyz, [1, 0, 0])
assetArrayEqual(EquatorialCoord.fromDeg(90, 0).xyz, [0, 1, 0])
assetArrayEqual(EquatorialCoord.fromDeg(90, 90).xyz, [0, 0, 1])
assetArrayEqual(EquatorialCoord.fromDeg(0, -45).xyz, [Math.SQRT1_2, 0, -Math.SQRT1_2])
assetArrayEqual(EquatorialCoord.fromDeg(-45, -45).xyz, [1 / 2, - 1 / 2, -Math.SQRT1_2])
})()
!(function xyz2eq() {
function assertADEqual(eq: EquatorialCoord, a: Angle, d: Angle) {
assetArrayEqual([eq.a.rad, eq.d.rad], [a.rad, d.rad])
}
assertADEqual(EquatorialCoord.fromXyz([1, 0, 0]), Angle.fromDeg(0), Angle.fromDeg(0))
assertADEqual(EquatorialCoord.fromXyz([0, 1, 0]), Angle.fromDeg(90), Angle.fromDeg(0))
assertADEqual(EquatorialCoord.fromXyz([0, 0, 1]), Angle.fromDeg(0), Angle.fromDeg(90))
assertADEqual(EquatorialCoord.fromXyz([Math.SQRT1_2, 0, -Math.SQRT1_2]), Angle.fromDeg(0), Angle.fromDeg(-45))
assertADEqual(EquatorialCoord.fromXyz([1/2, -1/2, -Math.SQRT1_2]), Angle.fromDeg(315), Angle.fromDeg(-45))
})()
!(function simple_coord_parse() {
const eq = EquatorialCoord.parse(`29 41`)
assertEqual(eq.a.deg, 29)
assertEqual(eq.d.deg, 41)
})()
!(function m81_coord_parse() {
const eq = EquatorialCoord.parse(`(RA, α) 09h 55m 33.17306s (Dec, δ) +69° 03′ 55.0610″`)
assertEqual(eq.a.deg, 148.88822108386302)
assertEqual(eq.d.deg, 69.06529472246791)
})()
!(function m81_coord_unparse() {
const eq = EquatorialCoord.parse(`(RA, α) 09h 55m 33.17306s (Dec, δ) +69° 03′ 55.0610″`)
const { a, d } = eq.toString()
console.assert(a == '09:55:33.1731')
console.assert(d == '+69:03:55.0610')
})()
FAQs
Simple angle unit converter for TypeScript
The npm package @hscmap/angle receives a total of 1 weekly downloads. As such, @hscmap/angle popularity was classified as not popular.
We found that @hscmap/angle 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
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.