symmetryinvestments / faked Goto Github PK
View Code? Open in Web Editor NEWD library to create real fake data
License: MIT License
D library to create real fake data
License: MIT License
This part is missing a check to remove a leading quote if there is one:
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;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.