New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

martok

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

martok - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

src/kotlin/KotlinTypes.ts

4

package.json
{
"name": "martok",
"version": "1.2.0",
"version": "1.3.0",
"description": "",

@@ -12,3 +12,3 @@ "main": "dist/index.js",

"test": "jest",
"special": "ts-node src/index.ts tests/comparisons/multi/taggedUnions -o ./schema/martok --package net.sarazan.martok --datePattern standard",
"special": "ts-node src/index.ts tests/comparisons/single/numbers.d.ts -o ./schema/martok --package net.sarazan.martok --datePattern standard",
"lint": "eslint . --ext .ts"

@@ -15,0 +15,0 @@ },

@@ -74,3 +74,4 @@ Martok - Glory To Your Schema!

* optional fields
* Typescrupt "Utility" types (e.g. `Omit` and `Pick`)
* Typescript "Utility" types (e.g. `Omit` and `Pick`)
* Configurable numeric precision via the `@precision` jsdoc tag

@@ -77,0 +78,0 @@ ### TODO

import ts, {
Declaration,
factory,
getAllJSDocTags,
getJSDocReturnType,
getJSDocTags,
InternalSymbolName,

@@ -26,2 +29,4 @@ isArrayTypeNode,

import { Martok } from "../martok/Martok";
import { KotlinNumber } from "../kotlin/KotlinTypes";
import { startCase } from "lodash";

@@ -126,4 +131,5 @@ const QUESTION_TOKEN = factory.createToken(SyntaxKind.QuestionToken);

return "String";
if (isNumericLiteral(type) || type.kind === SyntaxKind.NumberKeyword)
return "Double";
if (isNumericLiteral(type) || type.kind === SyntaxKind.NumberKeyword) {
return getNumberType(type);
}
if (type.kind === SyntaxKind.BooleanKeyword) return "Boolean";

@@ -137,2 +143,15 @@ if (isArrayTypeNode(type)) {

function getNumberType(node: TypeNode): KotlinNumber {
let doc: ts.Node = node.parent;
if (isArrayTypeNode(doc)) doc = doc.parent;
const tag = getJSDocPrecision(doc) ?? "double";
return startCase(tag) as KotlinNumber;
}
function getJSDocPrecision(node: ts.Node): string | undefined {
return getJSDocTags(node).find((value) => {
return value.tagName.text === "precision";
})?.comment as string;
}
/**

@@ -139,0 +158,0 @@ * @throws TaggedUnionError

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