happy-load
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -59,4 +59,4 @@ var fez = require("fez"), | ||
}) | ||
.then(function(){ | ||
return JSON.stringify(data, null, 2); | ||
.then(function() { | ||
return JSON.stringify(data, null, "\t"); | ||
}); | ||
@@ -63,0 +63,0 @@ }); |
{ | ||
"all": [ | ||
{ | ||
"text": "Collecting unicorn tears...", | ||
"subtext": "This may take a moment or two.", | ||
"source": "go.beneaththeink.com", | ||
"id": "go.beneaththeink.com/unicorns" | ||
}, | ||
{ | ||
"text": "Following the Yellow Brick Road...", | ||
"subtext": "\"Toto, I've got a feeling we're not in Kansas anymore.\"", | ||
"source": "go.beneaththeink.com", | ||
"id": "go.beneaththeink.com/yellow-brick-road" | ||
} | ||
], | ||
"by_source": { | ||
"go.beneaththeink.com": [ | ||
0, | ||
1 | ||
] | ||
}, | ||
"by_id": { | ||
"go.beneaththeink.com/unicorns": 0, | ||
"go.beneaththeink.com/yellow-brick-road": 1 | ||
} | ||
"all": [ | ||
{ | ||
"text": "Like a timid ghost or a 1997 text message.", | ||
"subtext": "This may take a moment to appear.", | ||
"source": "go.beneaththeink.com", | ||
"id": "go.beneaththeink.com/timid-ghost" | ||
}, | ||
{ | ||
"text": "Collecting unicorn tears...", | ||
"subtext": "This may take a moment or two.", | ||
"source": "go.beneaththeink.com", | ||
"id": "go.beneaththeink.com/unicorns" | ||
}, | ||
{ | ||
"text": "Following the Yellow Brick Road...", | ||
"subtext": "\"Toto, I've got a feeling we're not in Kansas anymore.\"", | ||
"source": "go.beneaththeink.com", | ||
"id": "go.beneaththeink.com/yellow-brick-road" | ||
} | ||
], | ||
"by_source": { | ||
"go.beneaththeink.com": [ | ||
0, | ||
1, | ||
2 | ||
] | ||
}, | ||
"by_id": { | ||
"go.beneaththeink.com/timid-ghost": 0, | ||
"go.beneaththeink.com/unicorns": 1, | ||
"go.beneaththeink.com/yellow-brick-road": 2 | ||
} | ||
} |
@@ -11,3 +11,2 @@ module.exports = { | ||
if (indexes == null) throw new Error("Missing source '" + source + "'"); | ||
return indexes.map(function(i) { return data.all[i]; }); | ||
@@ -20,5 +19,5 @@ } else { | ||
get: function(id) { | ||
if (typeof id === "number") return this.data.all[id]; | ||
var index = this.data.by_id[id]; | ||
if (index == null) throw new Error("Missing entry with id '" + id + "'"); | ||
return this.data.all[index]; | ||
if (index != null) return this.data.all[index]; | ||
}, | ||
@@ -25,0 +24,0 @@ |
{ | ||
"name": "happy-load", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Improves loading screen morale.", | ||
@@ -5,0 +5,0 @@ "author": "Beneath the Ink <info@beneaththeink.com>", |
@@ -19,5 +19,5 @@ # Happy Load | ||
happy.data; // The raw data. | ||
happy.all([ source ]); // Returns an array of message. Optionally filter by source. | ||
happy.all([ source ]); // Returns an array of all messages. Optionally filter by source. | ||
happy.get(id); // Returns a single message by id. | ||
happy.random([ source ]); // Returns a random message, optionally by source. | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6026
10
108