Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fauna-labs/fql-utilities

Package Overview
Dependencies
Maintainers
4
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fauna-labs/fql-utilities

A library of FQL utilities for Fauna Schema Migrate, implemented in TypeScript.

  • 0.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

This repository contains unofficial patterns, sample code, or tools to help developers build more effectively with Fauna. All Fauna Labs repositories are provided “as-is” and without support. By using this repository or its contents, you agree that this repository may never be officially supported and moved to the Fauna organization.


FQL utilities

This repo contains code for user-defined functions (UDFs) to accomplish common tasks in Fauna. These UDFs are designed to be deployed with Fauna Schema Migrate.

How to use

  • npm init -y
  • npm install faunadb
  • npm install --save-dev @fauna-labs/faunadb-schema-migrate
  • npm install --save-dev @fauna-labs/fql-utilities
  • npx fauna-schema-migrate init
  • Create a file named tail.js in the fauna/resources directory with the following code:
    import { Tail } from '@fauna-labs/fql-utilities';
    
    export default Tail();
    
  • npx fauna-schema-migrate generate
  • npx fauna-schema-migrate apply

This creates a UDF named Tail() in your database. Tail() accepts one parameter, an Array, and returns a new array consisting of every element except the first. If the array is empty, Tail() returns an empty array.

You can then call the Tail UDF with the following code:

Let(
  {
    array: [0, 1, 2],
    shortArray: Call("Tail", Var("array"))
  },
  Equals(Count(Var("shortArray")), 2) // true
)

Included packages

Collections

Vector math

Keywords

FAQs

Package last updated on 10 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc