SmallTypes
Object-oriented utility framework written in TypeScript. Heavily inspired by Cactoos.
Warning: very early version. Not usable for production.
Getting started
Installing
smalltypes
is available on npm. You can install it using:
npm install --save smalltypes
Documentation
Usage examples
Using random numbers, mapping values, calculating sum, rounding result, and caching value.
;new Cached// make sure value is only computed once new Rounded// round number to desired precision new Sum// calculate total from iterable of numbers new Mapped// map each item in an iterable to a different value ,item.value // only want the value from each item , 3 .value // calculate and retrieve value
Filtering, limiting, and mapping collection. Comparing two collections for equality.
new EqualIterables// compare iterables for equality , new Mapped// map each item in an iterable to a different value new Limited// limit an iterable to a certain amount of items new Filtered// filter an iterable to a subset of items that match callback ,item.age > 20 // only get items with age greater than 20 , 3 ,item.name // only want the name from each item .value // calculate and retrieve value
Contributing
Requirements
- Node.
Setup
Clone the repository:
git clone https://github.com/nunof07/smalltypes.git
Change the working directoy:
cd smalltypes
Install dependencies:
npm install
Running
Main tasks:
npm run dev
: Lint, test, and watch for changes.npm run build
: Build library and documentation.npm run coverage
: Test coverage report.npm run commit
: Adds and commits all current changes.
Execute npm run info
for information about all available tasks.
Project structure
dist
: Built files.docs
: API documentation.src/main
: Main source code of the library.src/test
: Unit tests.tasks
: Source code for build tasks and static integration.typings
: Manually specified TypeScript definition files.
Note: the Babel configuration at .babelrc
is mainly used for gulp. For the Babel configuration used to build the library see how the Babel Rollup plugin is setup.
Built With
- Language: TypeScript.
- Tasks: gulp.
- Build: rollup.js, TypeScript, Babel.
- Tests: Mocha, Chai, Istanbul.
- Lint: TSLint.
- Release: semantic-release, Commitizen.
- Dependencies: Greenkeeper.
- Code Integration: Travis CI, Codecov, Code Climate, bitHound.