Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Convert strings between different variable naming formats.
Current Version: 1.0.0
Build Status:
Node Support: 0.6, 0.8
Browser Support: Android Browser 2.2–4.2, Firefox 3.6, Firefox 4–17, Google Chrome 14–25, Internet Explorer 6–10, Mobile Safari iOS 3–6, Opera 12.10, Safari 5–6
You can use Varname on the server side with Node.js and npm:
$ npm install varname
On the client side, you can either install Varname through Component:
$ component install rowanmanning/varname
or by simply including varname.js
in your page:
<script src="path/to/lib/varname.js"></script>
In Node.js or using Component, you can include Varname in your script by using require:
var varname = require('varname');
Varname also works with AMD-style module loaders, just specify it as a dependency.
If you're just including with a <script>
, varname
is available as a global variable.
Convert a variable name to camelBack format (capitalize the first letter of all but the first word).
str: (string) The string to convert.
return: (string) Returns the converted string.
varname.camelback('foo_bar_baz'); // 'fooBarBaz'
Convert a variable name to CamelCase format (capitalize the first letter of each word).
str: (string) The string to convert.
return: (string) Returns the converted string.
varname.camelcase('foo_bar_baz'); // 'FooBarBaz'
Convert a variable name to dash format.
str: (string) The string to convert.
return: (string) Returns the converted string.
varname.dash('FooBarBaz'); // 'foo-bar-baz'
Convert a variable name to underscore format.
str: (string) The string to convert.
return: (string) Returns the converted string.
varname.underscore('FooBarBaz'); // 'foo_bar_baz'
Split a string into separate variable parts. This allows you to write your own format converters easily.
str: (string) The string to split.
return: (array) Returns an array of parts.
varname.split('fooBarBaz');
varname.split('FooBarBaz');
varname.split('foo-bar-baz');
varname.split('foo_bar_baz');
varname.split('♥~foo|bar|baz~♥');
// all return ['foo', 'bar', 'baz']
To develop Varname, you'll need to clone the repo and install dependencies with make deps
. If you're on Windows, you'll also need to install Make for Windows.
Once you're set up, you can run the following commands:
$ make deps # Install dependencies
$ make lint # Run JSHint with the correct config
$ make test # Run unit tests in Node
$ make test-server # Run a server for browser unit testing (visit localhost:3000)
When no build target is specified, make will run deps lint test
. This means you can use the following command for brevity:
$ make
Code with lint errors or no/failing tests will not be accepted, please use the build tools outlined above.
Varname is licensed under the MIT license.
FAQs
Convert strings between different variable naming formats
The npm package varname receives a total of 22,304 weekly downloads. As such, varname popularity was classified as popular.
We found that varname demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.