All Questions
9 questions
3
votes
2
answers
383
views
RegEx version control
this is my first time on this stack exchange :)
I created a little script to check for the latest version of specified API version available, but I am wondering if I am using the best way possible ...
1
vote
2
answers
788
views
Find if cookie name exists in the cookie string
I need to determine whether a cookie name is available or not in the cookie string. I have achieved this. We could use the cookie-parser package but I don't want to use that package so I have written ...
4
votes
1
answer
245
views
Build string by generating random characters step by step
I'm trying to create a program that will try to build a target string character by character by generating random characters. I have come up with the following Nodejs program with a little bit of ...
1
vote
2
answers
78
views
Getting a string from a range of possible paths
I have a scenario where I need to grab the first occurrence of a string from an object, but only if the match occurs in one of the path's that have been pre-defined.
...
1
vote
1
answer
10k
views
Text-wrapping function in JavaScript
I have the following code on my server that takes a string and inserts newlines in such a way that the string is separated into lines, all of which are shorter than ...
6
votes
1
answer
777
views
Node.JS Automatic Poem Generator
As a simple programming exercise, I wrote a piece of Node.JS code which generates random poems. It is based on a list of articles (kind of), nouns, linking verbs, and adjectives. It then combines them ...
8
votes
1
answer
10k
views
Counting newlines in a file
I've started to go through Node tutorials on nodeschool.io, and the second assignment was to write a program that will count the number of newlines in a file and print it out. My solution looks like ...
8
votes
2
answers
13k
views
Calculate all possible combinations of an array of arrays or strings
I'm using code adapted from this Stack Overflow question to calculate all possible combinations from an array, which may contains strings.
For example:
...
7
votes
1
answer
556
views
Node.js equivalent of cat -n or nl
To add line numbers to a file (via stdin to stdout) we can use cat -n or ...