Code Monkey home page Code Monkey logo

faked's People

Contributors

burner avatar webfreak001 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

webfreak001

faked's Issues

Broken strings with starting quotes

This part is missing a check to remove a leading quote if there is one:

if(a[$ - 1] == '\'') {

see diff examples:
202697d#diff-a5a6b994091bc34a3c64b38e5a96f708dd0835ce39c0faf12fd8e149901a2853R3496
202697d#diff-460b0f9563790e07cfb942c34286ae7edf4aea4d1c114594db67626f1d6d2376L845

I tried modifying it but the generator doesn't seem to quit on windows. Also needed to add a special case to make file starting with a license work:

diff --git a/fakerjsgenerator/source/jssplitter.d b/fakerjsgenerator/source/jssplitter.d
index 3b8e12e..27c9e3a 100644
--- a/fakerjsgenerator/source/jssplitter.d
+++ b/fakerjsgenerator/source/jssplitter.d
@@ -55,8 +55,15 @@ struct TypeLines {
 	string[] lines;
 }
 
+string removeLicense(string code) {
+	if (code.startsWith("/*")) {
+		code = code[code.indexOf("*/", 2) + 2 .. $].stripLeft;
+	}
+	return code;
+}
+
 TypeLines jssplit(string input) {
-	string[] lines = split(input, "\n")
+	string[] lines = splitter(input.removeLicense, "\n")
 		.map!(a => a.strip("\", \t\n\r"))
 		.filter!(a => !a.empty && !a.startsWith("//"))
 		.array;
@@ -71,9 +78,12 @@ TypeLines jssplit(string input) {
 			, lines.front ~ "\n" ~ input);
 	lines = lines[1 .. $]
 		.map!(a => {
-			if(a[$ - 1] == '\'') {
+			if(a.length && a[$ - 1] == '\'') {
 				a = a[0 .. $ - 1];
 			}
+			if(a.length && a[0] == '\'') {
+				a = a[1 .. $];
+			}
 			return a;
 		}())
 		.array;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.