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

@mapbox/shelf-pack

Package Overview
Dependencies
Maintainers
161
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/shelf-pack - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

.travis.yml

6

CHANGELOG.md
:warning: = Breaking change
## 3.1.0
##### 2017-Aug-25
* Provide shrink as a public method (#90)
## 3.0.0
##### 2017-Feb-12
* shelf-pack is now a scoped package under the @mapbox namespace
* :warning: shelf-pack is now a scoped package under the @mapbox namespace

@@ -7,0 +11,0 @@ ## 2.0.1

39

index.js

@@ -74,19 +74,4 @@ export default ShelfPack;

// Shrink the width/height of the sprite to the bare minimum.
// Since shelf-pack doubles first width, then height when running out of shelf space
// this can result in fairly large unused space both in width and height if that happens
// towards the end of bin packing.
if (this.shelves.length > 0) {
var w2 = 0;
var h2 = 0;
this.shrink();
for (var j = 0; j < this.shelves.length; j++) {
var shelf = this.shelves[j];
h2 += shelf.h;
w2 = Math.max(shelf.w - shelf.free, w2);
}
this.resize(w2, h2);
}
return results;

@@ -270,2 +255,24 @@ };

/**
* Shrink the width/height of the sprite to the bare minimum.
* Since shelf-pack doubles first width, then height when running out of shelf space
* this can result in fairly large unused space both in width and height if that happens
* towards the end of bin packing.
*/
ShelfPack.prototype.shrink = function() {
if (this.shelves.length > 0) {
var w2 = 0;
var h2 = 0;
for (var j = 0; j < this.shelves.length; j++) {
var shelf = this.shelves[j];
h2 += shelf.h;
w2 = Math.max(shelf.w - shelf.free, w2);
}
this.resize(w2, h2);
}
};
/**
* Return a packed bin given its id, or undefined if the id is not found

@@ -272,0 +279,0 @@ *

@@ -77,19 +77,4 @@ (function (global, factory) {

// Shrink the width/height of the sprite to the bare minimum.
// Since shelf-pack doubles first width, then height when running out of shelf space
// this can result in fairly large unused space both in width and height if that happens
// towards the end of bin packing.
if (this.shelves.length > 0) {
var w2 = 0;
var h2 = 0;
this.shrink();
for (var j = 0; j < this.shelves.length; j++) {
var shelf = this.shelves[j];
h2 += shelf.h;
w2 = Math.max(shelf.w - shelf.free, w2);
}
this.resize(w2, h2);
}
return results;

@@ -273,2 +258,24 @@ };

/**
* Shrink the width/height of the sprite to the bare minimum.
* Since shelf-pack doubles first width, then height when running out of shelf space
* this can result in fairly large unused space both in width and height if that happens
* towards the end of bin packing.
*/
ShelfPack$1.prototype.shrink = function() {
if (this.shelves.length > 0) {
var w2 = 0;
var h2 = 0;
for (var j = 0; j < this.shelves.length; j++) {
var shelf = this.shelves[j];
h2 += shelf.h;
w2 = Math.max(shelf.w - shelf.free, w2);
}
this.resize(w2, h2);
}
};
/**
* Return a packed bin given its id, or undefined if the id is not found

@@ -275,0 +282,0 @@ *

ISC License
Copyright (c) 2016, Mapbox
Copyright (c) 2017, Mapbox

@@ -5,0 +5,0 @@ Permission to use, copy, modify, and/or distribute this software for any purpose

{
"name": "@mapbox/shelf-pack",
"description": "A 2D rectangular bin packing data structure that uses the Shelf Best Height Fit heuristic",
"version": "3.0.0",
"version": "3.1.0",
"main": "index.umd.js",

@@ -20,3 +20,2 @@ "jsnext:main": "index.js",

"eslint": "^3.8.0",
"greenkeeper-postpublish": "^1.0.1",
"rollup": "0.41.4",

@@ -33,5 +32,4 @@ "tap": "^10.1.0"

"lint": "eslint index.js test/ bench/",
"test": "npm run build && npm run lint && tap --cov test/*.js",
"postpublish": "greenkeeper-postpublish"
"test": "npm run build && npm run lint && tap --cov test/*.js"
}
}
[![npm version](https://badge.fury.io/js/%40mapbox%2Fshelf-pack.svg)](https://badge.fury.io/js/%40mapbox%2Fshelf-pack)
[![Build Status](https://circleci.com/gh/mapbox/shelf-pack/tree/master.svg?style=shield)](https://circleci.com/gh/mapbox/shelf-pack)
[![Build Status](https://secure.travis-ci.org/mapbox/shelf-pack.svg)](http://travis-ci.org/mapbox/shelf-pack)
[![Coverage Status](https://coveralls.io/repos/github/mapbox/shelf-pack/badge.svg?branch=master)](https://coveralls.io/github/mapbox/shelf-pack?branch=master)

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