Skip to content

Commit

Permalink
Added the method _load.
Browse files Browse the repository at this point in the history
  • Loading branch information
jclo committed Aug 25, 2020
1 parent 861f058 commit 6749564
Show file tree
Hide file tree
Showing 19 changed files with 579 additions and 177 deletions.
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
*

!_dist/**/*
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
sudo: false
language: node_js
cache:
directories:
- node_modules
notifications:
email: false
node_js:
- "12"
notifications:
email: false
before_install:
- npm i -g npm@^2.0.0
before_script:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
### HEAD

### 0.0.7 (August 25, 2020)

* Added the method _load,
* ...,


### 0.0.6 (August 10, 2020)

* Updated the project template,
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,25 @@ A `Natural Earth`'s database is a folder that contains, at least, three files ha

This module implements three methods:

* whoami()
* load(database path)
* getFeature(feature number),
* getCollection(),
* getSource(),


### whoami()

This method returns the library name and version.


### load(path)

This method loads the Natural Earth' database.

This method requires one argument, the path to the database.


### getFeature(n)

This method extracts one Feature from Natural Earth's database and returns a Javascript GeoJSON object.
Expand Down
14 changes: 14 additions & 0 deletions _dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,25 @@ A `Natural Earth`'s database is a folder that contains, at least, three files ha

This module implements three methods:

* whoami()
* load(database path)
* getFeature(feature number),
* getCollection(),
* getSource(),


### whoami()

This method returns the library name and version.


### load(path)

This method loads the Natural Earth' database.

This method requires one argument, the path to the database.


### getFeature(n)

This method extracts one Feature from Natural Earth's database and returns a Javascript GeoJSON object.
Expand Down
57 changes: 47 additions & 10 deletions _dist/lib/shp.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*! ****************************************************************************
* SHP v0.0.6
* SHP v0.0.7
*
* A library for reading Natural Earth's SHP files.
* (you can download it from npm or github repositories)
* Copyright (c) 2020 Mobilabs <contact@mobilabs.fr> (http://www.mobilabs.fr).
* Released under the MIT license. You may obtain a copy of the License
* at: http://www.opensource.org/licenses/mit-license.php).
* Built from ES6Kadoo v0.0.0-beta.9.
* Built from ES6Kadoo v0.0.0-beta.12.
* ************************************************************************** */
/*! Generated by Kadoo v0.0.0-beta.6 */
/*! Generated by Kadoo v0.0.0-beta.7 */
// ESLint declarations
/* global define */
/* eslint no-shadow: ['error', { 'allow': ['root'] }] */
Expand Down Expand Up @@ -77,9 +77,11 @@
* . _getDbfFieldDescriptor returns the field descriptor of the Dbf file,
* . _getShpRecord returns a Shp record
* . _getShpHeader returns the header of the shp file,
* . _load imports data loaded externally,
*
*
* Public Methods:
* . whoami returns the library name and version,
* . load loads the Natural Earth database,
* . getCollection returns a GeoJSON collection,
* . getFeature returns the requested GeoJSON feature,
Expand Down Expand Up @@ -127,15 +129,15 @@
*
* @constructor ()
* @public
* @param {String} the argument to be saved as an object variable,
* @param {} -,
* @returns {Object} returns the SHP object,
* @since 0.0.0
*/
const SHP = function() {
const obj = Object.create(methods);
obj.library = {
obj._library = {
name: 'SHP',
version: '0.0.6',
version: '0.0.7',
};
obj._dbf = {
buf: null,
Expand All @@ -146,17 +148,20 @@
buf: null,
header: null,
};
obj._source = null;
return obj;
};

// Attaches a constant to SHP that provides the version of the lib.
SHP.VERSION = '0.0.6';
// Attaches constants to SHP that provide name and version of the lib.
SHP.NAME = 'SHP';
SHP.VERSION = '0.0.7';


// -- Private Static Methods -----------------------------------------------

/**
* Returns the internal objects for testing purpose.
* (must not be deleted)
*
* @method ()
* @private
Expand All @@ -173,9 +178,10 @@

/**
* Returns a reference to this SHP object.
* (must not be deleted)
*
* Nota:
* Running SHP in noConflic mode, returns the SHP variable to
* Running SHP in noConflict mode, returns the SHP variable to
* its previous owner.
*
* @method ()
Expand All @@ -184,7 +190,6 @@
* @returns {Object} returns the SHP object,
* @since 0.0.0
*/
/* istanbul ignore next */
SHP.noConflict = function() {
/* eslint-disable-next-line no-param-reassign */
root.SHP = previousSHP;
Expand Down Expand Up @@ -261,9 +266,41 @@
return this._shp.header;
},

/**
* imports data loaded externally.
*
* @method ()
* @private
* @param {} -,
* @returns {Object} returns the header,
* @since 0.0.0
*/
_load(data) {
[this._dbf.buf] = data;
[, this._shp.buf] = data;
[,, this._source] = data;
DBF.decode(this._dbf);
SH.decode(this._shp);
},


// -- Public Methods -----------------------------------------------------


/**
* Returns the library name and version.
* (must not be deleted)
*
* @method ()
* @public
* @param {} -,
* @returns {Object} returns the library name and version,
* @since 0.0.0
*/
whoami() {
return this._library;
},

/**
* Loads the Natural Earth database.
*
Expand Down
8 changes: 4 additions & 4 deletions _dist/lib/shp.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions _dist/lib/shp.min.mjs

Large diffs are not rendered by default.

57 changes: 47 additions & 10 deletions _dist/lib/shp.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*! ****************************************************************************
* SHP v0.0.6
* SHP v0.0.7
*
* A library for reading Natural Earth's SHP files.
* (you can download it from npm or github repositories)
* Copyright (c) 2020 Mobilabs <contact@mobilabs.fr> (http://www.mobilabs.fr).
* Released under the MIT license. You may obtain a copy of the License
* at: http://www.opensource.org/licenses/mit-license.php).
* Built from ES6Kadoo v0.0.0-beta.9.
* Built from ES6Kadoo v0.0.0-beta.12.
* ************************************************************************** */
/*! Generated by Kadoo v0.0.0-beta.6 */
/*! Generated by Kadoo v0.0.0-beta.7 */
// ESLint declarations
/* global define */
/* eslint no-shadow: ['error', { 'allow': ['root'] }] */
Expand Down Expand Up @@ -78,9 +78,11 @@ const $__ES6GLOB = {};
* . _getDbfFieldDescriptor returns the field descriptor of the Dbf file,
* . _getShpRecord returns a Shp record
* . _getShpHeader returns the header of the shp file,
* . _load imports data loaded externally,
*
*
* Public Methods:
* . whoami returns the library name and version,
* . load loads the Natural Earth database,
* . getCollection returns a GeoJSON collection,
* . getFeature returns the requested GeoJSON feature,
Expand Down Expand Up @@ -128,15 +130,15 @@ const $__ES6GLOB = {};
*
* @constructor ()
* @public
* @param {String} the argument to be saved as an object variable,
* @param {} -,
* @returns {Object} returns the SHP object,
* @since 0.0.0
*/
const SHP = function() {
const obj = Object.create(methods);
obj.library = {
obj._library = {
name: 'SHP',
version: '0.0.6',
version: '0.0.7',
};
obj._dbf = {
buf: null,
Expand All @@ -147,17 +149,20 @@ const $__ES6GLOB = {};
buf: null,
header: null,
};
obj._source = null;
return obj;
};

// Attaches a constant to SHP that provides the version of the lib.
SHP.VERSION = '0.0.6';
// Attaches constants to SHP that provide name and version of the lib.
SHP.NAME = 'SHP';
SHP.VERSION = '0.0.7';


// -- Private Static Methods -----------------------------------------------

/**
* Returns the internal objects for testing purpose.
* (must not be deleted)
*
* @method ()
* @private
Expand All @@ -174,9 +179,10 @@ const $__ES6GLOB = {};

/**
* Returns a reference to this SHP object.
* (must not be deleted)
*
* Nota:
* Running SHP in noConflic mode, returns the SHP variable to
* Running SHP in noConflict mode, returns the SHP variable to
* its previous owner.
*
* @method ()
Expand All @@ -185,7 +191,6 @@ const $__ES6GLOB = {};
* @returns {Object} returns the SHP object,
* @since 0.0.0
*/
/* istanbul ignore next */
SHP.noConflict = function() {
/* eslint-disable-next-line no-param-reassign */
root.SHP = previousSHP;
Expand Down Expand Up @@ -262,9 +267,41 @@ const $__ES6GLOB = {};
return this._shp.header;
},

/**
* imports data loaded externally.
*
* @method ()
* @private
* @param {} -,
* @returns {Object} returns the header,
* @since 0.0.0
*/
_load(data) {
[this._dbf.buf] = data;
[, this._shp.buf] = data;
[,, this._source] = data;
DBF.decode(this._dbf);
SH.decode(this._shp);
},


// -- Public Methods -----------------------------------------------------


/**
* Returns the library name and version.
* (must not be deleted)
*
* @method ()
* @public
* @param {} -,
* @returns {Object} returns the library name and version,
* @since 0.0.0
*/
whoami() {
return this._library;
},

/**
* Loads the Natural Earth database.
*
Expand Down
Loading

0 comments on commit 6749564

Please sign in to comment.