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

chunk

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chunk - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

.github/workflows/build.yml

9

package.json
{
"name": "chunk",
"version": "0.0.2",
"version": "0.0.3",
"description": "Chunk converts arrays like `[1,2,3,4,5]` into arrays of arrays like `[[1,2], [3,4], [5]]`.",

@@ -17,8 +17,9 @@ "main": "src/chunk.js",

"devDependencies": {
"mocha": "^1.21.4",
"should": "^4.0.4"
"mocha": "^8.1.1",
"prettier": "^2.0.5",
"should": "^13.2.3"
},
"scripts": {
"test": "mocha --reporter spec --timeout 10000 test/tests.js"
"test": "mocha --reporter spec test/tests.js"
}
}

@@ -0,1 +1,4 @@

![Build](https://github.com/ryancole/chunk/workflows/Build/badge.svg)
![Release](https://github.com/ryancole/chunk/workflows/Release/badge.svg)
Chunk converts arrays like `[1,2,3,4,5]` into arrays of arrays like `[[1,2], [3,4], [5]]`.

@@ -5,3 +8,3 @@

You can install chunk using npm.
You can install chunk using npm ...

@@ -12,2 +15,8 @@ ```

or bower ...
```
bower install chunk
```
## Examples

@@ -14,0 +23,0 @@

"use strict";
(function () {
function chunk(collection, size) {
var result = [];
function chunk (collection, size) {
var result = [];
// default size to two item
size = parseInt(size) || 2;
// add each chunk to the result
for (var x = 0; x < Math.ceil(collection.length / size); x++) {
var start = x * size;
var end = start + size;
result.push(collection.slice(start, end));
}
return result;
};
// default size to two item
size = parseInt(size) || 2;
// export in node or browser
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = chunk;
}
exports.chunk = chunk;
} else {
this.chunk = chunk;
// add each chunk to the result
for (var x = 0; x < Math.ceil(collection.length / size); x++) {
var start = x * size;
var end = start + size;
result.push(collection.slice(start, end));
}
return result;
}
// export in node or browser
if (typeof exports !== "undefined") {
if (typeof module !== "undefined" && module.exports) {
exports = module.exports = chunk;
}
exports.chunk = chunk;
} else {
this.chunk = chunk;
}
}.call(this));
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