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

concat-arrays

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

concat-arrays - npm Package Compare versions

Comparing version 1.0.3 to 2.0.0

.drone.yml

23

benchmark.js

@@ -1,10 +0,17 @@

var assert = require('assert')
var concat = require('./')
var start = process.hrtime()
for(var i=0; i<100000000; i++) concat(['a', 'd'], [1], [2])
var end = process.hrtime(start)
/* eslint-disable no-console */
const concat = require('./')
benchmark('concat-arrays', function () { concat(['a', 'd'], [1], [2]) })
benchmark('native concat', function () { [].concat(['a', 'd'], [1], [2]) })
var ns = end[0] * 1e9 + end[1]
var ms = ns / 1e6
console.log('END')
console.log('%s milliseconds', ms)
function benchmark (name, method) {
const start = process.hrtime()
for (let i = 0; i < 100000000; i++) method()
const end = process.hrtime(start)
const ns = (end[0] * 1e9) + end[1]
const ms = ns / 1e6
console.log('%s took %s milliseconds', name, ms)
}
module.exports = concatArrays
function concatArrays () {
var concatenated = []
var array
var index = 0
const concatenated = []
let array
for (var a = 0, alen = arguments.length; a < alen; a++) {
array = arguments[a]
if (!(array && array.length)) continue
for (var b = 0, blen = array.length; b < blen; b++) {
concatenated[index++] = array[b]
}
for (let a = 0, alen = arguments.length; a < alen; a++) {
array = arguments[a]
if (!(array && array.length)) continue
for (let b = 0, blen = array.length; b < blen; b++) {
concatenated.push(array[b])
}
}

@@ -15,0 +14,0 @@

{
"name": "concat-arrays",
"version": "1.0.3",
"version": "2.0.0",
"description": "Concatenates arrays or array-like objects (arguments)",

@@ -25,3 +25,17 @@ "keywords": [

},
"homepage": "https://github.com/marcbachmann/concat-arrays#readme"
"homepage": "https://github.com/marcbachmann/concat-arrays#readme",
"release": {
"extends": "@livingdocs/semantic-release-presets/npm-github"
},
"ci": {
"isCi": true,
"name": "Drone",
"service": "drone",
"commit": "0550fab55460abacb245b7eb6b360937314d4b9c",
"build": "7",
"branch": "master",
"isPr": false,
"slug": "marcbachmann/concat-arrays",
"date": "2019-03-16T15:08:21.097Z"
}
}
# concat-arrays
[![Greenkeeper badge](https://badges.greenkeeper.io/marcbachmann/concat-arrays.svg)](https://greenkeeper.io/)
Concatenates arrays or array-like objects (arguments)

@@ -4,0 +6,0 @@

@@ -1,6 +0,6 @@

var assert = require('assert')
var concat = require('./')
const assert = require('assert')
const concat = require('./')
// Does not modify original array
var arr = [1, 2]
const arr = [1, 2]
assert.notEqual(concat(arr), arr)

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