forked from 0x2620/oxjs
minor changes in OxJS
This commit is contained in:
parent
66934d22a9
commit
f76ee0cf36
6 changed files with 16 additions and 6 deletions
|
|
@ -5,7 +5,6 @@ Ox.compact <f> Returns an array w/o <code>undefined</code> values
|
|||
> Ox.compact([null,,1,,2,,3])
|
||||
[1, 2, 3]
|
||||
@*/
|
||||
|
||||
Ox.compact = function(arr) {
|
||||
return arr.filter(function(val) {
|
||||
return !Ox.isNull(val) && !Ox.isUndefined(val);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@
|
|||
|
||||
/*@
|
||||
Ox.crossesDateline <f> Returns true if a given line crosses the dateline
|
||||
> Ox.crossesDateline({lat: 0, lng: -90}, {lat: 0, lng: 90})
|
||||
false
|
||||
> Ox.crossesDateline({lat: 0, lng: 90}, {lat: 0, lng: -90})
|
||||
true
|
||||
@*/
|
||||
Ox.crossesDateline = function(pointA, pointB) {
|
||||
return pointA.lng > pointB.lng;
|
||||
|
|
@ -53,6 +57,8 @@
|
|||
Ox.getBearing <f> Returns the bearing from one point to another
|
||||
> Ox.getBearing({lat: -45, lng: 0}, {lat: 45, lng: 0})
|
||||
0
|
||||
> Ox.getBearing({lat: 0, lng: -90}, {lat: 0, lng: 90})
|
||||
90
|
||||
@*/
|
||||
Ox.getBearing = function(pointA, pointB) {
|
||||
var pointA = rad(pointA),
|
||||
|
|
@ -209,6 +215,8 @@
|
|||
|
||||
/*@
|
||||
Ox.isPolar <f> Returns true if a given point is outside the bounds of a mercator projection
|
||||
> Ox.isPolar({lat: 90, lng: 0})
|
||||
true
|
||||
@*/
|
||||
Ox.isPolar = function(point) {
|
||||
return point.lat < Ox.MIN_LATITUDE || point.lat > Ox.MAX_LATITUDE;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
Ox.parseEmailAddresses <f> Takes HTML and turns e-mail addresses into links
|
||||
@*/
|
||||
// fixme: no tests
|
||||
// fixme: shouldn't this be formatEmailAddresses?
|
||||
Ox.parseEmailAddresses = function(html) {
|
||||
return html.replace(
|
||||
/\b([0-9A-Z\.\+\-_]+@(?:[0-9A-Z\-]+\.)+[A-Z]{2,6})\b/gi,
|
||||
|
|
@ -144,8 +145,8 @@ Ox.parseURL = (function() {
|
|||
/*@
|
||||
Ox.parseURLs <f> Takes HTML and turns URLs into links
|
||||
@*/
|
||||
// fixme: is parseURLs the right name?
|
||||
// fixme: no tests
|
||||
// fixme: shouldn't this be formatURLs?
|
||||
Ox.parseURLs = function(html) {
|
||||
return html.replace(
|
||||
/\b((https?:\/\/|www\.).+?)([\.,:;!\?\)\]]*?(\s|$))/gi,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue