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

io-ts-from-json-schema

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

io-ts-from-json-schema - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6-alpha1

16

lib/cli.js

@@ -39,2 +39,3 @@ #!/usr/bin/env node

var path = require("path");
var crypto_1 = require("crypto");
var gen = require("io-ts-codegen");

@@ -49,2 +50,4 @@ var yargs = require("yargs");

.option('import', { type: 'string', array: true, default: [] })
.option('importHash', { type: 'string', default: 'sha256' })
.option('importHashLength', { type: 'number', default: 7 })
.help().argv;

@@ -401,7 +404,14 @@ var imports = argv.import.map(function (imp) { return imp.split('^'); });

}
function calculateImportName(filePath) {
function importHash(str) {
return crypto_1.default
.createHash(argv.importHash)
.update(str)
.digest('hex')
.slice(0, argv.importHashLength);
}
function calculateImportName(filePath, refString) {
// eslint-disable-next-line
var _a = __read(filePath.split("/").reverse(), 1), withoutPath = _a[0];
var _b = __read(withoutPath.split('.json'), 1), basefile = _b[0];
return typenameFromKebab(basefile) + "_";
return "" + typenameFromKebab(basefile) + importHash(refString) + "_";
}

@@ -421,3 +431,3 @@ function fromRef(refString) {

}
var importName = calculateImportName(ref.filePath);
var importName = calculateImportName(ref.filePath, refString);
var importPath = calculateImportPath(ref.filePath);

@@ -424,0 +434,0 @@ imps.add("import * as " + importName + " from '" + importPath + "';");

2

package.json
{
"name": "io-ts-from-json-schema",
"version": "0.0.5",
"version": "0.0.6-alpha1",
"description": "Iotsfjs is a static code generation utility used for converting json schema files into static TypeScript types and io-ts runtime validators.",

@@ -5,0 +5,0 @@ "main": "lib/cli.js",

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