From 905d2d487f7afc8549b3199356e22e40ede5e00e Mon Sep 17 00:00:00 2001 From: TrasherDK Date: Mon, 2 Sep 2019 18:07:32 +0700 Subject: [PATCH 1/2] Add working example Added a working example to README Added a link to RunKit with working example. --- README.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 351c78d..1a85edb 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ Is identical to a plain Javascript [ES6 Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) but with a cap on it's size. Once `x` amount of items have been added to the set it will start dropping the first item in the set. +## Test on RunKit +[trasherdk/fixedset](https://runkit.com/trasherdk/fixedset) + ## Usage ### Syntax @@ -10,8 +13,32 @@ Is identical to a plain Javascript [ES6 Set](https://developer.mozilla.org/en-US new Set(setSize: number, ...items: T[])` ``` -### Example +## Examples + +### Plain Javascript/Node +```javascript +const FixedSet = require("@magic8bot/fixedset").FixedSet; + +var data = [ + { "o": 10.0, "h":15.0, "l":9.5, "c":11.0 }, + { "o": 11.0, "h":12.5, "l":9.8, "c":12.0 }, + { "o": 12.0, "h":15.5, "l":10.5, "c":13.0 }, + { "o": 13.0, "h":16.0, "l":10.5, "c":14.0 } +]; + +var fixedset = new FixedSet(5, data); +for (let item of fixedset.values()) + console.log(item); + +console.log("Add one object"); + +fixedset.add({"o": 14.0, "h": 14.5, "l": 12.0, "c":13.5}); + +for (let item of fixedset.values()) + console.log(item); +``` +### Typescript ```typescript import { FixedSet } from '@magic8bot/fixedset' From 35acb267e47babb8fb296fbe9a28bd1e175f374d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 19 Sep 2020 12:44:56 +0000 Subject: [PATCH 2/2] Bump js-yaml from 3.12.0 to 3.14.0 Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.12.0 to 3.14.0. - [Release notes](https://github.com/nodeca/js-yaml/releases) - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodeca/js-yaml/compare/3.12.0...3.14.0) Signed-off-by: dependabot[bot] --- yarn.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yarn.lock b/yarn.lock index 9a9b079..a0796d1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -138,8 +138,8 @@ js-tokens@^3.0.2: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" js-yaml@^3.7.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" + version "3.14.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" dependencies: argparse "^1.0.7" esprima "^4.0.0"