New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

sweet-array-slice

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

sweet-array-slice

sweet.js macro for array slicing, specifically to deal with the cost of argument slicing

latest
Source
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

sweet-array-slice

sweet.js macro for array slice. It's specifically intended to deal with deoptimization due to arguments slicing.

How to use

npm install sweet-array-slice sweet

npm install -g sweet.js # if you don't already have sweet.js
sjs -m sweet-array-slice <your-sweet-code>

Example

  • usage in rsvp

Before

// test.js

// example 1
var a = arraySlice(arguments);
// example 2
var b = arraySlice(arguments, 1);
// example 3
var c = arraySlice(arguments, 1, 2);

After

// example 1
var length$311 = arguments.length;
var a$312 = new Array(length$311);
for (var i$313 = 0; i$313 < length$311; i$313++) {
    a$312[i$313] = arguments[i$313];
}
// example 2
var length$315 = arguments.length;
var start$316 = Math.min(1, length$315 - 1);
var b$317 = new Array(length$315 - start$316);
for (var i$318 = start$316; i$318 < length$315; i$318++) {
    b$317[i$318] = arguments[i$318];
}
// example 3
var length$320 = arguments.length;
var start$321 = Math.min(1, length$320 - 1);
var end$322 = Math.min(2, length$320);
var c$323 = new Array(end$322 - start$321);
for (var i$324 = start$321; i$324 < end$322; i$324++) {
    c$323[i$324] = arguments[i$324];
}

Keywords

array slice

FAQs

Package last updated on 01 Jun 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts