Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pondjs

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pondjs - npm Package Compare versions

Comparing version 1.0.0-alpha.8 to 1.0.0-alpha.9

28

lib/rate.d.ts

@@ -38,16 +38,16 @@ /**

export declare class Rate<T extends Key> extends Processor<T, TimeRange> {
private _fieldSpec;
private _allowNegative;
private _previous;
constructor(options: RateOptions);
/**
* Generate a new `TimeRangeEvent` containing the rate per second
* between two events.
*/
getRate(event: any): Event<TimeRange>;
/**
* Perform the rate operation on the `Event` and the the `_previous`
* `Event` and emit the result.
*/
addEvent(event: Event<T>): Immutable.List<Event<TimeRange>>;
private _fieldSpec;
private _allowNegative;
private _previous;
constructor(options: RateOptions);
/**
* Perform the rate operation on the `Event` and the the `_previous`
* `Event` and emit the result.
*/
addEvent(event: Event<T>): Immutable.List<Event<TimeRange>>;
/**
* Generate a new `TimeRangeEvent` containing the rate per second
* between two events.
*/
private getRate;
}

@@ -40,63 +40,69 @@ "use strict";

class Rate extends processor_1.Processor {
constructor(options) {
super();
const { fieldSpec, allowNegative = false } = options;
// Options
this._fieldSpec = _.isString(fieldSpec) ? [fieldSpec] : fieldSpec;
this._allowNegative = allowNegative;
// Previous event
this._previous = null;
constructor(options) {
super();
const { fieldSpec, allowNegative = false } = options;
// Options
this._fieldSpec = _.isString(fieldSpec) ? [fieldSpec] : fieldSpec;
this._allowNegative = allowNegative;
// Previous event
this._previous = null;
}
/**
* Perform the rate operation on the `Event` and the the `_previous`
* `Event` and emit the result.
*/
addEvent(event) {
const eventList = new Array();
if (!this._previous) {
this._previous = event;
return Immutable.List();
}
/**
* Generate a new `TimeRangeEvent` containing the rate per second
* between two events.
*/
getRate(event) {
let d = Immutable.Map();
const previousTime = this._previous.timestamp().getTime();
const currentTime = event.timestamp().getTime();
const deltaTime = (currentTime - previousTime) / 1000;
this._fieldSpec.forEach(path => {
const fieldPath = util_1.default.fieldAsArray(path);
const ratePath = fieldPath.slice();
ratePath[ratePath.length - 1] += "_rate";
const previousVal = this._previous.get(fieldPath);
const currentVal = event.get(fieldPath);
let rate = null;
if (!_.isNumber(previousVal) || !_.isNumber(currentVal)) {
// tslint:disable-next-line
console.warn(`Path ${fieldPath} contains a non-numeric value or does not exist`);
}
else {
rate = (currentVal - previousVal) / deltaTime;
}
if (this._allowNegative === false && rate < 0) {
// don't allow negative differentials in certain cases
d = d.setIn(ratePath, null);
}
else {
d = d.setIn(ratePath, rate);
}
});
return new event_1.Event(timerange_1.timerange(previousTime, currentTime), d);
const rate = this.getRate(event);
if (rate) {
eventList.push(rate);
}
/**
* Perform the rate operation on the `Event` and the the `_previous`
* `Event` and emit the result.
*/
addEvent(event) {
const eventList = new Array();
if (!this._previous) {
this._previous = event;
return Immutable.List();
}
const rate = this.getRate(event);
if (rate) {
eventList.push(rate);
}
this._previous = event;
return Immutable.List(eventList);
}
this._previous = event;
return Immutable.List(eventList);
}
/**
* Generate a new `TimeRangeEvent` containing the rate per second
* between two events.
*/
getRate(event) {
let d = Immutable.Map();
const previousTime = this._previous.timestamp().getTime();
const currentTime = event.timestamp().getTime();
const deltaTime = (currentTime - previousTime) / 1000;
this._fieldSpec.forEach(path => {
const fieldPath = util_1.default.fieldAsArray(path);
const ratePath = fieldPath.slice();
ratePath[ratePath.length - 1] += "_rate";
const previousVal = this._previous.get(fieldPath);
const currentVal = event.get(fieldPath);
let rate = null;
if (_.isNumber(currentVal) && _.isNumber(previousVal)) {
// Calculate the rate
rate = (currentVal - previousVal) / deltaTime;
} else if (
(previousVal !== null && !_.isNumber(previousVal)) ||
(currentVal !== null && !_.isNumber(currentVal))
) {
// Only issue warning if the current or previous values are bad
// i.e. not a number or not null (null values result in null output)
console.warn(
`Event field "${fieldPath}" is a non-numeric or non-null value`
);
}
d =
this._allowNegative === false && rate < 0
? (d = d.setIn(ratePath, null)) // don't allow negative differentials in certain cases
: (d = d.setIn(ratePath, rate));
});
return new event_1.Event(
timerange_1.timerange(previousTime, currentTime),
d
);
}
}
exports.Rate = Rate;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmF0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9yYXRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7R0FRRzs7QUFFSCx1Q0FBdUM7QUFDdkMsNEJBQTRCO0FBRTVCLG1DQUFnQztBQUVoQywyQ0FBd0M7QUFDeEMsMkNBQW1EO0FBQ25ELGlDQUEwQjtBQUkxQjs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0FvQkc7QUFDSCxNQUFhLElBQW9CLFNBQVEscUJBQXVCO0lBTzVELFlBQVksT0FBb0I7UUFDNUIsS0FBSyxFQUFFLENBQUM7UUFDUixNQUFNLEVBQUUsU0FBUyxFQUFFLGFBQWEsR0FBRyxLQUFLLEVBQUUsR0FBRyxPQUFPLENBQUM7UUFFckQsVUFBVTtRQUNWLElBQUksQ0FBQyxVQUFVLEdBQUcsQ0FBQyxDQUFDLFFBQVEsQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDLENBQUMsU0FBUyxDQUFDO1FBQ2xFLElBQUksQ0FBQyxjQUFjLEdBQUcsYUFBYSxDQUFDO1FBRXBDLGlCQUFpQjtRQUNqQixJQUFJLENBQUMsU0FBUyxHQUFHLElBQUksQ0FBQztJQUMxQixDQUFDO0lBRUQ7OztPQUdHO0lBQ0gsT0FBTyxDQUFDLEtBQUs7UUFDVCxJQUFJLENBQUMsR0FBRyxTQUFTLENBQUMsR0FBRyxFQUFlLENBQUM7UUFFckMsTUFBTSxZQUFZLEdBQUcsSUFBSSxDQUFDLFNBQVMsQ0FBQyxTQUFTLEVBQUUsQ0FB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ructor(arg1, arg2) {
super();
if (arg1 instanceof TimeRange) {
const other = arg1;
this._range = other._range;
}
else if (arg1 instanceof Immutable.List) {
const rangeList = arg1;
this._range = rangeList;
}
else if (arg1 instanceof Array) {
const rangeArray = arg1;
this._range = Immutable.List([new Date(rangeArray[0]), new Date(rangeArray[1])]);
}
else {
const b = arg1;
const e = arg2;
if (_.isDate(b) && _.isDate(e)) {
this._range = Immutable.List([new Date(b.getTime()), new Date(e.getTime())]);
}
else if (moment.isMoment(b) && moment.isMoment(e)) {
this._range = Immutable.List([new Date(b.valueOf()), new Date(e.valueOf())]);
}
else if (time_1.Time.isTime(b) && time_1.Time.isTime(e)) {
this._range = Immutable.List([new Date(b.valueOf()), new Date(e.valueOf())]);
}
else if (_.isNumber(b) && _.isNumber(e)) {
this._range = Immutable.List([new Date(b), new Date(e)]);
}
}
constructor(arg1, arg2) {
super();
if (arg1 instanceof TimeRange) {
const other = arg1;
this._range = other._range;
} else if (arg1 instanceof Immutable.List) {
const rangeList = arg1;
this._range = rangeList;
} else if (arg1 instanceof Array) {
const rangeArray = arg1;
this._range = Immutable.List([
new Date(rangeArray[0]),
new Date(rangeArray[1])
]);
} else {
const b = arg1;
const e = arg2;
if (_.isDate(b) && _.isDate(e)) {
this._range = Immutable.List([
new Date(b.getTime()),
new Date(e.getTime())
]);
} else if (moment.isMoment(b) && moment.isMoment(e)) {
this._range = Immutable.List([
new Date(b.valueOf()),
new Date(e.valueOf())
]);
} else if (time_1.Time.isTime(b) && time_1.Time.isTime(e)) {
this._range = Immutable.List([
new Date(b.valueOf()),
new Date(e.valueOf())
]);
} else if (_.isNumber(b) && _.isNumber(e)) {
this._range = Immutable.List([new Date(b), new Date(e)]);
}
}
type() {
return "timerange";
}
type() {
return "timerange";
}
/**
* Returns the internal range, which is an `Immutable.List` of two elements
* containing begin and end times as `Date`'s.
*/
internal() {
return this._range;
}
/**
* Returns the `TimeRange` as JSON, which will be a Javascript array
* of two `ms` timestamps.
*/
toJSON() {
return { timerange: [this.begin().getTime(), this.end().getTime()] };
}
/**
* Returns the `TimeRange` as a string, useful for serialization.
*
* @return {string} String representation of the TimeRange
*/
toString() {
return JSON.stringify(this.toJSON());
}
/**
* Returns the `TimeRange` as a string expressed in local time
*/
toLocalString() {
return `[${this.begin()}, ${this.end()}]`;
}
/**
* Returns the `TimeRange` as a string expressed in UTC time
*/
toUTCString() {
return `[${this.begin().toUTCString()}, ${this.end().toUTCString()}]`;
}
/**
* Returns a human friendly version of the `TimeRange`, e.g.
* "Aug 1, 2014 05:19:59 am to Aug 1, 2014 07:41:06 am"
*/
humanize() {
const begin = moment(this.begin());
const end = moment(this.end());
const beginStr = begin.format("MMM D, YYYY hh:mm:ss a");
const endStr = end.format("MMM D, YYYY hh:mm:ss a");
return `${beginStr} to ${endStr}`;
}
/**
* Returns a human friendly version of the `TimeRange`
* @example
* Example: "a few seconds ago to a month ago"
*/
relativeString() {
const begin = moment(this.begin());
const end = moment(this.end());
return `${begin.fromNow()} to ${end.fromNow()}`;
}
/**
* Returns the begin time of the `TimeRange`.
*/
begin() {
return this._range.get(0);
}
/**
* Returns the end time of the `TimeRange`.
*/
end() {
return this._range.get(1);
}
/**
* Returns the midpoint of the `TimeRange`.
*/
mid() {
return new Date((+this.begin() + +this.end()) / 2);
}
/**
* Returns a `Time` that is either at the beginning,
* middle or end of this `TimeRange`. Specify the alignment
* of the output `Time` with the `align` parameter. This is
* either:
* * TimeAlignment.Begin
* * TimeAlignment.Middle
* * TimeAlignment.End
*/
toTime(align) {
switch (align) {
case types_1.TimeAlignment.Begin:
return time_1.time(this.begin());
break;
case types_1.TimeAlignment.Middle:
return time_1.time(this.mid());
break;
case types_1.TimeAlignment.End:
return time_1.time(this.end());
break;
}
/**
* Returns the internal range, which is an `Immutable.List` of two elements
* containing begin and end times as `Date`'s.
*/
internal() {
return this._range;
}
/**
* Returns the midpoint of the `TimeRange` as the representitive
* timestamp for the timerange.
*/
timestamp() {
return this.mid();
}
/**
* Sets a new begin time on the `TimeRange`. The result will be
* a new `TimeRange`.
*/
setBegin(t) {
return new TimeRange(this._range.set(0, t));
}
/**
* Sets a new end time on the `TimeRange`. The result will be
* a new `TimeRange`.
*/
setEnd(t) {
return new TimeRange(this._range.set(1, t));
}
/**
* Returns if the two `TimeRange`'s can be considered equal,
* in that they have the same times.
*/
equals(other) {
return (
this.begin().getTime() === other.begin().getTime() &&
this.end().getTime() === other.end().getTime()
);
}
/**
* Determine if a `Date` or a `TimeRange` is contained entirely
* within this `TimeRange`
*/
contains(other) {
if (_.isDate(other)) {
return this.begin() <= other && this.end() >= other;
} else {
return this.begin() <= other.begin() && this.end() >= other.end();
}
/**
* Returns the `TimeRange` as JSON, which will be a Javascript array
* of two `ms` timestamps.
*/
toJSON() {
return { timerange: [this.begin().getTime(), this.end().getTime()] };
}
/**
* Returns true if this `TimeRange` is completely within the supplied
* other `TimeRange`.
*/
within(other) {
return this.begin() >= other.begin() && this.end() <= other.end();
}
/**
* Returns true if the passed in other `TimeRange` overlaps
* this `TimeRange`.
*/
overlaps(other) {
if (
(this.contains(other.begin()) && !this.contains(other.end())) ||
(this.contains(other.end()) && !this.contains(other.begin()))
) {
return true;
} else {
return false;
}
/**
* Returns the `TimeRange` as a string, useful for serialization.
*
* @return {string} String representation of the TimeRange
*/
toString() {
return JSON.stringify(this.toJSON());
}
/**
* Returns true if the passed in other `TimeRange` in no way
* overlaps this `TimeRange`.
*/
disjoint(other) {
return this.end() < other.begin() || this.begin() > other.end();
}
/**
* Returns a new `Timerange` which covers the extents of this and
* other combined.
*/
extents(other) {
const b = this.begin() < other.begin() ? this.begin() : other.begin();
const e = this.end() > other.end() ? this.end() : other.end();
return new TimeRange(new Date(b.getTime()), new Date(e.getTime()));
}
/**
* Returns a new `TimeRange` which represents the intersection
* (overlapping) part of this and other.
*/
intersection(other) {
if (this.disjoint(other)) {
return;
}
/**
* Returns the `TimeRange` as a string expressed in local time
*/
toLocalString() {
return `[${this.begin()}, ${this.end()}]`;
}
/**
* Returns the `TimeRange` as a string expressed in UTC time
*/
toUTCString() {
return `[${this.begin().toUTCString()}, ${this.end().toUTCString()}]`;
}
/**
* Returns a human friendly version of the `TimeRange`, e.g.
* "Aug 1, 2014 05:19:59 am to Aug 1, 2014 07:41:06 am"
*/
humanize() {
const begin = moment(this.begin());
const end = moment(this.end());
const beginStr = begin.format("MMM D, YYYY hh:mm:ss a");
const endStr = end.format("MMM D, YYYY hh:mm:ss a");
return `${beginStr} to ${endStr}`;
}
/**
* Returns a human friendly version of the `TimeRange`
* @example
* Example: "a few seconds ago to a month ago"
*/
relativeString() {
const begin = moment(this.begin());
const end = moment(this.end());
return `${begin.fromNow()} to ${end.fromNow()}`;
}
/**
* Returns the begin time of the `TimeRange`.
*/
begin() {
return this._range.get(0);
}
/**
* Returns the end time of the `TimeRange`.
*/
end() {
return this._range.get(1);
}
/**
* Returns the midpoint of the `TimeRange`.
*/
mid() {
return new Date((+this.begin() + +this.end()) / 2);
}
/**
* Returns a `Time` that is either at the beginning,
* middle or end of this `TimeRange`. Specify the alignment
* of the output `Time` with the `align` parameter. This is
* either:
* * TimeAlignment.Begin
* * TimeAlignment.Middle
* * TimeAlignment.End
*/
toTime(align) {
switch (align) {
case types_1.TimeAlignment.Begin:
return time_1.time(this.begin());
break;
case types_1.TimeAlignment.Middle:
return time_1.time(this.mid());
break;
case types_1.TimeAlignment.End:
return time_1.time(this.end());
break;
}
}
/**
* Returns the midpoint of the `TimeRange` as the representitive
* timestamp for the timerange.
*/
timestamp() {
return this.mid();
}
/**
* Sets a new begin time on the `TimeRange`. The result will be
* a new `TimeRange`.
*/
setBegin(t) {
return new TimeRange(this._range.set(0, t));
}
/**
* Sets a new end time on the `TimeRange`. The result will be
* a new `TimeRange`.
*/
setEnd(t) {
return new TimeRange(this._range.set(1, t));
}
/**
* Returns if the two `TimeRange`'s can be considered equal,
* in that they have the same times.
*/
equals(other) {
return (this.begin().getTime() === other.begin().getTime() &&
this.end().getTime() === other.end().getTime());
}
/**
* Determine if a `Date` or a `TimeRange` is contained entirely
* within this `TimeRange`
*/
contains(other) {
if (_.isDate(other)) {
return this.begin() <= other && this.end() >= other;
}
else {
return this.begin() <= other.begin() && this.end() >= other.end();
}
}
/**
* Returns true if this `TimeRange` is completely within the supplied
* other `TimeRange`.
*/
within(other) {
return this.begin() >= other.begin() && this.end() <= other.end();
}
/**
* Returns true if the passed in other `TimeRange` overlaps
* this `TimeRange`.
*/
overlaps(other) {
if ((this.contains(other.begin()) && !this.contains(other.end())) ||
(this.contains(other.end()) && !this.contains(other.begin()))) {
return true;
}
else {
return false;
}
}
/**
* Returns true if the passed in other `TimeRange` in no way
* overlaps this `TimeRange`.
*/
disjoint(other) {
return this.end() < other.begin() || this.begin() > other.end();
}
/**
* Returns a new `Timerange` which covers the extents of this and
* other combined.
*/
extents(other) {
const b = this.begin() < other.begin() ? this.begin() : other.begin();
const e = this.end() > other.end() ? this.end() : other.end();
return new TimeRange(new Date(b.getTime()), new Date(e.getTime()));
}
/**
* Returns a new `TimeRange` which represents the intersection
* (overlapping) part of this and other.
*/
intersection(other) {
if (this.disjoint(other)) {
return;
}
const b = this.begin() > other.begin() ? this.begin() : other.begin();
const e = this.end() < other.end() ? this.end() : other.end();
return new TimeRange(new Date(b.getTime()), new Date(e.getTime()));
}
/**
* Returns the duration of the `TimeRange` in milliseconds
*/
duration() {
return this.end().getTime() - this.begin().getTime();
}
/**
* A user friendly version of the duration.
*/
humanizeDuration() {
return moment.duration(this.duration()).humanize();
}
const b = this.begin() > other.begin() ? this.begin() : other.begin();
const e = this.end() < other.end() ? this.end() : other.end();
return new TimeRange(new Date(b.getTime()), new Date(e.getTime()));
}
/**
* Returns the duration of the `TimeRange` in milliseconds
*/
duration() {
return this.end().getTime() - this.begin().getTime();
}
/**
* A user friendly version of the duration.
*/
humanizeDuration() {
return moment.duration(this.duration()).humanize();
}
}
exports.TimeRange = TimeRange;
function timerange(arg1, arg2) {
return new TimeRange(arg1, arg2);
return new TimeRange(arg1, arg2);
}
exports.timerange =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EVBQUUsQ0FBQztJQUN6RCxDQUFDO0lBRUQ7O09BRUc7SUFDSCxnQkFBZ0I7UUFDWixPQUFPLE1BQU0sQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUMsUUFBUSxFQUFFLENBQUM7SUFDdkQsQ0FBQztDQUNKO0FBN1FELDhCQTZRQztBQVdELFNBQVMsU0FBUyxDQUFDLElBQVMsRUFBRSxJQUFVO0lBQ3BDLE9BQU8sSUFBSSxTQUFTLENBQUMsSUFBSSxFQUFFLElBQUksQ0FBQyxDQUFDO0FBQ3JDLENBQUM7QUFFUSw4QkFBUyJ9
{
"name": "pondjs",
"version": "1.0.0-alpha.8",
"version": "1.0.0-alpha.9",
"description": "A TimeSeries library built on Immutable.js with Typescript",

@@ -10,16 +10,17 @@ "main": "lib/exports.js",

"dependencies": {
"immutable": "^4.0.0-rc.9",
"lodash": "^4.17.4",
"moment": "^2.18.1",
"moment-timezone": "^0.5.13"
"immutable": "^4.0.0-rc.12",
"lodash": "^4.17.11",
"moment": "^2.24.0",
"moment-timezone": "^0.5.25"
},
"devDependencies": {
"@types/lodash": "^4.14.71",
"jest": "^21.2.1 ",
"jest-cli": "^21.2.1",
"prettier": "^1.9.1",
"ts-jest": "^21.2.4",
"tslint": "^5.5.0",
"typedoc": "^0.9.0",
"typescript": "^2.5.3"
"@types/lodash": "^4.14.123",
"jest": "^24.7.1",
"jest-cli": "^24.7.1",
"prettier": "^1.17.0",
"ts-jest": "^24.0.2",
"tslint": "^5.16.0",
"tslint-config-prettier": "^1.18.0",
"typedoc": "^0.14.2",
"typescript": "^3.4.5"
},

@@ -26,0 +27,0 @@ "scripts": {

@@ -108,1 +108,18 @@ declare const it: any;

});
it("can output a null rate when data has nulls", () => {
const INPUT = [[0, 10], [30000, 40], [60000, null], [90000, 100], [120000, 130]];
const list = INPUT.map(e => {
return event(time(e[0]), Immutable.Map({ in: e[1] }));
});
const c = sortedCollection(Immutable.List(list));
const rates = c.rate({ fieldSpec: "in" });
expect(rates.size()).toEqual(list.length - 1);
expect(rates.at(0).get("in_rate")).toEqual(1);
expect(rates.at(1).get("in_rate")).toEqual(null);
expect(rates.at(2).get("in_rate")).toEqual(null);
expect(rates.at(3).get("in_rate")).toEqual(1);
});

@@ -21,4 +21,3 @@ /**

import { duration } from "../src/duration";
import { event } from "../src/event";
import { indexedEvent, timeEvent, timeRangeEvent } from "../src/event";
import { event, indexedEvent, timeEvent, timeRangeEvent } from "../src/event";
import { avg, max, sum } from "../src/functions";

@@ -28,4 +27,9 @@ import { index, Index } from "../src/index";

import { timerange } from "../src/timerange";
import { TimeSeries, TimeSeriesWireFormat } from "../src/timeseries";
import { indexedSeries, timeRangeSeries, timeSeries } from "../src/timeseries";
import {
indexedSeries,
timeRangeSeries,
TimeSeries,
timeSeries,
TimeSeriesWireFormat
} from "../src/timeseries";
import { TimeAlignment } from "../src/types";

@@ -458,3 +462,6 @@ import { window } from "../src/window";

events.push(timeEvent(time(new Date(2015, 8, 1)), Immutable.Map({ value: 14 })));
const series = new TimeSeries({ name: "events", events: Immutable.List(events) });
const series = new TimeSeries({
name: "events",
events: Immutable.List(events)
});
expect(series.size()).toBe(2);

@@ -492,3 +499,6 @@ });

const events = [];
const series = new TimeSeries({ name: "events", events: Immutable.List(events) });
const series = new TimeSeries({
name: "events",
events: Immutable.List(events)
});
expect(series.size()).toBe(0);

@@ -631,3 +641,6 @@ });

);
const series = new TimeSeries({ name: "Map traffic", events: Immutable.List(events) });
const series = new TimeSeries({
name: "Map traffic",
events: Immutable.List(events)
});
expect(series.at(0).get("NASA_north").in).toBe(100);

@@ -634,0 +647,0 @@ expect(series.at(3).get("NASA_south").out).toBe(175);

{
"extends": "tslint:recommended",
"rules": {
"max-line-length": [
true,
100
],
"member-access": false,
"variable-name": [
true,
"ban-keywords",
"check-format",
"allow-leading-underscore"
],
"object-literal-sort-keys": false,
"no-require-imports": false,
"interface-name": [
true,
"never-prefix"
],
"arrow-parens": [
true,
"ban-single-arg-parens"
],
"trailing-comma": [
false,
{
"multiline": "never",
"singleline": "never"
}
],
"semicolon": [
false
]
}
}
"defaultSeverity": "error",
"extends": ["tslint:latest", "tslint-config-prettier"],
"jsRules": {},
"rules": {
"no-console": false,
"interface-name": false,
"no-submodule-imports": false,
"no-object-literal-type-assertion": false,
"object-literal-sort-keys": false
},
"rulesDirectory": []
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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