New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

just-split-at

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

just-split-at - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

17

index.js

@@ -7,8 +7,17 @@ module.exports = splitAt;

splitAt([], 2); // [[], []]
splitAt(null, 1); // undefined
splitAt(undefined, 1); // undefined
splitAt(null, 1); // throws
splitAt(undefined, 1); // throws
*/
function splitAt(array, n) {
return Array.isArray(array) ? [array.slice(0, n), array.slice(n)] : undefined;
function splitAt(arr, n) {
if (!Array.isArray(arr)) {
throw new Error('expected an array for the first argument');
}
if (n != null && typeof n != 'number') {
throw new Error('expected a number or null for the second argument');
}
if (n == null) {
n = 0;
}
return [arr.slice(0, n), arr.slice(n)];
}
{
"name": "just-split-at",
"version": "1.0.0",
"version": "2.0.0",
"description": "splits an array into two at a given position",

@@ -10,8 +10,3 @@ "main": "index.js",

"repository": "https://github.com/angus-c/split-at",
"keywords": [
"array",
"split-at",
"no-dependencies",
"just"
],
"keywords": ["array", "split-at", "no-dependencies", "just"],
"author": "Cameron Hunter",

@@ -18,0 +13,0 @@ "license": "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