The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Revised by Bytes Unlimited : Feb 3rd 2020
/** | |
* Filters out null and undefined values from an array. | |
* | |
* @template T - The type of the array elements. | |
* @param {Array<T | null | undefined>} arr - The array to be filtered. | |
* @returns {Array<T>} - A new array with null and undefined values removed. | |
* | |
* @example | |
* const fruits = ['apple', null, 'banana', undefined, 'cherry']; | |
* const validFruits = filterEmpty(fruits); |
import { z } from "zod" | |
const schema = z.object({ | |
file: | |
typeof window === "undefined" // this is required if your app rendered in server side, otherwise just remove the ternary condition | |
? z.undefined() | |
: z | |
.instanceof(FileList) | |
.refine(file => file.length !== 0, { | |
message: "File is required", |
const { default: Schema } = require("@sanity/schema"); | |
const { htmlToBlocks, randomKey } = require("@sanity/block-tools"); | |
const { JSDOM } = require("jsdom"); | |
const schemaBlog = Schema.compile({ | |
name: "myBlog", | |
types: [ | |
{ | |
title: "Hjelpeartikkel", | |
name: "hjelpeartikkel", |
import { rgba } from "polished"; | |
export default { | |
label: [ | |
rgba(0, 0, 0, 1), | |
rgba(60, 60, 67, 0.6), | |
rgba(60, 60, 67, 0.3), | |
rgba(60, 60, 67, 0.18), | |
], | |
fill: [ |
// Add on element with overflow | |
-webkit-mask-image: -webkit-radial-gradient(white, black); |