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

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.0.0 to 1.1.0

benchmark/split.js

5

History.md
1.1.0 / 2014-08-23
==================
* add split(str, sep=,)
1.0.0 / 2014-08-01

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

@@ -490,1 +490,42 @@ /*!

};
/**
* split string to array
* @param {String} str
* @param {String} [sep] default is ','
* @return {Array}
*/
exports.split = function split(str, sep) {
str = str || '';
sep = sep || ',';
var items = str.split(sep);
var needs = [];
for (var i = 0; i < items.length; i++) {
var s = items[i].trim();
if (s.length > 0) {
needs.push(s);
}
}
return needs;
};
// always optimized
exports.splitAlwaysOptimized = function splitAlwaysOptimized() {
var str = '';
var sep = ',';
if (arguments.length === 1) {
str = arguments[0] || '';
} else if (arguments.length === 2) {
str = arguments[0] || '';
sep = arguments[1] || ',';
}
var items = str.split(sep);
var needs = [];
for (var i = 0; i < items.length; i++) {
var s = items[i].trim();
if (s.length > 0) {
needs.push(s);
}
}
return needs;
};

25

package.json
{
"name": "utility",
"version": "1.0.0",
"version": "1.1.0",
"description": "A collection of useful utilities.",
"main": "index.js",
"scripts": {
"test": "make test-all"
"test": "mocha -R spec -t 5000 test/*.test.js",
"test-cov": "node --harmony node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- -t 5000 test/*.test.js",
"test-travis": "node --harmony node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- -t 5000 test/*.test.js",
"jshint": "jshint .",
"autod": "autod -w --prefix '~' -e benchmark && npm run cnpm",
"cnpm": "npm install --registry=https://registry.npm.taobao.org",
"contributors": "contributors -f plain -o AUTHORS",
"test-optimized": "node --allow-natives-syntax --trace_opt --trace_deopt test/optimized.js"
},
"config": {
"blanket": { "pattern": "utility/lib" },
"travis-cov": { "threshold": 99 }
},
"dependencies": {
},

@@ -19,11 +23,10 @@ "devDependencies": {

"benchmark": "*",
"contributors": "*",
"istanbul": "*",
"contributors": "*",
"jshint": "*",
"mm": "~0.2.1",
"mocha": "*",
"mocha-lcov-reporter": "*",
"moment": "~2.7.0",
"should": "~4.0.4",
"cov": "*"
"moment": "~2.8.2",
"optimized": "~1.1.0",
"should": "~4.0.4"
},

@@ -30,0 +33,0 @@ "homepage": "https://github.com/node-modules/utility",

@@ -9,2 +9,4 @@ utility

[![David deps][david-image]][david-url]
[![node version][node-image]][node-url]
[![npm download][download-image]][download-url]

@@ -21,2 +23,6 @@ [npm-image]: https://img.shields.io/npm/v/utility.svg?style=flat

[david-url]: https://david-dm.org/node-modules/utility
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
[node-url]: http://nodejs.org/download/
[download-image]: https://img.shields.io/npm/dm/utility.svg?style=flat-square
[download-url]: https://npmjs.org/package/utility

@@ -162,2 +168,9 @@ ![logo](https://raw.github.com/node-modules/utility/master/logo.png)

### String utils
```js
// split string by sep
utils.split('foo,bar,,,'); // ['foo', 'bar']
```
## benchmark

@@ -164,0 +177,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