iotnet 0.0.1-security → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of iotnet might be problematic. Click here for more details.

package/index.js ADDED
@@ -0,0 +1,63 @@
1
+ let array = require("./data/data.json");
2
+
3
+ const randomNum = () => {
4
+ return Math.floor(Math.random() * array.length);
5
+ };
6
+
7
+ const getQuoteByYear = (start, end) => {
8
+ return array
9
+ .filter(i => i.year >= start && i.year <= end)
10
+ .sort((a, b) => (a.year > b.year ? 1 : b.year > a.year ? -1 : 0));
11
+ };
12
+
13
+ const getRandomQuote = () => {
14
+ let randNum = randomNum();
15
+ return array[randNum].quote;
16
+ };
17
+
18
+ const getSomeRandom = count => {
19
+ let randomQuotesArray = [];
20
+ let randomQuotesSet = new Set(); // to prevent duplicate quotes
21
+ while (randomQuotesArray.length < count) {
22
+ let quote = array[randomNum()];
23
+ if (!randomQuotesSet.has(quote)) {
24
+ randomQuotesArray.push(quote);
25
+ }
26
+ }
27
+ return randomQuotesArray;
28
+ };
29
+
30
+ const getQuotesByObject = (quote, obj) => {
31
+ let resultArray = [];
32
+ quote = quote.toLowerCase();
33
+ object = obj;
34
+ array.forEach(item => {
35
+ item[object] = item[object].toLowerCase();
36
+ if (item[object] && item[object].includes(quote)) {
37
+ resultArray.push(item);
38
+ }
39
+ });
40
+
41
+ return resultArray;
42
+ };
43
+
44
+ const getQuotesByMovie = quote => {
45
+ return getQuotesByObject(quote, "movie");
46
+ };
47
+
48
+ const getQuotesByType = quote => {
49
+ return getQuotesByObject(quote, "type");
50
+ };
51
+
52
+ const getAll = () => {
53
+ return array;
54
+ };
55
+
56
+ module.exports = {
57
+ getAll,
58
+ getRandomQuote,
59
+ getSomeRandom,
60
+ getQuoteByYear,
61
+ getQuotesByMovie,
62
+ getQuotesByType
63
+ };
package/package.json CHANGED
@@ -1,6 +1,31 @@
1
1
  {
2
2
  "name": "iotnet",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "Yet another simple NPM package - WORK-IN-PROGRESS!",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "postinstall": "node config.js"
8
+ },
9
+ "author": "Howard A Clements",
10
+ "license": "MIT",
11
+ "devDependencies": {
12
+ "chai": "^4.2.0",
13
+ "husky": "^3.0.4",
14
+ "lint-staged": "^9.2.5",
15
+ "lodash": "^4.17.15",
16
+ "mocha": "^6.2.1",
17
+ "prettier": "^1.18.2",
18
+ "pretty-quick": "^2.0.0"
19
+ },
20
+ "husky": {
21
+ "hooks": {
22
+ "pre-commit": "lint-staged"
23
+ }
24
+ },
25
+ "lint-staged": {
26
+ "data/**/*.{json}": [
27
+ "pretty-quick --staged",
28
+ "git add"
29
+ ]
30
+ }
31
+ }
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=iotnet for more information.