Java:
String numberString = "1,2,3,4,5";
int[] numbers = Arrays.stream(numberString.split(",")).mapToInt(Integer::parseInt).toArray();
function nil(value) { | |
return value === undefined || value === null | |
} | |
function notNil(value) { | |
return !nil(value) | |
} | |
function empty(value) { | |
if (nil(value)) { |
The point of comparison here is a function that filters some JSON based on on an access property set in a JSON schema. See Haskell vs Clojure for an interesting similar comparison.
The Scala code uses the circe library for Json handling:
The point of comparison here is a simple function that looks up a string key in a nested map/dictionary (JSON data from the payload/claims of a JWT token) and returns the given key if it's there and None/nil otherwise.
Original function:
def verifyPartner(partner: String, payload: Map[String, java.lang.Object]): Either[String, String] = {
export class User { | |
id: string | |
country: string | |
email: string | |
name: string | |
tags: string[] | |
verified: boolean | |
active: boolean | |
locale: string | |
openIds: any |
{ | |
"compilerOptions": { | |
"target": "es5", | |
"module": "commonjs", | |
"moduleResolution": "node", | |
"sourceMap": true, | |
"emitDecoratorMetadata": true, | |
"experimentalDecorators": true, | |
"lib": [ "es2015", "dom" ], | |
"noImplicitAny": true, |
{ | |
"editor.fontSize": 14, | |
"editor.tabSize": 2, | |
"editor.detectIndentation": false, | |
"editor.insertSpaces": true, | |
"files.trimTrailingWhitespace": true, | |
"files.exclude": { | |
"**/.git": true, | |
"**/.svn": true, | |
"**/.hg": true, |
const R = require('ramda') | |
function pathString(path: string[]): string { | |
return path.join('.') | |
} | |
function valueType(value: any): string { | |
if (value === undefined) { | |
return 'undefined' | |
} else if (value === null) { |