New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dateable

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dateable - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

102

index.js
var fs = require('fs')
, path = require('path')
, files = fs.readdirSync('./lang')
, files = fs.readdirSync(path.join(__dirname, 'lang'))
, langs = {}

@@ -10,3 +10,3 @@ , lang

langs[language] = require(path.resolve('lang', filename));
langs[language] = require('./lang/' + filename);
});

@@ -29,10 +29,2 @@

/**
* Set the language
*
* @param {String|Object} language
* @api public
*/
exports.setLang = function (language) {

@@ -45,10 +37,2 @@ if (typeof language == 'object')

/**
* Returns a date as a formatted string
*
* @param {Date} date
* @param {String} format
* @return {String}
*/
exports.format = function (date, format) {

@@ -106,10 +90,2 @@ var tokens = /Y{2,4}|[Md]{1,4}|[DHhms]{1,2}|[Aa]|"[^"]*"|'[^']*'/g

/**
* Parses a date based on a format
*
* @param {String} string
* @param {String} format
* @return {Date}
*/
exports.parse = function (string, format) {

@@ -168,12 +144,2 @@ var tokenizer = /Y{2,4}|[Md]{1,4}|[DHhms]{1,2}|[Aa]/g

/**
* Answers the question "when?"
* Returned unit can be specified or omitted
*
* @param {Date} date
* @param {String} [unit]
* @return {String}
* @api public
*/
exports.when = function (date, unit) {

@@ -194,12 +160,2 @@ var diff = date.valueOf() - Date.now()

/**
* Returns the difference between two dates
*
* @param {Date} start
* @param {Date} end
* @param {String} [unit]
* @return {String}
* @api public
*/
exports.diff = function (start, end, unit) {

@@ -214,11 +170,2 @@ var diff = start.valueOf() - end.valueOf()

/**
* Returns the value in either plural or singular form
*
* @param {int} value
* @param {String} unit
* @return {String}
* @api private
*/
function pluralize (value, unit) {

@@ -230,11 +177,2 @@ var form = lang.units[unit][value > 1 ? 1 : 0];

/**
* Determine the unit that's best suited for
* displaying the given period of time
*
* @param {int} ms
* @return {String}
* @api private
*/
function determineUnit (ms) {

@@ -253,10 +191,2 @@ var unit;

/**
* Sprinf-like method for parsing output strings
*
* @param {String}
* @return {String}
* @api private
*/
function printify (string) {

@@ -278,12 +208,2 @@ var args = [].slice.call(arguments, 1)

/**
* Pads a number with zeros
*
* @param {int} number
* @param {int} [zeros]
* @return {String}
* @api private
*/
function pad (number, zeros) {

@@ -294,10 +214,2 @@ return number < Math.pow(10, zeros || 1)

}
/**
* Converts an Object to a date
*
* @param {Object} parts
* @return {Date}
* @api private
*/

@@ -313,3 +225,3 @@ function toDate (obj) {

if (abbr == 'pm' && obj.h < 12)
obj.H == obj.h + 12;
obj.H = obj.h + 12;
}

@@ -335,10 +247,2 @@

/**
* Converts a date to an Object
*
* @param {Date} date
* @return {Object}
* @api private
*/
function toObject (date) {

@@ -345,0 +249,0 @@ var obj = {

2

package.json
{
"name": "dateable",
"description": "A date formatter and parser for node",
"version": "0.1.1",
"version": "0.1.2",
"author": "Eivind Fjeldstad",

@@ -6,0 +6,0 @@ "repository": {

@@ -34,3 +34,3 @@ # dateable

// You can also get the difference between two dates:
// And...
dateable.diff(new Date(2015), new Date()); // 3 years

@@ -37,0 +37,0 @@ ```

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