Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
luongngocminh authored Dec 4, 2023
0 parents commit 1ed9c8a
Show file tree
Hide file tree
Showing 38 changed files with 6,457 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Settings for editors and IDEs.
# References at https://editorconfig.org/.

root = true

# Settings for any file.
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Unlinted files and folders.
# References at https://eslint.org/docs/user-guide/configuring#eslintignore

# Generated docs, bundles and type definitions.
docs/
dist/
types/
28 changes: 28 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// @ts-check
/* eslint-env node */

'use strict';

/**
* An object with ESLint options.
* @type {import('eslint').Linter.Config}
*/
const options = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2021,
},
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
};

module.exports = options;
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# File attributes for Git repository.
# References at https://git-scm.com/docs/gitattributes.

# Handle files as text and ensure Unix line endings.
* text=auto eol=lf

# Ignore differences on NPM's lockfile.
# Since version 5.7.0, NPM automatically handles merge conflicts.
package-lock.json -diff
23 changes: 23 additions & 0 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'Setup'
description: "Setups Node.js and npm to run GitHub Actions' jobs."
runs:
using: 'composite'
steps:
- name: 'Setup Node.js'
uses: 'actions/setup-node@v3'
with:
node-version: '16.x'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: 'Keep npm cache for future workflows'
uses: 'actions/cache@v3'
with:
key: "${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}"
path: '~/.npm'
restore-keys: |
${{ runner.os }}-node-
- name: 'Install dependencies'
run: 'npm ci'
shell: 'bash'
46 changes: 46 additions & 0 deletions .github/workflows/continuous-integrations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: 'Continuous Integrations'

on:
push:
branches: ['main']

jobs:
lint:
name: 'Run ESLint and Prettier'
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout the repository'
uses: 'actions/checkout@v3'

- name: 'Setup Node.js and npm'
uses: './.github/actions/setup'

- name: 'Execute the lint script'
run: 'npm run lint'


test:
name: 'Run unit tests with Jest'
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout the repository'
uses: 'actions/checkout@v3'

- name: 'Setup Node.js and npm'
uses: './.github/actions/setup'

- name: 'Execute the test script'
run: 'npm run test'

bundle:
name: 'Bundle package with Rollup.js'
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout the repository'
uses: 'actions/checkout@v3'

- name: 'Setup Node.js and npm'
uses: './.github/actions/setup'

- name: 'Execute the build script'
run: 'npm run build'
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Unversioned files and folders.
# References at https://git-scm.com/docs/gitignore.

# Finder's configuration files (Mac).
.DS_Store

# Node.js modules.
node_modules/

# NPM's shrinkwrap.
# We're using `package-lock.json` instead.
npm-shrinkwrap.json

# Yarn's lockfile, Plug'n'Play, folder and settings.
# We're using npm, and it provides its lockfile and settings.
yarn.lock
.pnp.*
.yarn/
.yarnrc
.yarnrc.yaml

# pnpm's lockfile, workspace definitions and hooks.
# We're using npm, and it provides its lockfile and settings.
pnpm-lock.yaml
pnpm-workspace.yaml
pnpmfile.js

# Log files.
*.log
*.log.*
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Unlinted files and folders.
# References at https://prettier.io/docs/en/ignore.html#ignoring-files.

# Generated docs, bundles and type definitions.
docs/
dist/
types/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) [year] [authorFullName]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# [libraryNameWithSpacesAndUpperCases]

[![Continuous Integrations](https://github.com/[repositoryOwner]/[repositoryName]/actions/workflows/continuous-integrations.yaml/badge.svg?branch=main)](https://github.com/[repositoryOwner]/[repositoryName]/actions/workflows/continuous-integrations.yaml)
[![License](https://badgen.net/github/license/[repositoryOwner]/[repositoryName])](./LICENSE)
[![Package tree-shaking](https://badgen.net/bundlephobia/tree-shaking/[libraryName])](https://bundlephobia.com/package/[libraryName])
[![Package minified & gzipped size](https://badgen.net/bundlephobia/minzip/[libraryName])](https://bundlephobia.com/package/[libraryName])
[![Package dependency count](https://badgen.net/bundlephobia/dependency-count/react[libraryName])](https://bundlephobia.com/package/[libraryName])

## Installation

This library is published in the NPM registry and can be installed using any compatible package manager.

```sh
npm install [libraryName] --save

# For Yarn, use the command below.
yarn add [libraryName]
```

### Installation from CDN

This module has an UMD bundle available through JSDelivr and Unpkg CDNs.

```html
<!-- For UNPKG use the code below. -->
<script src="https://unpkg.com/[libraryName]"></script>

<!-- For JSDelivr use the code below. -->
<script src="https://cdn.jsdelivr.net/npm/[libraryName]"></script>

<script>
// UMD module is exposed through the "[libraryCamelCaseName]" global variable.
console.log([libraryCamelCaseName]);
</script>
```

## Documentation

[Documentation generated from source files by Typedoc](./docs/README.md).

## License

Released under [MIT License](./LICENSE).
30 changes: 30 additions & 0 deletions dist/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*!
* [libraryName] v0.0.0
* (c) [authorFullName]
* Released under the MIT License.
*/

'use strict';

/**
* Check if value is parseable to number.
* @example
* ```js
* isNumberParseable('AAAA');
* //=> false
*
* isNumberParseable('100');
* //=> true
*
* if (!isNumberParseable(value))
* throw new Error('Value can\'t be parseable to `Number`.')
* return Number(value);
* ```
* @param value - An `unknown` value to be checked.
*/
var isNumberParseable = function (value) {
return !Number.isNaN(Number(value));
};

exports.isNumberParseable = isNumberParseable;
//# sourceMappingURL=index.cjs.map
1 change: 1 addition & 0 deletions dist/index.cjs.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions dist/index.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/index.esm.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions dist/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*!
* [libraryName] v0.0.0
* (c) [authorFullName]
* Released under the MIT License.
*/

/**
* Check if value is parseable to number.
* @example
* ```js
* isNumberParseable('AAAA');
* //=> false
*
* isNumberParseable('100');
* //=> true
*
* if (!isNumberParseable(value))
* throw new Error('Value can\'t be parseable to `Number`.')
* return Number(value);
* ```
* @param value - An `unknown` value to be checked.
*/
var isNumberParseable = function (value) {
return !Number.isNaN(Number(value));
};

export { isNumberParseable };
//# sourceMappingURL=index.mjs.map
1 change: 1 addition & 0 deletions dist/index.mjs.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1ed9c8a

Please sign in to comment.