javascript-time-ago
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -0,1 +1,3 @@ | ||
// This file is in ES5 syntax to allow for older versions of Node.js | ||
var path = require('path') | ||
@@ -7,3 +9,3 @@ var fs = require('fs') | ||
var locale = file.replace(/\.js$/, '') | ||
javascript_time_ago.locale(require('./locales/' + locale)) | ||
javascript_time_ago.locale(require(path.resolve(__dirname, 'locales', locale))) | ||
}) |
{ | ||
"name": "javascript-time-ago", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "International highly customizable relative time formatting", | ||
@@ -5,0 +5,0 @@ "main": "index.umd.js", |
@@ -257,2 +257,17 @@ # javascript-time-ago | ||
## Loading locales | ||
No locales are loaded by default. This is done to allow tools like Webpack take advantage of code splitting to reduce the resulting javascript bundle size. | ||
But server side doesn't need code splitting, so to load all available locales in Node.js you can use this shortcut: | ||
```js | ||
import javascript_time_ago from 'javascript-time-ago' | ||
// A faster way to load all the localization data for Node.js | ||
// (`intl-messageformat` will load everything automatically when run in Node.js) | ||
global.javascript_time_ago = javascript_time_ago | ||
require('javascript-time-ago/load-all-locales') | ||
``` | ||
## Customization | ||
@@ -259,0 +274,0 @@ |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
102116
1900
392