Skip to content

Commit

Permalink
feat(core): initial code commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Awilum committed Jan 9, 2022
1 parent f076f04 commit d9b1a43
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Global
node_modules/

# OS Generated
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
*.swp

# phpstorm
.idea/*
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<a name="1.0.0"></a>
# [1.0.0](https://github.com/faker-javascript/animal) (2022-01-09)
* Initial release
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) 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
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: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,43 @@
# animal
<h1 align="center">Animal</h1>
<p align="center">
Animal package provides functionality to generate a fake animal value.
</p>

<p align="center">
<a href="https://github.com/faker-javascript/animal/releases"><img alt="Version" src="https://img.shields.io/github/release/faker-javascript/animal.svg?label=version&color=green"></a> <img src="https://img.shields.io/npm/dt/@fakerjs/animal"> <a href="https://github.com/faker-javascript/animal"><img src="https://img.shields.io/badge/license-MIT-blue.svg?color=green" alt="License"></a> <img src="https://github.com/faker-javascript/animal/actions/workflows/tests.yml/badge.svg">

## Install

```
$ npm install --save @fakerjs/animal
```

## Usage

```js
import fakeAnimal from '@fakerjs/animal';

fakeAnimal();
//=> Snow Leopard

fakeAnimal({type: 'zoo'});
//=> Snow Leopard

fakeAnimal({type: 'zoo', locale: 'en_US'});
//=> Snow Leopard

// Allowed type: ocean, desert, grassland, forest, farm, pet, zoo
// Allowed locale: en_US
```

## Tests

Run tests

```
npm run test
```

## License
[The MIT License (MIT)](https://github.com/faker-javascript/animal/blob/master/LICENSE.txt)
Copyright (c) [Sergey Romanenko](https://github.com/Awilum)
17 changes: 17 additions & 0 deletions index.js

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

32 changes: 32 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@fakerjs/animal",
"version": "1.0.0",
"description": "Animal package provides functionality to generate a fake animal value.",
"license": "MIT",
"repository": "faker-javascript/animal",
"author": {
"name": "Sergey Romanenko",
"email": "[email protected]",
"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",
"animal"
]
}
10 changes: 10 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import fakeProfession from './index.js';
import test from 'ava';

test('fakeAnimal return type to be string', t => {
t.is(typeof fakeProfession(), 'string');
});

test('fakeAnimal with type and locale return type to be string', t => {
t.is(typeof fakeProfession({type: 'zoo', locale: 'en_US'}), 'string');
});

0 comments on commit d9b1a43

Please sign in to comment.