Skip to content

Latest commit

 

History

History
109 lines (73 loc) · 2.99 KB

API.md

File metadata and controls

109 lines (73 loc) · 2.99 KB

API

minimizer

function minimize()

source      since v0.1.0

Minimizes the rules contained at the given filePath.
If given an output this method will output the result to the given
file path instead of returning a minimize string.

Params

context: Context -

options: {
filePath: String,
output: String
}}
-

Returns

String | Null -

Example

const context = setupContext()

// minimze into a string
const minimizedStringRules = await minimize(context, {
  filePath: './path/to/firestore.rules'
})

// minimize and send output to a file
await minimize(context, {
  filePath: './path/to/firestore.rules',
  output: './path/to/firestore.min.rules'
})



lang.util

private function cacheChain()

source      since v0.1.0

This method generates a specific object instance for use in a WeakMap cache.
The object instance is unique based upon the parameters that are passed to
the this method.

The main use of this method is for generating cache keys for memoization and
automatically clearing the cache when a value no longer exists in memory.

When a non immutable object is passed as an argument it will be stored into a
WeakMap as part of a chain. If that object is ever removed from memory all
cache chains connected to the object will automatically be removed from the cache.

Params

args: ...* - The arguments to generate a cache key for

Returns

Object - The cache key

Example



private function functionDefineLength()

source      since v0.1.0

Defines length for the given func

Note: This mutates func

Params

func: Function - The function to define the length of.

length: Number - The length of the function parameters.

Returns

Function - The func function.

Example

const result = functionDefineLength(function (abc) {}, 2)
result.length
//=> 2