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

globalize-so-what-cha-want

v0.10.0

Published

Tell me what Globalize 1.x modules you want to use, I'll tell you what you need.

Downloads

12

Readme

Globalize So What'cha Want

Build Status NPM version

Tell me what Globalize 1.x modules you want to use, I'll tell you what you need and in the order you need it.

Usage

Globalize So What'cha Want exposes 2 methods; determineRequiredCldrGlobalizeFiles and determineRequiredCldrData. If you like TypeScript, you're in luck! This ships with its very own definition file.

determineRequiredCldrGlobalizeFiles( options ) => string[]

The string array returned will contain a list of the required cldr / globalize files you need, listed in the order they are required.

var globalizeOptions = {
  currency: true,
  date: true,
  message: true,
  number: true,
  plural: true,
  relativeTime: true
};

var requiredCldrGlobalizeFiles = soWhatchaWant.determineRequiredCldrGlobalizeFiles(globalizeOptions);

// [ 'cldr.js',
//   'cldr/event.js',
//   'cldr/supplemental.js',
//   'globalize.js',
//   'globalize/number.js',
//   'globalize/plural.js',
//   'globalize/currency.js',
//   'globalize/date.js',
//   'globalize/message.js',
//   'globalize/relative-time.js']

determineRequiredCldrData( options ) => string[]

The string array returned will contain a list of the required cldr json data you need. I don't believe ordering matters for the json but it is listed in the same dependency order as the cldr / globalize files are.

var globalizeOptions = {
  currency: true,
  date: true,
  message: true,
  number: true,
  plural: true,
  relativeTime: true
};

var requiredCldrData = soWhatchaWant.determineRequiredCldrData(globalizeOptions);

// [ 'cldr/supplemental/likelySubtags.json',
//   'cldr/main/{locale}/numbers.json',
//   'cldr/supplemental/numberingSystems.json',
//   'cldr/supplemental/plurals.json',
//   'cldr/supplemental/ordinals.json',
//   'cldr/main/{locale}/currencies.json',
//   'cldr/supplemental/currencyData.json',
//   'cldr/main/{locale}/ca-gregorian.json',
//   'cldr/main/{locale}/timeZoneNames.json',
//   'cldr/supplemental/timeData.json',
//   'cldr/supplemental/weekData.json',
//   'cldr/main/{locale}/dateFields.json' ]

Both of these methods take an object which details which globalize modules you are interested in. The object looks like this:

var globalizeOptionsAll = {
  currency: true,
  date: true,
  message: true,
  number: true,
  plural: true,
  relativeTime: true
};

It's not necessary to specify each key and a boolean value. If you were only interested in dates then this would be fine:

var globalizeOptionsForDatesOnly = { date: true };

Web Tool

If you don't want to use the package in the raw you can use this online tool which is built on top of the the globalize-so-what-cha-want package.