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

ylenia

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ylenia - npm Package Compare versions

Comparing version 0.0.3 to 0.1.0

functions.js

54

index.js

@@ -5,2 +5,3 @@ "use strict";

//Imports
var func = require("./functions");
var sys = require("samara");

@@ -19,2 +20,3 @@ var samara_1 = require("samara");

json.openArray();
//TODO: Insert Default-Values
json.closeArray();

@@ -25,6 +27,3 @@ sys.writeFile(source.json, json.getString());

var sc = new samara_1.SourceObject();
sc.add("//Imports", 0);
sc.add("import * as " + source.array + " from \"./" + source.json + "\";", 0);
sc.add("import {" + source.object_name + "} from \"./" + source.object_file.replace(".ts", "") + "\";", 0);
sc.newLine();
sc.add(func.createControllerImports(source), 0);
sc.add("//Class", 0);

@@ -37,34 +36,15 @@ var ext = "";

sc.add("//Declarations", 1);
sc.add("private " + source.controller_array + ":" + source.object_name + "[];", 1);
sc.add("private readonly " + source.controller_array + ":" + source.object_name + "[];", 1);
sc.newLine();
sc.add("//Constructor", 1);
sc.add("constructor(){", 1);
sc.add("this." + source.controller_array + " = [];", 2);
sc.add("}", 1);
sc.newLine();
sc.add(func.createControllerConstructor(source), 0);
sc.add("//Methods", 1);
sc.add("add(" + source.controller_object.toLowerCase() + ":" + source.object_name + "):void{", 1);
sc.add("this." + source.controller_array + ".push(" + source.controller_object.toLowerCase() + ");", 2);
sc.add("}", 1);
sc.newLine();
var id = this.getIdentifier(source.attributes);
sc.add("addProtected(" + source.controller_object.toLowerCase() + ":" + source.object_name + "):void{", 1);
sc.add("if(!this.exist(" + source.controller_object.toLowerCase() + "." + id + ")){", 2);
sc.add("this.add(" + source.controller_object.toLowerCase() + ");", 3);
sc.add("}", 2);
sc.add("}", 1);
sc.newLine();
sc.add("exist(" + id + ":string):Boolean{", 1);
sc.add("return this.get(" + id + ") !== undefined;", 2);
sc.add("}", 1);
sc.newLine();
sc.add("get(" + id + ":string):" + source.object_name + "{", 1);
sc.add("for(let " + source.controller_object.toLowerCase() + " of this." + source.controller_array + "){", 2);
sc.add("if(" + source.controller_object.toLowerCase() + "." + id + " === " + id + "){", 3);
sc.add("return " + source.controller_object.toLowerCase() + ";", 4);
sc.add("}", 3);
sc.add("}", 2);
sc.add("return undefined;", 2);
sc.add("}", 1);
sc.newLine();
sc.add(func.createControllerAdd(source), 0);
//let id:string = this.getIdentifier(source.attributes);
sc.add(func.createControllerAddProtected(source), 0);
sc.add(func.createControllerExist(source), 0);
sc.add(func.createControllerGet(source), 0);
sc.add(func.createControllerGetAll(source), 0);
sc.add(func.createControllerLoad(source), 0);
sc.add(func.createControllerRemove(source), 0);
sc.add(func.createControllerSave(source), 0);
sc.add("}", 0);

@@ -75,5 +55,5 @@ sys.writeFile(source.controller_file, sc.getString());

var sc = new samara_1.SourceObject();
sc.add("//Imports", 0);
sc.add("import * as " + source.array + " from \"./" + source.json + "\";", 0);
sc.newLine();
//sc.add("//Imports", 0);
//sc.add(func.createImportData(source.json), 0);
//sc.newLine();
sc.add("//Class", 0);

@@ -80,0 +60,0 @@ var ext = "";

//Imports
import * as func from "./functions";
import * as sys from "samara";

@@ -21,2 +22,5 @@ import {JSONObject, SourceObject} from "samara";

json.openArray();
//TODO: Insert Default-Values
json.closeArray();

@@ -28,6 +32,3 @@ sys.writeFile(source.json, json.getString());

let sc:SourceObject = new SourceObject();
sc.add("//Imports", 0);
sc.add("import * as " + source.array + " from \"./" + source.json + "\";", 0);
sc.add("import {" + source.object_name + "} from \"./" + source.object_file.replace(".ts", "") + "\";", 0);
sc.newLine();
sc.add(func.createControllerImports(source), 0);
sc.add("//Class", 0);

@@ -40,38 +41,15 @@ let ext:string = "";

sc.add("//Declarations", 1);
sc.add("private " + source.controller_array + ":" + source.object_name + "[];", 1);
sc.add("private readonly " + source.controller_array + ":" + source.object_name + "[];", 1);
sc.newLine();
sc.add("//Constructor", 1);
sc.add("constructor(){", 1);
sc.add("this." + source.controller_array + " = [];", 2);
sc.add("}", 1);
sc.newLine();
sc.add(func.createControllerConstructor(source), 0);
sc.add("//Methods", 1);
sc.add("add(" + source.controller_object.toLowerCase() + ":" + source.object_name + "):void{", 1);
sc.add("this." + source.controller_array + ".push(" + source.controller_object.toLowerCase() + ");", 2);
sc.add("}", 1);
sc.newLine();
let id:string = this.getIdentifier(source.attributes);
sc.add("addProtected(" + source.controller_object.toLowerCase() + ":" + source.object_name + "):void{", 1);
sc.add("if(!this.exist(" + source.controller_object.toLowerCase() + "." + id + ")){", 2);
sc.add("this.add(" + source.controller_object.toLowerCase() + ");", 3);
sc.add("}", 2);
sc.add("}", 1);
sc.newLine();
sc.add("exist(" + id + ":string):Boolean{", 1);
sc.add("return this.get(" + id + ") !== undefined;", 2);
sc.add("}", 1);
sc.newLine();
sc.add("get(" + id + ":string):" + source.object_name + "{", 1);
sc.add("for(let " + source.controller_object.toLowerCase() + " of this." + source.controller_array + "){", 2);
sc.add("if(" + source.controller_object.toLowerCase() + "." + id + " === " + id + "){", 3);
sc.add("return " + source.controller_object.toLowerCase() + ";", 4);
sc.add("}", 3);
sc.add("}", 2);
sc.add("return undefined;", 2);
sc.add("}", 1);
sc.newLine();
sc.add(func.createControllerAdd(source), 0);
//let id:string = this.getIdentifier(source.attributes);
sc.add(func.createControllerAddProtected(source), 0);
sc.add(func.createControllerExist(source), 0);
sc.add(func.createControllerGet(source), 0);
sc.add(func.createControllerGetAll(source), 0);
sc.add(func.createControllerLoad(source), 0);
sc.add(func.createControllerRemove(source), 0);
sc.add(func.createControllerSave(source), 0);
sc.add("}", 0);

@@ -83,5 +61,5 @@ sys.writeFile(source.controller_file, sc.getString());

let sc:SourceObject = new SourceObject();
sc.add("//Imports", 0);
sc.add("import * as " + source.array + " from \"./" + source.json + "\";", 0);
sc.newLine();
//sc.add("//Imports", 0);
//sc.add(func.createImportData(source.json), 0);
//sc.newLine();
sc.add("//Class", 0);

@@ -88,0 +66,0 @@ let ext:string = "";

{
"name": "ylenia",
"version": "0.0.3",
"version": "0.1.0",
"description": "TypeScript-DataSources for JSON. Generates dynamic TS-Files.",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

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