Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ngOnInit(): void {
let param: string = this.route.snapshot.params['id'];
// Mouseflow integration
_mfq.push(['newPageView', '/appointment/' + param]);
// This is a sub-page
this._state.isSubPage.next(true);
this._state.title.next();
this._state.actions.next();
this._state.primaryAction.next();
// Set up localized humanizer for durations
this.localeHumanizer = humanizeDuration.humanizer({
language: localStorage.getItem('locale').startsWith('de') ? 'de' : 'en'
});
this.trans = getI18nStrings();
// Create new appointment
if (param === 'add') {
this.editing = true;
// View or edit existing appointment
} else if (Number(param) !== NaN) {
this.editing = false;
console.log('displaying appointment with id: %d', Number(param));
this.getAppointmentById(Number(param));
}
this.$preview.html("");
this.$preview.hide();
}
this.$input.autocomplete("enable");
var inString = this.$input.val();
if (inString.length < 3) {
this._disallow();
return;
}
this._lookupAndRoute(inString);
}
};
const secsInDay = 24 * 60 * 60;
Util._cookies = {};
Util._scrollbarWidth = null;
Util.sefariaHumanizeDuration = humanizeDuration.humanizer({
units: ['y', 'mo', 'w', 'd', 'h', 'm', 's'],
largest: 1,
round: true,
unitMeasures: {
y: 365 * secsInDay,
mo: 30 * secsInDay,
w: 7 * secsInDay,
d: secsInDay,
h: 60 * 60,
m: 60,
s: 1,
},
languages: {
he: { // add hebrew since it's not supported in the package
y: n => Util.naturalTimePlural(n, 'שנה', 'שנים'),
mo: n => Util.naturalTimePlural(n, 'חודש', 'חודשים'),
this.productName = productName;
this.productVersion = productVersion;
this.productDesc = productDesc;
this.$timeout = $timeout;
this.$scope = $scope;
this.current = 0;
this.label = '';
this.status = '';
this.currentAmount = 0;
this.lastAmount = 0;
this.totalAmount = 0;
this.min = minValue;
this.max = maxValue;
this.lastTime = Date.now();
this.averageSpeed = 0;
this.durationFormat = duration.humanizer(Object.assign({}, shortDuration));
this.durationFormat.units = ['y', 'd', 'h', 'm'];
}
function Traffic($scope, $http, $interval, $q, TimeboxService) {
var BING_MAPS = "http://dev.virtualearth.net/REST/V1/Routes/";
var language = (typeof config.general.language !== 'undefined') ? config.general.language.substr(0, 2) : "en"
var durationHumanizer = require('humanize-duration').humanizer({
language: language,
units: ['h', 'm'],
round: true
});
var getDurationForTrips = function () {
var deferred = $q.defer();
var promises = [];
if (typeof config.traffic != 'undefined' && config.traffic.key != '' && config.traffic.trips) {
angular.forEach(config.traffic.trips, function (trip) {
if (trip.hasOwnProperty('startTime') && TimeboxService.shouldDisplay(trip.startTime, trip.endTime)
|| !trip.hasOwnProperty('startTime')) {
promises.push(getTripDuration(trip));
}
});
const { io } = require('../libs/panel')
const commons = require('../libs/commons')
const _ = require('lodash')
const shortEnglish = require('humanize-duration').humanizer({
language: 'shortEn',
languages: {
shortEn: {
h: () => 'h'
}
},
units: ['h'],
spacer: '',
maxDecimalPoints: 1,
decimal: '.'
})
const notable = require('./notable')
const users = require('./users')
class Variables {
async prepareMessage (response, userstate, message) {
import React, { PropTypes } from 'react';
import humanizeDuration from 'humanize-duration';
const buildDurationHumanizer = humanizeDuration.humanizer({
delimiter: ' ',
units: ['m', 's'],
round: true
});
const shortEnglishHumanizer = humanizeDuration.humanizer({
language: 'shortEn',
languages: {
shortEn: {
m: () => 'm',
s: () => 's',
}
},
delimiter: ' ',
spacer: '',
units: ['m', 's'],
import * as humanizeDuration from 'humanize-duration';
import Vue from 'vue';
import * as http from '../../plugins/http';
const humanizer = humanizeDuration.humanizer({
language: 'shortEn',
units: ['d', 'h', 'm', 's'],
round: true,
delimiter: ' ',
languages: {
shortEn: {
d: () => 'd',
h: () => 'h',
m: () => 'm',
s: () => 's'
}
}
});
export const UPDATECHANNEL = {
NONE: 0,
import React, { PropTypes } from 'react';
import humanizeDuration from 'humanize-duration';
const buildDurationHumanizer = humanizeDuration.humanizer({
delimiter: ' ',
units: ['m', 's'],
round: true
});
const shortEnglishHumanizer = humanizeDuration.humanizer({
language: 'shortEn',
languages: {
shortEn: {
m: () => 'm',
s: () => 's',
}
},
delimiter: ' ',
spacer: '',
units: ['m', 's'],
round: true
});
const BuildDuration = ({startTimestamp, endTimestamp, abbreviateUnits}) => {
const duration = endTimestamp - startTimestamp;
const formattedDuration = abbreviateUnits ? shortEnglishHumanizer(duration) : buildDurationHumanizer(duration);
import * as AsciiTable from 'ascii-table';
import { fork } from 'child_process';
import { Stats } from 'fast-stats';
import * as humanizeDuration from 'humanize-duration';
const time = humanizeDuration.humanizer({
language: 'shortEn',
languages: {
shortEn: {
y() { return 'y'; },
mo() { return 'mo'; },
w() { return 'w'; },
d() { return 'd'; },
h() { return 'h'; },
m() { return 'm'; },
s() { return 's'; },
ms() { return 'ms'; },
decimal: '.',
},
},
});
* @param {Object} obj
* @return {Boolean}
*/
export function isEmpty (obj) {
if (obj !== null && typeof obj !== 'object') {
throw new Error('`obj` must be an object.')
}
return Object.keys(obj).length === 0
}
/**
* A custom `HumanizeDuration` humanizer that is more terse.
* @return {Function}
* @see https://www.npmjs.com/package/humanize-duration#humanizers
*/
export const humanize = HumanizeDuration.humanizer({
language: 'short',
delimiter: ' ',
spacer: '',
languages: {
short: {
y: () => 'y',
mo: () => 'mo',
w: () => 'w',
d: () => 'd',
h: () => 'h',
m: () => 'm',
s: () => 's',
ms: () => 'ms'
}
}
})