Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

a-toolbox

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a-toolbox - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

14

main.js

@@ -6,2 +6,6 @@

String.prototype.capitalize = function () {
return this.substr(0,1).toUpperCase() + this.substr(1).toLowerCase();
};
var tools = {

@@ -188,5 +192,13 @@ /**

};
},
string: {
template: function (data, obj, remove) {
return data.replace(/\{([\w]+)\}/g, function (str, key) {
return obj[key] ? obj[key] : (remove ? '' : str);
});
}
}
};
if (typeof window == 'undefined')
if (module && module.exports)
module.exports = tools;

@@ -193,0 +205,0 @@

2

package.json
{
"name": "a-toolbox",
"version": "0.0.6",
"version": "0.0.7",
"description": "lightweight tools",

@@ -5,0 +5,0 @@ "keywords": ["tools", "lib", "misc", "toolbox", "array", "task", "random"],

@@ -98,2 +98,18 @@ # a-toolbox

#### string template
Replace marker in template string with provided object data
```js
var data = {
name: 'Alice',
year: 2014,
color: 'yellow'
};
var str = '<div>My name is {name} I was born in {year} and my favourite color is {color}</div>{nothing}';
console.log('template:', tools.string.template(str, data));
//> template: <div>My name is Alice I was born in 2014 and my favourite color is yellow</div>{nothing}
#### replaceAll in String prototype

@@ -100,0 +116,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc