twitter-openapi-typescript
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -6,5 +6,13 @@ "use strict"; | ||
var instructionToEntry = function (item) { | ||
return item | ||
.map(function (e) { return (e.type == i.InstructionType.TimelineAddEntries ? e : null); }) | ||
.find(function (e) { return e; }).entries; | ||
return item.flatMap(function (e) { | ||
if (e.type == i.InstructionType.TimelineAddEntries) { | ||
return e.entries; | ||
} | ||
else if (e.type == i.InstructionType.TimelineReplaceEntry) { | ||
return [e.entry]; | ||
} | ||
else { | ||
return null; | ||
} | ||
}); | ||
}; | ||
@@ -11,0 +19,0 @@ exports.instructionToEntry = instructionToEntry; |
{ | ||
"name": "twitter-openapi-typescript", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "Implementation of Twitter internal API in TypeScript", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -5,5 +5,11 @@ import * as i from 'twitter-openapi-typescript-generated'; | ||
export const instructionToEntry = (item: i.InstructionUnion[]): i.TimelineAddEntry[] => { | ||
return item | ||
.map((e) => (e.type == i.InstructionType.TimelineAddEntries ? (e as i.TimelineAddEntries) : null)) | ||
.find((e) => e).entries; | ||
return item.flatMap((e) => { | ||
if (e.type == i.InstructionType.TimelineAddEntries) { | ||
return (e as i.TimelineAddEntries).entries; | ||
} else if (e.type == i.InstructionType.TimelineReplaceEntry) { | ||
return [(e as i.TimelineReplaceEntry).entry]; | ||
} else { | ||
return null; | ||
} | ||
}); | ||
}; | ||
@@ -10,0 +16,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
252464
3606