Skip to content

Commit

Permalink
chore: add CodeSandbox to the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
SMAKSS committed Oct 19, 2022
1 parent cc00d62 commit 6d6137d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
10 changes: 7 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ yarn add @smakss/random-array-element
to include it with common js module you should do this:

```js
var randomArrayElement = require('@smakss/random-array-element');
var randomArrayElement = require("@smakss/random-array-element");
```

and to include it with ECMAscript module you can simply do this one:

```js
import randomArrayElement from '@smakss/random-array-element';
import randomArrayElement from "@smakss/random-array-element";
```

then to use it within your application you can do it just like this:
Expand All @@ -36,7 +36,7 @@ const chooser = randomArrayElement();
```

```js
const chooser = randomArrayElement(['Foo', 'Bar', 'FU', 'FooBar']);
const chooser = randomArrayElement(["Foo", "Bar", "FU", "FooBar"]);
// Initiating the selector once and then we can use the returned function to select random none repeatable elements from the array.

chooser();
Expand All @@ -59,3 +59,7 @@ chooser();
## Demo

You can check the [working demo](https://runkit.com/smakss/random-array-element) in runkit.

or

[![View @smakss/random-array-element](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/smakss-random-array-element-7yizos?fontsize=14&hidenavigation=1&theme=dark)
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
{
"name": "@smakss/random-array-element",
"version": "1.2.3",
"author": "SMAKSS",
"bugs": {
"url": "https://github.com/SMAKSS/random-array-element/issues"
},
"description": "Selects a random unique array element without repetition from provided array.",
"type": "module",
"main": "./index.cjs",
"exports": {
"import": "./index.mjs",
"require": "./index.cjs"
},
"repository": {
"type": "git",
"url": "git+https://github.com/SMAKSS/random-array-element.git"
},
"homepage": "https://github.com/SMAKSS/random-array-element#readme",
"keywords": [
"npm",
"yarn",
Expand All @@ -25,10 +22,13 @@
"random-element-without-repeat",
"random-array-element-without-repetition"
],
"author": "SMAKSS",
"license": "MIT",
"bugs": {
"url": "https://github.com/SMAKSS/random-array-element/issues"
"main": "./index.cjs",
"name": "@smakss/random-array-element",
"repository": {
"type": "git",
"url": "git+https://github.com/SMAKSS/random-array-element.git"
},
"homepage": "https://github.com/SMAKSS/random-array-element#readme"
"type": "module",
"version": "1.2.4"
}

0 comments on commit 6d6137d

Please sign in to comment.