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

turf-size

Package Overview
Dependencies
Maintainers
8
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turf-size - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

26

index.js

@@ -0,1 +1,25 @@

/**
* Takes a bounding box and returns a new bounding box with a size expanded or contracted
* by a factor of X.
*
* @module turf/size
* @category measurement
* @param {Array<number>} bbox a bounding box
* @param {number} factor the ratio of the new bbox to the input bbox
* @return {Array<number>} the resized bbox
* @example
* var bbox = [0, 0, 10, 10]
*
* var resized = turf.size(bbox, 2);
*
* var features = {
* "type": "FeatureCollection",
* "features": [
* turf.bboxPolygon(bbox),
* turf.bboxPolygon(resized)
* ]
* };
*
* //=features
*/
module.exports = function(bbox, factor){

@@ -16,2 +40,2 @@ var currentXDistance = (bbox[2] - bbox[0]);

return sized;
}
}

15

package.json
{
"name": "turf-size",
"version": "1.1.0",
"version": "1.1.1",
"description": "turf size module",
"main": "index.js",
"scripts": {
"test": "node test.js"
"test": "node test.js",
"doc": "dox -r < index.js | doxme --readme > README.md"
},
"repository": {
"type": "git",
"url": "https://github.com/morganherlocker/turf-size.git"
"url": "https://github.com/Turfjs/turf-size.git"
},

@@ -23,9 +24,11 @@ "keywords": [

"bugs": {
"url": "https://github.com/morganherlocker/turf-size/issues"
"url": "https://github.com/Turfjs/turf-size/issues"
},
"homepage": "https://github.com/morganherlocker/turf-size",
"homepage": "https://github.com/Turfjs/turf-size",
"devDependencies": {
"benchmark": "^1.0.0",
"tape": "^3.0.3"
"tape": "^3.5.0",
"dox": "^0.6.1",
"doxme": "^1.4.3"
}
}

@@ -1,34 +0,47 @@

turf-size
=========
[![Build Status](https://travis-ci.org/Turfjs/turf-size.svg)](https://travis-ci.org/Turfjs/turf-size)
# turf-size
Takes a bbox and returns a new bbox with a size expanded or contracted by a factor of X.
[![build status](https://secure.travis-ci.org/Turfjs/turf-size.png)](http://travis-ci.org/Turfjs/turf-size)
###Install
turf size module
```sh
npm install turf-size
```
###Parameters
### `turf.size(bbox, factor)`
|name|description|
|---|---|
|bbox|[xmin, ymin, xmay, ymax]|
|factor|the factor to increase or decrease size by|
Takes a bbox and returns a new bbox with a size expanded or contracted
by a factor of X.
###Usage
```js
size(bbox, factor)
```
### Parameters
###Example
| parameter | type | description |
| --------- | -------------- | ------------------------------------------- |
| `bbox` | Array.<number> | a bounding box |
| `factor` | number | the ratio of the new bbox to the input bbox |
### Example
```js
var bbox = [0, 0, 10, 10]
var resized = turf.size(bbox, 2);
var features = turf.featurecollection([
turf.bboxPolygon(bbox),
turf.bboxPolygon(resized)]);
var doubled = size(bbox, 2)
//=features
```
console.log(doubled) // [-10, -10, 20, 20]
```
## Installation
Requires [nodejs](http://nodejs.org/).
```sh
$ npm install turf-size
```
## Tests
```sh
$ npm test
```
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