My First Playground

node v12.22.12
version: 1.0.0
endpointsharetweet
This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
const Yup = require("yup"); const schema = Yup.string().transform(value => { const upper = value.toUpperCase(); const lower = value.toLowerCase(); if (value === upper) value = value.toLowerCase(); else if (value === lower) value = value.toUpperCase(); return value; }) const values = ['borris', 'JOHN', 'Mary']; const transformed = values.map(value => schema.cast(value)); values.forEach((value, i) => console.log(`${value} => ${transformed[i]}`))
Loading…

no comments

    sign in to comment