CEL expressions for mapping fields from input objects to output fields.
- Go: github.com/google/cel-go --
go get github.com/google/cel-go - Spec: cel-spec/langdef.md
CEL expressions for mapping fields from input objects to output fields.
go get github.com/google/cel-go| #!/bin/bash | |
| # Author: Joel Nothman | |
| usage() { | |
| echo Usage: $0 '[-m <commit msg>] <base>' | |
| exit 1 | |
| } | |
| unset base | |
| unset message |
| import React from "react"; | |
| import Todo from "./Todo"; | |
| import useTodosLoading from "./useTodosLoading"; | |
| import React from "react"; | |
| const Loader = ({ isLoading, errorMessage, children }) => { | |
| if (errorMessage) return <Error errrorMessage={errorMessage} />; | |
| if (isLoading) return <Loading />; | |
| return children; | |
| }; |
| import * as t from 'io-ts'; | |
| import { PathReporter } from 'io-ts/lib/PathReporter'; | |
| import * as tPromise from 'io-ts-promise'; | |
| // [io-ts][https://github.com/gcanti/io-ts](https://github.com/gcanti/io-ts) | |
| // [Take control of unexpected data at runtime with TypeScript](https://blog.logrocket.com/using-typescript-to-stop-unexpected-data-from-breaking-your-app/) | |
| const fetchProduct = () => { | |
| return Promise.resolve({ | |
| id: '123', |
| import React, { Component } from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import { iconYouAreHere, iconPin } from 'icons'; | |
| import styles from './styles.css'; | |
| const loadScript = src => { | |
| const ref = global.document.getElementsByTagName('script')[0]; | |
| const script = global.document.createElement('script'); | |
| script.src = src; |
| /** | |
| * Use multiple filters on an array of object | |
| * @param {Object[]} arr - the array to filter | |
| * example: | |
| * [ | |
| * {fruit: 'apple', count: 1, id: 123}, | |
| * {fruit: 'pear', count: 4, id: 234}, | |
| * {fruit: 'orange', count: 4, id: 456} | |
| * ] | |
| * @param {Object.<Array>} filters - an object with the filter criteria as the property names |
| const timer = asyncify(() => { | |
| promiseTimeout(1000) // pseudo-code | |
| promiseTimeout(2000) | |
| promiseTimeout(3000) | |
| }) |
| setTimeout(() => console.log('hi'), 1000) | |
| setTimeout(() => console.log('hi'), 2000) | |
| setTimeout(() => console.log('hi'), 3000) |
| const timer = asyncify(function* () { | |
| yield promiseTimeout(1000) | |
| yield promiseTimeout(2000) | |
| yield promiseTimeout(3000) | |
| }) |
| const timer = async() => { | |
| await promiseTimeout(1000) | |
| await promiseTimeout(2000) | |
| await promiseTimeout(3000) | |
| } |