Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

happy-load

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

happy-load - npm Package Compare versions

Comparing version 1.0.4 to 2.0.0

happy-load.json

69

lib/index.js

@@ -1,28 +0,41 @@

module.exports = {
data: require("./happy-load.json"),
all: function(source) {
var data = this.data;
if (source != null) {
var indexes = data.by_source[source];
if (indexes == null) throw new Error("Missing source '" + source + "'");
return indexes.map(function(i) { return data.all[i]; });
} else {
return data.all;
}
},
get: function(id) {
if (typeof id === "number") return this.data.all[id];
var index = this.data.by_id[id];
if (index != null) return this.data.all[index];
},
random: function(source) {
var data = this.all(source);
return data[Math.floor(Math.random() * data.length)];
}
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.data = require("../happy-load.json");
/**
* Returns an array of all loading message objects. Provide a source to get messages for just that source.
* @param source Optional source to scope messages.
*/
function all(source) {
if (source != null) {
var indexes = exports.data.by_source[source];
if (indexes == null)
throw new Error("Missing source '" + source + "'");
return indexes.map(function (i) { return exports.data.all[i]; });
}
else {
return exports.data.all;
}
}
exports.all = all;
/**
* Get a specific loading message by id.
* @param id The string id or index of the loading message.
*/
function get(id) {
if (typeof id === "number")
return exports.data.all[id];
var index = exports.data.by_id[id];
if (index != null)
return exports.data.all[index];
}
exports.get = get;
/**
* Get a random loading message, optionally scoped to a source.
* @param source Optional source to scope messages.
*/
function random(source) {
var messages = all(source);
return messages[Math.floor(Math.random() * messages.length)];
}
exports.random = random;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFpQmEsUUFBQSxJQUFJLEdBQVMsT0FBTyxDQUFDLG9CQUF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tcbiAgICByZXR1cm4gZGF0YS5hbGw7XG4gIH1cbn1cblxuLyoqXG4gKiBHZXQgYSBzcGVjaWZpYyBsb2FkaW5nIG1lc3NhZ2UgYnkgaWQuXG4gKiBAcGFyYW0gaWQgVGhlIHN0cmluZyBpZCBvciBpbmRleCBvZiB0aGUgbG9hZGluZyBtZXNzYWdlLlxuICovXG5leHBvcnQgZnVuY3Rpb24gZ2V0KGlkOiBudW1iZXIgfCBzdHJpbmcpIHtcbiAgaWYgKHR5cGVvZiBpZCA9PT0gXCJudW1iZXJcIikgcmV0dXJuIGRhdGEuYWxsW2lkXTtcbiAgY29uc3QgaW5kZXggPSBkYXRhLmJ5X2lkW2lkXTtcbiAgaWYgKGluZGV4ICE9IG51bGwpIHJldHVybiBkYXRhLmFsbFtpbmRleF07XG59XG5cbi8qKlxuICogR2V0IGEgcmFuZG9tIGxvYWRpbmcgbWVzc2FnZSwgb3B0aW9uYWxseSBzY29wZWQgdG8gYSBzb3VyY2UuXG4gKiBAcGFyYW0gc291cmNlIE9wdGlvbmFsIHNvdXJjZSB0byBzY29wZSBtZXNzYWdlcy5cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIHJhbmRvbShzb3VyY2U/OiBzdHJpbmcpIHtcbiAgY29uc3QgbWVzc2FnZXMgPSBhbGwoc291cmNlKTtcbiAgcmV0dXJuIG1lc3NhZ2VzW01hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIG1lc3NhZ2VzLmxlbmd0aCldO1xufVxuIl19
{
"name": "happy-load",
"version": "1.0.4",
"description": "Improves loading screen morale.",
"author": "Beneath the Ink <info@beneaththeink.com>",
"contributors": [
{
"name": "Tyler Johnson",
"email": "tyler@beneaththeink.com"
}
],
"repository": {
"type": "git",
"url": "https://github.com/BeneathTheInk/happy-load.git"
},
"main": "lib/index.js",
"scripts": {
"build": "node lib/build.js"
},
"devDependencies": {
"bluebird": "2.3.2",
"js-yaml": "3.2.2"
},
"bugs": {
"url": "http://github.com/BeneathTheInk/happy-load/issues"
},
"license": "MIT",
"keywords": [
"load",
"loading",
"screen",
"message",
"happy",
"text"
]
}
"name": "happy-load",
"version": "2.0.0",
"description": "Improves loading screen morale.",
"author": "Pagedip <info@pagedip.com>",
"contributors": [
"Tyler Johnson <tyler@pagedip.com>"
],
"repository": {
"type": "git",
"url": "https://github.com/pagedip/happy-load.git"
},
"bugs": {
"url": "http://github.com/pagedip/happy-load/issues"
},
"main": "lib/index.js",
"scripts": {
"lint": "tslint -p tsconfig.json -c tslint.json '**/*.ts'",
"clean": "shx rm -rf lib",
"build:full": "npm-run-all clean build",
"build:data": "node build-data.js",
"build:docs": "typedoc --out docs src/ && shx touch docs/.nojekyll",
"build:typescript": "tsc -p tsconfig.json",
"build": "npm-run-all build:data build:typescript build:docs",
"prepare": "npm run build",
"autorelease": "autorelease pre && npm publish && autorelease post"
},
"devDependencies": {
"@types/node": "^10.5.6",
"autorelease": "^1.7.1",
"autorelease-github": "^1.2.0",
"autorelease-travis": "^1.4.0",
"js-yaml": "^3.12.0",
"mz": "^2.7.0",
"npm-run-all": "^4.1.3",
"shx": "^0.3.2",
"tslint": "^5.11.0",
"typedoc": "^0.11.1",
"typescript": "^2.8.4"
},
"license": "MIT",
"keywords": [
"load",
"loading",
"screen",
"message",
"happy",
"text"
],
"files": [
"lib",
"happy-load.json"
]
}

@@ -16,3 +16,3 @@ # Happy Load

```javascript
var happy = require("happy-load");
const happy = require("happy-load");

@@ -23,2 +23,2 @@ happy.data; // The raw data.

happy.random([ source ]); // Returns a random message, optionally by source.
```
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc