npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tidybase

v0.1.2

Published

(For now) Tidybase is a light wrapper around the Firebase JS/Web API.

Downloads

2

Readme

Tidybase

What's Tidybase?

(For now) Tidybase is a light wrapper around the Firebase JS/Web API.

Why Tidybase?

It enables less overhead if ever switching the storage system. That way apps don't need to be updated, but rather the internals of this API wrapper.

Secondly Tidybase offers me more consistency of the API methods as opposed to the original API.

Last but not least, having a wrapper allows for small adjustments and optimisations based on personal preference. Writing/using code that looks and feels like your own has it's merits (productivity, less errors, etc.).

Synchronous code

app()

Initialise app and/or return an app reference.

| Parameter | Type | | ------------- | -------------------- | | db | string or object |

db Either database URL string (to get the reference) or config object (to initialise the app).

/*
When referencing an app the first time you 
need to first initialise it. You do so by
passing a config object to app()

Note: 
Replace <YOUR_...> with the appropriate data
*/
var config = {
	apiKey: '<YOUR_API_KEY>',
	authDomain: '<YOUR_PROJECT_ID>.firebaseapp.com',
	databaseURL: 'https://<YOUR_DATABASE_NAME>.firebaseio.com',
	storageBucket: '<YOUR_BUCKET>.appspot.com',
	messagingSenderId: '<YOUR_SENDER_ID>',
};
var myApp = app(config);

/*
Every following time, we can reference the
app by using the value of config.databaseURL
*/
var dbURL = 'https://<YOUR_DATABASE_NAME>.firebaseio.com';
var myApp = app(dbURL);

/*
Note:
In both cases myApp is an app reference.
*/

app.getUser()

Returns the current user object. If no user authenticated it will return null.

| Parameter | Type | | ------------- | -------- | | dbURL | string |

dbURL URL of the database.

var dbURL = 'https://<YOUR_DATABASE_NAME>.firebaseio.com'; 
var user = app.getUser(dbURL);

app.uuid()

Returns a unique key. Returned keys keep a lexicographic order.

| Parameter | Type | | ------------- | -------- | | dbPath | string |

dbPath Path within the database under which the key is going to be applied. Put otherwise, where value will be stored.

var dbPath = 'https://<YOUR_DATABASE_NAME>.firebaseio.com/foo/bar'; 
var uuid = app.uuid(dbPath);

Promises

A useful explanation of promises.

###app.addUser() Creates a new user.

| Parameter | Type | | ------------- | -------- | | dbURL | string | | user | object |

dbURL URL of the database. user User object. Should contain e-mail and password properties.

var dbURL = 'https://<YOUR_DATABASE_NAME>.firebaseio.com/';
var user = {
			email: '<USER_EMAIL>',
			password: '<USER_PASSWORD>'
			};

app.addUser(dbURL)
	.then(
		function(){
			console.log('Created new user.');
		},
		function(error){
			console.error(error);
		});

###app.updateUser() ###app.updateUserEmail() ###app.updateUserPassword() ###app.userEmailVerificationr() ###app.userEmailResetPassword() ###app.removeUser() ###app.loginUser() ###app.logoutUser() ###app.reauthUser() ###app.set() ###app.push() ###app.update() Updates are transactional (either all succedd or all fail) ###app.get() ###app.remove() ###app.transaction()

Events

app.on()

app.off()

Internals

These functions are not recommended to be used. They are useful for the wrapper code itself though.

app.init()

app.get()

defined()

parsePath()

ref()

app.list


Notes:

Get user returns null and so does getting any value (if nothing is at that path); This is not an error, but a valid return value (think template).