Each custom reporter in JsHint receives 3 arguments : results, data, and options.
I'd like to be able to display the current JsHint version in the output generated by the reporter but it doesn't seem to be provided by any of the variables described above.
Am I missing something obvious, or is there another way to grab it?
Use a function property to store the version:
reporter.version = "1.2.3";
then add a reference to it in the reporter source:
console.log(reporter.version ? "JSHint version: " + reporter.version + "\n" : "" + str + "\n" + len + ' error' + ((len === 1) ? '' : 's'));
References
JSHint Default Reporter source
Related
I use thymeleaf with template for TEXT to output some handcrafted text-files. Output should be
* smallText[description]
And I write in the thymeleaf template
* [(#{value}][[(#{value2}]]
But its not working and outputs (the "[" is missing)
* smallTextdescription
I also tried
* [(#{value}][ [(#{value2}] ]
But I do not want spaces behind the "[" Any ideas?
Have you tried using the following syntax th:text?
/*[# th:text="|*${value}[${value2}]|"]*/
In this case the output is:
*smallText[description]
When you are using TemplateMode.TEXT, you can use the following syntax:
[#element ... /]
This is the text-mode equivalent of the more familiar HTML-based syntax, such as:
<div th:text=""...></div>
So, you can now write something like this in your text file (the Thymeleaf template):
[# th:text="'* ' + ${value} + '[' + ${value2} + ']'" /]
This produces:
* smallText[description]
NOTE - in my case I don't have any #{...} message values to test with, so I'm just using ${...} variables in my test. But the same syntax applies to #{...} values.
See textual template modes for more details.
The only way I found was to replace [ with [([)] and ] with [(])].
* [(#{value})][([)][(#{value2})][(])]
Hoping for smarter and more elegant solutions out there.
apparently template literals are not supported in the IDE (i get an illegal character warning when I enter the backtick). Is there an alternative? I have the following lengthy expression that I want to include as part of a restdb query:
"_created":{"$gt":{"$date":"$yesterday"}}"
Is there an alternative to painstakingly constructing this as a series of escapes and concatenations? This is what I have right now.
const dateexp = `"_created":{"$gt":{"$date":"$yesterday"}}"`
if (searchTerm) {
const regexterm = "\{\"\$regex\": "
const searchterm = searchTerm
var q1 = "{\"active\" : true, \"_tags\": " + regexterm + "\"" + searchterm + ", " + dateexp +
"\"}}"
console.log("q1 is", q1)
I found a trick that made this considerably easier -- I used the Rhino Online editor at jdoodle.com -- https://www.jdoodle.com/execute-rhino-online/
This sped up the trial & error considerably and I arrived at
var q2 = "{\"active\" : true, \"_tags\": " + regexterm + "\"" + searchterm + "\"\}, " + "\"_created\" : {\"\$gt\" : \{\"\$date\" :\"\$yesterday\"\}\}}"
A console editor in the Bixby IDE would be great!
PS - it helps to learn that in Rhino there is no console.log, but there is a print().
This doesn't help you right now, but the Bixby engineering team is hard at work on the "next generation" of javascript runtime environment for capsule code. I can't say much more than this, but rest assured that in the future, you will have a first-class, modern javascript development experience as a bixby capsule developer.
source: I work on the bixby developer tools team.
I have a string with constant value and I want to pass it to rename_to header while using MV gateway.
I have tried below code snippet and one by adding the variable in context and then using it with #basePath
#Value("${basePath:/home/}")
String basePath;
.enrichHeaders(h -> h
.headerExpression(RENAME_TO, "'${basePath}' + headers[file_remoteFile]")
.headerExpression(REMOTE_FILE, "headers[file_remoteFile]")
.header(REMOTE_DIRECTORY, "headers[file_remoteDirectory]"))
I am getting error on startup. How can I give basePath in my application.properties
#Value("${basePath:/home/}")
String basePath;
Means "inject '/home/' into variable basePath if there is no basePath property.
You can't use fields from the enclosing class like that in the SPeL expression, and you can't use property placeholders in SpEL there; you have to concatenate the strings in the java.
.headerExpression(RENAME_TO, "'" + this.basePath + "'" + " + headers[file_remoteFile]")
I'm getting document history, adding "\n" and existing document history. Code executes without any error. But when I see it in web everything on one line. In notes client, document history is shown as one line of activity.
Tried with #Newline and same issue.
What I'm doing wrong?
Thanks in advance.
Here is sample code:
var myvar="\n"
var h=getComponent("docHistory1").getValue();
var msg="Stage 2 - LAB Manager approved and completed check. Send to Chemist: " + unm + " + dt1;
document1.setValue("DocHistory", h + myvar + msg);
document1.save();
Use a Multiline Edit Box xp:inputTextarea instead of a Computed field xp:text and set it to Read only readonly="true".
As an alternative you could still use a Computed field replacing all '\n' with '<br />' and setting escape="false".
Just to give an alternative solution, you could use a style on the computed text component with "white-space:pre" (or pre-line or pre-wrap, see this for the differences) and that would preserve the newlines in the content.
I'm trying to implement DIGEST-MD5 with node.js but it doesn't seem to work correctly.
Currently, I tried to implement it the following way:
function md5(str) {
var hash = crypto.createHash('md5');
hash.update(str);
return hash.digest('binary');
}
var A1 = md5(username + ':' + realm + ':' + password);
When I console.log this value (with username = "test", realm = "" and password = "123), the following appears: "EïSÓ*JÉHF7{"
I compared this with the javascript implementation of strophe.js (which is correct) and this prints the following "EïSÓ*JÉHF7{¢"
Is there another way on how to calculate it? Or is it maybe some wrong encoding of the base string?
Thanks,
Michael
I;m using node v0.4.12 and i am getting:
EïSÓ*JÉHF7{¢
which version of node you are using?
maybe this is shell settings thing try execute unix command:
env
search for:
LANG=en_US.UTF-8
Have a look at this module, I've tested this and it's working.
Got it working now, my code was correct but I used some wrong variables for constructing the string..
Thanks for the help.