esbases v0.0.9
esbases
Collection of base classes for use with Babel projects. esbases provides base classes for common native types such as Error and Number. These native types, which, when extended directly, will lead to unwanted side effects and even dysfunctional subclasses such as
- subclasses of error cannot have properties or methods, or,
- Number#getValueOf is not generic.
So, if you ever ran into these problems, then esbases is definitely for you.
Releases
See the changelog for more information.
Project Site
The project site, see (2) under resources below, provides more insight into the project, including test coverage reports and API documentation.
Contributing
You are very welcome to propose changes and report bugs, or even provide pull requests on github.
See the contributing guidelines for more information.
Contributors
See contributors for more information.
Building
See build process and the available build targets for more information on how to build this.
See also development dependencies and on how to deal with them.
Installation
npm --save esbases
Runtime Dependencies
The dependencies denoted in italics must be provided by the using project.
Usage
class EsError
import EsError from 'esbases/error';
class MyError extends EsError
{
constructor(message, cause, data)
{
super(message, cause);
this._data = data;
}
get data()
{
return this._data;
}
}
class EsNumber
import EsNumber from 'esbases/number';
const num1 = ESNumber.parseFloat('0.005');
// -> EsNumber('0.005')
const num2 = ESNumber.parseInt('5');
// -> EsNumber('5')
Similar Projects
babel-plugin-transform-builtin-extend
This new plugin allows you to extend arbitrary native types. While there is nothing wrong with such an approach, I strongly believe that some native types should be left as they are, such as Array, String, or RegExp and so on.
See https://github.com/loganfsmyth/babel-plugin-transform-builtin-extend.
Resources
- (1) Github Site
- (2) Project Site