Socket
Socket
Sign inDemoInstall

reddit-ts

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reddit-ts - npm Package Compare versions

Comparing version 0.7.2 to 1.0.0

2

dist/package.json
{
"name": "reddit-ts",
"version": "0.7.2",
"version": "1.0.0",
"description": "Reddit API written in Typescript",

@@ -5,0 +5,0 @@ "author": "aelesia",

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Post_type_1 = require("./types/Post.type");
var commons_1 = require("@aelesia/commons");

@@ -12,3 +11,3 @@ var Errors_1 = require("@aelesia/commons/dist/src/misc/Errors");

date: commons_1.DateUtil.to_date(it.data.created_utc),
kind: Post_type_1.Kind.Comment,
kind: 't1',
subreddit: it.data.subreddit,

@@ -28,3 +27,3 @@ parent_id: it.data.parent_id,

date: commons_1.DateUtil.to_date(it.data.created_utc),
kind: Post_type_1.Kind.Thread,
kind: 't3',
subreddit: it.data.subreddit,

@@ -38,6 +37,6 @@ thread_id: it.data.name,

function map_search(it) {
if (it.kind === Post_type_1.Kind.Comment) {
if (it.kind === 't1') {
return map_t1(it);
}
else if (it.kind === Post_type_1.Kind.Thread) {
else if (it.kind === 't3') {
return map_t3(it);

@@ -44,0 +43,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Kind;
(function (Kind) {
Kind["Thread"] = "t3";
Kind["Comment"] = "t1";
})(Kind = exports.Kind || (exports.Kind = {}));
//# sourceMappingURL=Post.type.js.map

@@ -50,3 +50,2 @@ "use strict";

var RedditAPI_1 = __importDefault(require("../src/RedditAPI"));
var Post_type_1 = require("../src/types/Post.type");
var commons_1 = require("@aelesia/commons");

@@ -85,3 +84,3 @@ var pkg = __importStar(require("../package.json"));

results.forEach(function (r) {
expect(r.kind).toEqual(Post_type_1.Kind.Comment);
expect(r.kind).toEqual('t1');
expect(r.date).not.toBeNull();

@@ -113,3 +112,3 @@ expect(r.date).toBeInstanceOf(Date);

results.forEach(function (r) {
expect(r.kind).toEqual(Post_type_1.Kind.Thread);
expect(r.kind).toEqual('t3');
expect(r.date).not.toBeNull();

@@ -146,6 +145,10 @@ expect(r.date).toBeInstanceOf(Date);

test('Reply', function () { return __awaiter(void 0, void 0, void 0, function () {
var results;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, Reddit.reply('t3_eaiqlw', "[Jest Test Reply " + new Date().toLocaleString() + "] " + USER_AGENT)];
case 0: return [4, Reddit.threads('testingground4bots')];
case 1:
results = _a.sent();
return [4, Reddit.reply(results[0].id, "[Jest Test Reply " + new Date().toLocaleString() + "] " + USER_AGENT)];
case 2:
_a.sent();

@@ -152,0 +155,0 @@ return [2];

{
"name": "reddit-ts",
"version": "0.7.2",
"version": "1.0.0",
"description": "Reddit API written in Typescript",

@@ -5,0 +5,0 @@ "author": "aelesia",

import { Comment } from './types/Comments.type'
import { Kind, Post } from './types/Post.type'
import { Post } from './types/Post.type'
import { Thread } from './types/Threads.type'

@@ -14,3 +14,3 @@ import { Child } from './types/Search.type'

date: _.to_date(it.data.created_utc),
kind: Kind.Comment,
kind: 't1',
subreddit: it.data.subreddit,

@@ -33,3 +33,3 @@ parent_id: it.data.parent_id,

date: _.to_date(it.data.created_utc),
kind: Kind.Thread,
kind: 't3',
subreddit: it.data.subreddit,

@@ -43,5 +43,5 @@ thread_id: it.data.name,

export function map_search(it: Child): Post {
if (it.kind === Kind.Comment) {
if (it.kind === 't1') {
return map_t1(it as any)
} else if (it.kind === Kind.Thread) {
} else if (it.kind === 't3') {
return map_t3(it as any)

@@ -48,0 +48,0 @@ } else {

@@ -1,8 +0,3 @@

export enum Kind {
Thread = 't3',
Comment = 't1'
}
export type Post = {
kind: Kind
kind: 't1' | 't3'
id: string

@@ -9,0 +4,0 @@ url: string

import RedditAPI from '../src/RedditAPI'
import { Kind, Post } from '../src/types/Post.type'
import { Post } from '../src/types/Post.type'
import { DateUtil as _, StringUtil as S } from '@aelesia/commons'

@@ -36,3 +36,3 @@ import * as pkg from '../package.json'

results.forEach(r => {
expect(r.kind).toEqual(Kind.Comment)
expect(r.kind).toEqual('t1')
expect(r.date).not.toBeNull()

@@ -58,3 +58,3 @@ expect(r.date).toBeInstanceOf(Date)

results.forEach(r => {
expect(r.kind).toEqual(Kind.Thread)
expect(r.kind).toEqual('t3')
expect(r.date).not.toBeNull()

@@ -82,3 +82,4 @@ expect(r.date).toBeInstanceOf(Date)

test('Reply', async () => {
await Reddit.reply('t3_eaiqlw', `[Jest Test Reply ${new Date().toLocaleString()}] ${USER_AGENT}`)
const results = await Reddit.threads('testingground4bots')
await Reddit.reply(results[0].id, `[Jest Test Reply ${new Date().toLocaleString()}] ${USER_AGENT}`)
})

@@ -85,0 +86,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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