npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@fxi/mx_valid

v0.0.23

Published

Internal validation utilities for MapX

Downloads

142

Readme

MapX mx_valid

Simple validation tool for MapX specific values


Constants

Functions

isNodeEnv

Check if the current environment is Node.js

Kind: global constant

regexUnsafeName

Test for special char : not allowed NOTES: if /g flag is set: inconsistant result: Regex.lastIndex is not reseted between calls, https://medium.com/@nikjohn/regex-test-returns-alternating-results-bd9a1ae42cdd

Kind: global constant

regexDataImg

Test if valide base64

Kind: global constant

isEmpty(item)

Test if entry is empty : empty array, empty string, etc.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Any | item to test |

isNotEmpty()

Inverse isEmpty

Kind: global function

isBbox(item) ⇒ Boolean

Simple lat/lng bbox expected from source summary

Kind: global function
Returns: Boolean - Is lat/lng bbox object
Note: : currently match api/modules/template/sql/getSourceSummary_ext_sp.sql

| Param | Type | | --- | --- | | item | Object |

isBboxMeta(item) ⇒ Boolean

Simple lat/lng bbox expected from source meta

Kind: global function
Returns: Boolean - valid meta bbox

| Param | Type | | --- | --- | | item | Object |

isObject(item)

Test if entry is an object

Kind: global function

| Param | Type | | --- | --- | | item | Object |

isView(item)

Test if it's a MapX view.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Object | to test |

isViewType(item, type, validator)

Test if it's a view of given type

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Object | to test | | type | String | Array | or array of types | | validator | function | Additionnal validator that must return boolean |

isViewVt(item)

Test if it's a MapX view of type vt

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Object | to test |

isViewRt(item)

Test if it's a MapX view of type rt

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Object | to test |

isViewGj(item)

Test if it's a MapX view of type gj

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Object | to test |

isViewSm(item)

Test if it's a MapX view of type gj

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Object | to test |

isViewEditable(item)

Test if it's a MapX view is editable

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Object | to test |

isViewVtWithRules(item)

Test if view vt has style rules

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Object | to test |

isViewVtWithStyleCustom(item)

Test if view vt has custom style

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Object | to test |

isViewVtWithAttributeType(item, attribute)

Test if view vt has specific attribute type r

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Object | to test | | attribute | String | type e.g. string; |

isViewRtWithLegend(item)

Test if view rt has legend url

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Object | to test |

isViewRtWithTiles(item)

Test if view rt has tiles

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Object | to test |

isViewDashboard(item)

Test if view has dashbaord

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Object | to test |

isStory(item) ⇒ Boolean

Test if story map

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Object | Item to test |

isArrayOf(arr, fun) ⇒ Boolean

Generic "array of" tester

Kind: global function

| Param | Type | Description | | --- | --- | --- | | arr | Array | Array | | fun | function | Function |

isArrayOfViews(arr)

Test if is array of views object

Kind: global function

| Param | Type | Description | | --- | --- | --- | | arr | Array | Array to test |

isViewWms(view) ⇒ Boolean

Test if a raster view has wms url

Kind: global function
Returns: Boolean - valid

| Param | Type | | --- | --- | | view | Object |

isArrayOfViewsId(arr) ⇒ Boolean

Test if array of views id

Kind: global function

| Param | Type | Description | | --- | --- | --- | | arr | Array | Array of views id |

isSortedArray(arr, desc)

Check if array is sorted

Kind: global function

| Param | Type | Description | | --- | --- | --- | | arr | Array | Array to test | | desc | Boolean | Descendent ? |

isAgteB(a, b) ⇒ boolean

Compare value an return

Kind: global function

| Param | Type | Description | | --- | --- | --- | | a | Any | A value | | b | Any | B value |

isAgtB(a, b) ⇒ Number

Compare a to b ( for sorting )

Kind: global function
Returns: Number - 1,-1 or 0

| Param | Type | Description | | --- | --- | --- | | a | Any | A value | | b | Any | B value |

isRegExp(value) ⇒ Logical

Test for RegExp instance

Kind: global function
Returns: Logical - is RegExp instance

| Param | Type | | --- | --- | | value | Any |

isProjectId(id) ⇒ Boolean

Test for valid project id

Kind: global function

| Param | Type | Description | | --- | --- | --- | | id | String | Project id to test |

isSourceId(id) ⇒ boolean

Determines if the given ID is a valid MapX source ID.

A valid MapX source ID starts with 'mx', followed optionally by 'vector', and then by 5 to 7 segments of the pattern '[a-z0-9]{1,6}'. The entire ID's length should be within the range of 10 to 50 characters.

Kind: global function
Returns: boolean - - Returns true if the ID matches the pattern and length constraints; otherwise, false.

| Param | Type | Description | | --- | --- | --- | | id | string | The ID to test. |

isArrayOfSourceId(arr)

Test if it's an array of MapX source id

Kind: global function

| Param | Type | Description | | --- | --- | --- | | arr | Array | Array of item to test |

isViewId(id) ⇒ Boolean

Test for valid view id

Kind: global function

| Param | Type | Description | | --- | --- | --- | | id | String | View id to test |

isProject(p) ⇒ Boolean

Test for valid project

Kind: global function

| Param | Type | Description | | --- | --- | --- | | p | Object | Project object |

isProjectsArray(arr) ⇒ Boolean

Test for valid project array

Kind: global function

| Param | Type | Description | | --- | --- | --- | | arr | Array | Array of projects |

isPromise(item)

Test for promise

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Promise | item to test |

isCanvas(item)

Test for canvas

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Element | item to test |

isIconFont(item)

Test for fontawesome icon class

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Element | item to test |

isArray(item)

Test if entry is an aray

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Array | array |

isTable(item)

Test if entry is an table (array of object)

Kind: global function

| Param | Type | Description | | --- | --- | --- | | item | Array | array |

isJSON(String)

Test if entry is JSON

Kind: global function

| Param | Type | Description | | --- | --- | --- | | String | String | to test |

isStringifiable(item) ⇒ Boolean

Test if stringifiable

Kind: global function

| Param | Type | | --- | --- | | item | Any |

isUndefined(item) ⇒ Boolean

Test if entry is undefined

Kind: global function

| Param | Type | | --- | --- | | item | Any |

isNumeric(n)

Test if entry is numeric

Kind: global function

| Param | Type | Description | | --- | --- | --- | | n | String | Number | string or number to test |

isNumericRange(n, min, max)

Test if entry is numeric and in range

Kind: global function

| Param | Type | Description | | --- | --- | --- | | n | String | Number | string or number to test | | min | Number | Minumum | | max | Number | Maximum |

isBoolean(b)

Test if entry is boolean

Kind: global function

| Param | Type | Description | | --- | --- | --- | | b | Boolean | boolean to test |

isBooleanCoercible(b) ⇒ Boolean

Test for a loose boolean type, e.g. from csv...

Kind: global function

| Param | Type | Description | | --- | --- | --- | | b | Boolean | boolean to test |

isMap(map)

Test if is map

Kind: global function

| Param | Type | Description | | --- | --- | --- | | map | Object | Map object |

isLngLatInsideBounds(lngLat, bounds) ⇒ boolean

Checks if a LngLat coordinate is inside the given LngLatBounds object.

Kind: global function
Returns: boolean - - Returns true if the LngLat coordinate is inside the LngLatBounds, otherwise false.

| Param | Type | Description | | --- | --- | --- | | lngLat | mapboxgl.LngLat | The LngLat coordinate to check. | | bounds | mapboxgl.LngLatBounds | The LngLatBounds object to check against. |

isBoundsInsideBounds(bounds_test, bounds) ⇒ boolean

Checks if a LngLatBounds object is inside another LngLatBounds

Kind: global function
Returns: boolean - - Returns true if the LngLatBounds object is inside the current bounds of getMaxBounds, otherwise false.

| Param | Type | Description | | --- | --- | --- | | bounds_test | mapboxgl.LngLatBounds | The LngLatBounds object to check. | | bounds | mapboxgl.LngLatBounds | The LngLatBounds object to compare t. |

isStringRange(str,, min, max)

Test if entry is string and have the correct number of characters

Kind: global function

| Param | Type | Description | | --- | --- | --- | | str, | String | character to test | | min | Number | Minumum number of characters. Default 0. | | max | Number | Maximum number of characters. Default Infinity. |

isSafe(x)

Test if input value is "safe". Use server side -> avoid unwanted stuff for db : columns, values, .. when prepared queries are not possible.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | x | Any | Any |

isSafeName(x)

Test if input is "safe" for naming db table, column.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | x | Any | Any |

isValidType(type, group)

Quick type checker by group eg. image

Kind: global function

| Param | Type | Description | | --- | --- | --- | | type | String | Type to test | | group | String | Group : image, ... NOTE: to be completed |

isHTML(str) ⇒ Boolean

Test if a given string contains HTML.

Kind: global function
Returns: Boolean - True if the string contains HTML, otherwise false.

| Param | Type | Description | | --- | --- | --- | | str | String | The string to test. |

isEmail(email)

Test if entry is an email

Kind: global function

| Param | Type | | --- | --- | | email | String |

isString(str)

Test if entry is string

Kind: global function

| Param | Type | Description | | --- | --- | --- | | str | String | string to test |

isFunction(fun)

Test if entry is function

Kind: global function

| Param | Type | Description | | --- | --- | --- | | fun | function | Function to test |

isElement(obj)

Check if an object is a html element

Kind: global function

| Param | Type | Description | | --- | --- | --- | | obj | Object | object to test |

isEqual(x, y) ⇒ Boolean

Test for object equality

Kind: global function
Returns: Boolean - Are those object equal ?
Note: asnwer by Ebrahim Byagowi at https://stackoverflow.com/questions/201183/how-to-determine-equality-for-two-javascript-objects

| Param | Type | Description | | --- | --- | --- | | x | Object | First object to compare | | y | Object | Second object to compare |

isEqualNoType(a, b) ⇒ boolean

Compares two values for equivalence, ignoring types and leading/trailing whitespace.

Kind: global function
Returns: boolean - - Returns true if the normalized forms of the two values are equivalent, false otherwise.

| Param | Type | Description | | --- | --- | --- | | a | * | The first value to compare. | | b | * | The second value to compare. |

normalizeValue(value) ⇒ string | number

Normalizes a value by converting it to a string, trimming whitespace, and converting it to a number if it represents a valid number.

Kind: global function
Returns: string | number - - The normalized value.

| Param | Type | Description | | --- | --- | --- | | value | * | The value to normalize. |

isUrl(url) ⇒ Boolean

Validate url

Kind: global function
Note: new version uses Url & tryCatch
Note: https://stackoverflow.com/questions/8667070/javascript-regular-expression-to-validate-url
Note: https://mathiasbynens.be/demo/url-regex

| Param | Type | Description | | --- | --- | --- | | url | String | to test |

isUrlHttps(url) ⇒ Boolean

Validate url with https

Kind: global function

| Param | Type | Description | | --- | --- | --- | | url | String | to test |

isUrlValidWms(url, opt) ⇒ Boolean

Check if it's expected url for wms end point.

Kind: global function
Returns: Boolean - valid

| Param | Type | Description | | --- | --- | --- | | url | String | to test | | opt | Object | options | | opt.layers | Boolean | Should the url contains layers param ? |

isDateStringRegex(date)

Validate date string

Kind: global function

| Param | Type | Description | | --- | --- | --- | | date | Number | to validate |

isDateString(date)

Validate date string

Kind: global function

| Param | Type | Description | | --- | --- | --- | | date | String | Number | to validate |

isDate(date)

Validate date object

Kind: global function

| Param | Type | Description | | --- | --- | --- | | date | Date | to validate |


© 2019-present unepgrid.ch