Socket
Socket
Sign inDemoInstall

utility

Package Overview
Dependencies
Maintainers
2
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

utility - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

LICENSE.txt

5

History.md
1.3.0 / 2015-01-31
==================
* feat(string): add string replace
1.2.1 / 2014-11-14

@@ -3,0 +8,0 @@ ==================

@@ -61,1 +61,19 @@ /*!

};
/**
* Replace string
*
* @param {String} str
* @param {String|RegExp} substr
* @param {String|Function} newSubstr
* @return {String}
*/
exports.replace = function replace(str, substr, newSubstr) {
var replaceFunction = newSubstr;
if (typeof replaceFunction !== 'function') {
replaceFunction = function () {
return newSubstr;
};
}
return str.replace(substr, replaceFunction);
};

7

package.json
{
"name": "utility",
"version": "1.2.1",
"version": "1.3.0",
"description": "A collection of useful utilities.",
"main": "index.js",
"main": "lib/utility.js",
"scripts": {

@@ -19,2 +19,5 @@ "test": "mocha -R spec -t 5000 test/*.test.js",

},
"files": [
"lib"
],
"devDependencies": {

@@ -21,0 +24,0 @@ "autod": "*",

@@ -168,2 +168,5 @@ utility

utils.split('foo,bar,,,'); // ['foo', 'bar']
// replace string work with special chars which `String.prototype.replace` can't handle
utils.replace('<body> hi', '<body>', '$& body'); // '$& body hi'
```

@@ -226,23 +229,2 @@

(The MIT License)
Copyright (c) 2012 - 2014 fengmk2 &lt;fengmk2@gmail.com&gt; and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
MIT
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