diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e98f58d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +# EditorConfig: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +charset = utf-8 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 4 + +# 2 space indentation +[*.yaml, *.yml] +indent_style = space +indent_size = 2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..81ac59e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,17 @@ +name: Tests +on: ['push', 'pull_request'] +jobs: + test: + name: Node.js ${{ matrix.node-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: [^12, ^14, ^16, ^17] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm test \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..e7ef1ee --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +# Global +node_modules/ + +# OS Generated +.DS_Store* +ehthumbs.db +Icon? +Thumbs.db +*.swp + +# phpstorm +.idea/* diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100755 index 0000000..c38ba1d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ + +# [1.0.0](https://github.com/faker-javascript/boolean) (2022-01-08) +* Initial release diff --git a/LICENSE b/LICENSE index 93fdf6e..3006bf0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 Faker Javascript +Copyright (c) Sergey Romanenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 80d9571..a72f685 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,38 @@ -# boolean +

Boolean

+

Boolean package provides functionality to generate a fake boolean value. +

+ +

+Version License +

+ +## Install + +``` +$ npm install --save @fakerjs/random-boolean +``` + +## Usage + +```js +import fakeBoolean from '@fakerjs/boolean'; + +fakeBoolean(); +//=> true + +fakeBoolean(); +//=> false +``` + +## Tests + +Run tests + +``` +npm run test +``` + +## License +[The MIT License (MIT)](https://github.com/faker-javascript/random-boolean/blob/master/LICENSE.txt) +Copyright (c) [Sergey Romanenko](https://github.com/Awilum) diff --git a/index.js b/index.js new file mode 100644 index 0000000..bf29ad9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +export default function fakeBoolean() { + return Math.random() >= 0.5; +}; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..788b294 --- /dev/null +++ b/package.json @@ -0,0 +1,35 @@ +{ + "name": "@fakerjs/boolean", + "version": "1.1.0", + "description": "Random Boolean package provides functionality to generate a random boolean value.", + "license": "MIT", + "repository": "fakerjs/random-boolean", + "author": { + "name": "Sergey Romanenko", + "email": "awilum@msn.com", + "url": "https://github.com/Awilum" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "ava" + }, + "devDependencies": { + "ava": "^3.15.0" + }, + "files": [ + "index.js" + ], + "keywords": [ + "fakerjs", + "fake", + "random", + "bool", + "boolean", + "true", + "false" + ] +} \ No newline at end of file diff --git a/test.js b/test.js new file mode 100644 index 0000000..e24474c --- /dev/null +++ b/test.js @@ -0,0 +1,6 @@ +import fakeBoolean from './index.js'; +import test from 'ava'; + +test('fakeBoolean return type to be boolean', t => { + t.is(typeof fakeBoolean(), 'boolean'); +}); \ No newline at end of file