-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Convert degree to radian
Parameters
-
degint degree
Examples
deg2rad(180);
// => Math.PIReturns int radian
Meta
- since: 1.0.0
src/geometry/getDistanceFromLatLonInKm.js:31-43
Calculate distance two geographic coordinates Decimal (World Geodetic System WGS84)
Parameters
-
lat1int From GPS latitude -
lon1int From GPS longitude -
lat2int To GPS latitude -
lon2int To GPS longitude
Examples
getDistanceFromLatLonInKm(47.4925, 19.0513, 40.71448, -74.00598);
// => 7008
// Budapest - New York distanceReturns int distance in km
src/geometry/distance.js:15-18
Calculate distance two coordinate points
Parameters
Examples
distance({ x: 1, y: 1 }, { x: 2, y: 2 });
// => 1.4142135623730951Returns int
Meta
- since: 1.2.0
src/geometry/pointInRect.js:20-22
Check a point is inside of a rectangle
Parameters
-
a[object] observed point -
b[object] rectangle top left corner -
c[object] rectangle bottom right corner
Examples
pointInRect(
{ x: 1, y: 1 },
{ x: 1, y: 2 },
{ x: 1, y: 4 },
)
// => falseReturns bool
Meta
- since: 1.2.0
src/geometry/twoLineIntersection.js:24-53
Intersection of two lines
Parameters
a1a2b1b2
Examples
twoLineIntersection(
{ x: 5, y: 10 },
{ x: 5, y: 1 },
{ x: 1, y: 5 },
{ x: 10, y: 5 },
)
// => { x: 5, y: 5 }Returns object Intersection point coorinate
Meta
- since: 1.2.0
Clamping is the process of limiting a position to an area. Interval two value (min -> {x} <- max)
Parameters
-
valueint inspected value -
minint value must be minimum -
maxint value can not be more than the maximum
Examples
clamp(10, 15, 20);
// => 15Returns int value among min and max
Meta
- since: 1.0.0
Helper to Data grid Object transforms: paginate, sort, filters
Parameters
data-
settings(optional, default{})
Examples
// data
[
{ id: 1, name: 'Megan J. Cushman', gender: 1, visits: '2017-07-23' },
{ id: 2, name: 'Taylor R. Fallin', gender: 2, visits: '2017-07-22' },
{ id: 3, name: 'Jose C. Rosado', gender: 1, visits: '2017-07-20' },
{ id: 4, name: 'Sammy C. Brandt', gender: 1, visits: '2017-07-10' },
];
// settings
{
paginate:
{
limit: 2,
},
order:
{
column: 'name',
direction: 'desc',
},
filters:
[
{
id: 'search',
handler: (record, value) =>
record.name
.toString()
.toLowerCase()
.indexOf(value.toString().toLowerCase()) >= 0,
arguments: [],
status: false,
},
],
};Meta
- since: 1.0.0
Raw data.
Handled data results.
Current order settings
Examples
const data = new Data(json);
data.order = {column: 'name', direction: 'asc'};
// => data.resultsFilter Collections
Examples
const data = new Data(json);
data.filters = [
{
id: 'foo',
handler: (record, foo, bar) => record.foo == foo,
arguments: ['foo', 'bar'],
status: true,
}];
// => data.resultsCurrent order settings
Examples
const data = new Data(json);
data.paginate = {
page: 3,
limit: 1
};
// => data.paginate.resultsData handling process -> this.results
- apply filters
- sort results
Returns void
Return data element by index
Parameters
-
indexint
Returns object
Return results element by index
Parameters
-
indexint
Returns object
It returns grouped results
Parameters
-
fieldstring grouping result by this object key -
labelIterateefunction group field value format method. Default return original value (optional, default(records,field)) -
valueIterateefunction group field items method. Default is count group elements (optional, default(records,field))
Examples
Grouping by date, where the value sum every record person property [{date: '2016-02-03', person: '3'}...]
// return {'2016-02-03': 22, '2016-02-04': 25 }
groupByResults('date', (value, key) => (_.sum(_.map(value, i => parseInt(i.person)))))Returns object {'group1': ineratee return, 'group2': valueIteratee return}