Pino is a wonderful and fast logging API for Node.js and the Browser API.
One thing you should get used to is the first getting strange order for your logging statements. My first attempts looks like these rows.
logger.info('token NOT in cache, check with oauth server', token)
Because coming from console.log it was the natural way of creating log entries, but the output creates only lines with the text, not with the content of the token, what was intended.
Checking the API leads me to
logger.info(token, 'token NOT in cache, check with oauth server')
but now it always gives me…
or why JavaScript is still an awesome language.
Today I had the maybe strange idea to create a function that debugs a function given as a parameter.
debug (callback) {
return (...parameters) => {
// eslint-disable-next-line standard/no-callback-literal
const result = callback(...parameters)
console.log(callback.name, parameters, result)
return result
}
},
So as you can see debug creates a wrapper function for the given function to wrap each call of the given function. With this you can see in your console what is going on. So if we want to get an idea what the next function is doing
this.toggleLocation(parseFloat(place.lat), parseFloat(place.lng))
we surround…
or how to implement an autocomplete with VueJS + VuetifyJS
Today I want to share me recent learnings on implementing an autocomplete with VuetifyJS using the fetch API.
Therefore I added this tag to my page
<v-combobox
v-model.trim="selectedPlace"
:items="foundPlaces"
:loading="isPlacesLoading"
:search-input.sync="searchPlace"
hide-no-data
hide-selected
label="Ort"
clearable
:rules="nameRules"
/>
that should render like this
or almost never add Options +Indexes to your .htaccess file
Yesterday I had the bad idea to create a quick frontend solution for a backend problem: Accessing all available files in a folder on the server.
Accessing files on the client machine is nowadays no problem any more, but my attempt was to get access to files lying on the server without coding or a service that has to be implemented.
I remembered the possibility to allow the directory listing for configured folders. To achieve this you simply have to add a .htaccess file into each folder, allowing this.
.htaccess:
…
or a simple example to use functional programming in JavaScript
Today I wanted to paste my JSON into a Spreadsheet like Excel, but that was a mess. It could not get along with it and hence it is no fun to do this by hand, I implemented a small tool to do this for me.
The input was this test.json — almost, I have created an object of it:
{ 'id': '10.1234/vvsyzs72ws.4', 'type': 'dois', 'attributes': { 'doi': '10.1234/vvsyzs72ws.4', 'identifiers': [], 'creators': [ { 'name': 'Staging, UnaElsStaging', 'nameType': 'Personal', 'givenName': 'UnaElsStaging', 'familyName': 'Staging', 'affiliation': [], 'nameIdentifiers': [ { 'schemeUri': 'https://orcid.org', 'nameIdentifier'…
XML is not my favorite data exchange format, but sometimes you have no choice. So if it comes to the question how to handle those data in JavaScript, I first want to use an existing npm module that flies around in the www. But on second sight I found a even simpler solution, that does not need anything, except the browser who is already there.
The browser has a parser build in, who can also parse given XML data. Let’s try to use it.
The first step towards my content goes through a request I have done with fetch.
const…
Developer since the 80'th, working at Forschungszentrum Jülich (http://www.fz-juelich.de) …