
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
String generator library. This is a library for creating patterns from strings with wildcard tokens which can then be used for various purposes.
Please create issues or open pull requests if you find something wrong or feel like contributing to this project.
const createWildling = require('wildling');
const options = {
patterns: [
// a single string without any wildcards
"abrakadabra",
// strings foo0, foo1 ... foo9
"foo#"
]
};
const wildcard = createWildling(options);
let string = wildcard.next();
while (string) {
// Use string here
console.log(string);
string = wildcard.next();
}
This example will write the following words to console.log:
abrakadabra
foo0
foo1
foo2
foo3
foo4
foo5
foo6
foo7
foo8
foo9
<html>
<head>
<script type="text/javascript" src="../dist/wildling.js"></script>
<script type="text/javascript">
var options = {
patterns: [
// strings foo0, foo1 ... foo9
"foo#"
]
};
var wildcard = wildling(options);
var string;
while ((string = wildcard.next())) {
document.write(string + "<br />");
}
</script>
</head>
<body></body>
</html>
This example will write the following lines in the browser body:
foo0
foo1
foo2
foo3
foo4
foo5
foo6
foo7
foo8
foo9
via npm
npm install wildling
Wildling is using Ava for testing and nyc for test coverage. To test run:
npm test
In the example above it would be rather pointless to use Wildling but for more complex patterns like when you are trying to find a domain name for a project named clams(Assuming all good tlds for this is taken) then we could use wildling to create a script to check whois records like this:
%{'colors',0-1}clams%{'colors',0-1}#{0-2}.%{'tld'}
const createWildling = require('wildling');
const options = {
patterns: [
// the first # in this pattern wont be interpreted as a wildcard
// creating a pattern of #0, #1, ... #9
"\\##"
]
};
const wildcard = createWildling(options);
let string = wildcard.next();
while (string) {
// Use string here
console.log(string);
string = wildcard.next();
}
const createWildling = require('wildling');
const options = {
patterns: [
// gives 0, 1, ... 9
"#",
// same as above
"#{1}",
// gives 00, 10, 20, ... 99
"#{2}",
// same as above
"##",
// first gives 0, 1, ... 9 then 00, 10, 20, ... 99
"#{1-2}"
]
};
const wildcard = createWildling(options);
let string = wildcard.next();
while (string) {
// Use string here
console.log(string);
string = wildcard.next();
}
In simple wildcards the format is
<wildcard character>[{<startLength>[-endLength]}]
Meaning these would all be valid patterns:
#
#{2}
#{2-4}
In the special wildcards the format is
<wildcard character>{'<settings>'[,<startLength>[-endLength]]}
Meaning these would all be valid patterns:
${'test,dummy'}
${'test,dummy',2}
${'test,dummy',2-4}
const createWildling = require('wildling');
const options = {
patterns: [
// 0, 1 ... 9
"#"
]
};
const wildcard = createWildling(options);
let string = wildcard.next();
while (string) {
// Use string here
console.log(string);
string = wildcard.next();
}
const createWildling = require('wildling');
const options = {
patterns: [
// a, b, c, ... zz
"@{1-2}"
]
};
const wildcard = createWildling(options);
let string = wildcard.next();
while (string) {
// Use string here
console.log(string);
string = wildcard.next();
}
const createWildling = require('wildling');
const options = {
patterns: [
// 0, 1, ...9, a, b, ... z, 00, 10, ... zz
"*{1-2}"
]
};
const wildcard = createWildling(options);
let string = wildcard.next();
while (string) {
// Use string here
console.log(string);
string = wildcard.next();
}
const createWildling = require('wildling');
const options = {
patterns: [
// a, b, c, ... z, A, B, C, ... Z
"&"
]
};
const wildcard = createWildling(options);
let string = wildcard.next();
while (string) {
// Use string here
console.log(string);
string = wildcard.next();
}
const createWildling = require('wildling');
const options = {
patterns: [
// 0, 1, ... 9, A, B, ... Z
"?"
]
};
const wildcard = createWildling(options);
let string = wildcard.next();
while (string) {
// Use string here
console.log(string);
string = wildcard.next();
}
const createWildling = require('wildling');
const options = {
patterns: [
// A, B, ... Z
"!"
]
};
const wildcard = createWildling(options);
let string = wildcard.next();
while (string) {
// Use string here
console.log(string);
string = wildcard.next();
}
const createWildling = require('wildling');
const options = {
patterns: [
// 0, 1, ... 9, a, b, ... z, A, B, ... Z
"-"
]
};
const wildcard = createWildling(options);
let string = wildcard.next();
while (string) {
// Use string here
console.log(string);
string = wildcard.next();
}
const createWildling = require('wildling');
const options = {
patterns: [
// all combinations with length 1-2 of the words blue, red and green
// fx. red and blueblue
"${'blue,red,green',1-2}"
]
};
const wildcard = createWildling(options);
let string = wildcard.next();
while (string) {
// Use string here
console.log(string);
string = wildcard.next();
}
const createWildling = require('wildling');
const options = {
patterns: [
// using built-in dictionary
"%{'planets'}",
// using dictionary passed on when creating the wildcard
"%{'test'}"
],
dictionaries: {
test: ["alpha", "beta", "gamma"]
}
};
const wildcard = createWildling(options);
let string = wildcard.next();
while (string) {
// Use string here
console.log(string);
string = wildcard.next();
}
Wildling also has some built-in libraries which are:
MIT, see LICENSE file
FAQs
Wildling string generator library
The npm package wildling receives a total of 3 weekly downloads. As such, wildling popularity was classified as not popular.
We found that wildling demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.