Skip to content

Commit

Permalink
0.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
nberlette committed Aug 19, 2022
1 parent ea6b505 commit 5804d93
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 84 deletions.
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Opinionated collection of utilities and helpers, assembled with Deno in mind.

```ts
import * as _ from "https://deno.land/x/911@0.1.3/mod.ts";
import * as _ from "https://deno.land/x/911@0.1.4/mod.ts";
```

```tree
Expand Down Expand Up @@ -556,7 +556,7 @@ function defaultNotFoundPage(): Response;
* can disable caching by setting `cache: false` in the options object.
*
* @example ```ts
* import { serve, serveStatic } from "https://deno.land/x/911@0.1.3/src/http.ts"
* import { serve, serveStatic } from "https://deno.land/x/911@0.1.4/src/http.ts"
*
* serve({
* // It is required that the path ends with `:filename+`
Expand Down Expand Up @@ -981,20 +981,20 @@ All rights reserved.
> _Apologies to any contributors not included here - email me to have these
> credits amended with your license/copyright info. Thank you!_

[docs-cache]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/cache.ts
[docs-http]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/http.ts
[docs-hash]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/hash.ts
[docs-collection]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/collection.ts
[docs-fmt]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/fmt.ts
[docs-json]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/json.ts
[docs-log]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/log.ts
[docs-math]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/math.ts
[docs-date]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/date.ts
[docs-memoize]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/memoize.ts
[docs-serialize-map]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/serialize_map.ts
[docs-serialize-set]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/serialize_set.ts
[docs-params]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/params.ts
[docs-promises]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/promises.ts
[docs-state]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/state.ts
[docs-throttle]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/throttle.ts
[docs-type]: https://doc.deno.land/https://deno.land/x/911@0.1.3/src/type.ts
[docs-cache]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/cache.ts
[docs-http]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/http.ts
[docs-hash]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/hash.ts
[docs-collection]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/collection.ts
[docs-fmt]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/fmt.ts
[docs-json]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/json.ts
[docs-log]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/log.ts
[docs-math]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/math.ts
[docs-date]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/date.ts
[docs-memoize]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/memoize.ts
[docs-serialize-map]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/serialize_map.ts
[docs-serialize-set]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/serialize_set.ts
[docs-params]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/params.ts
[docs-promises]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/promises.ts
[docs-state]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/state.ts
[docs-throttle]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/throttle.ts
[docs-type]: https://doc.deno.land/https://deno.land/x/911@0.1.4/src/type.ts
62 changes: 31 additions & 31 deletions src/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function toArray<T>(array?: Nullable<Arrayable<T>>): Array<T> {
/**
* Convert `Arrayable<T>`, `Iterable<T>`, etc. to a normalized `Array<T>`.
* @example ```ts
* import { toArray } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { toArray } from "https://deno.land/x/911@0.1.4/src/collection.ts";
*
* toArray([1, 2, 3]); // [1, 2, 3]
* toArray(new Set([1, 2, 3])); // [1, 2, 3]
Expand All @@ -45,7 +45,7 @@ export function ensureArray<T>(
* Convert `Arrayable<T>` to `Array<T>` and flatten it
* @category Collection
* @example ```ts
* import { flatten } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { flatten } from "https://deno.land/x/911@0.1.4/src/collection.ts";
*
* flatten([1, 2, 3]); // [1, 2, 3]
* flatten([[1, 2], [3, 4]]); // [1, 2, 3, 4]
Expand All @@ -62,7 +62,7 @@ export { flatten as flattenArrayable };
* Use rest arguments to merge arrays
* @category Collection
* @example ```ts
* import { merge } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { merge } from "https://deno.land/x/911@0.1.4/src/collection.ts";
*
* merge([1, 2, 3], [4, 5, 6]); // [1, 2, 3, 4, 5, 6]
* ```
Expand Down Expand Up @@ -148,7 +148,7 @@ export type PartitionFilter<T> = (i: T, idx: number, arr: readonly T[]) => any;
* Divide an array into two parts by a filter function
* @category Collection
* @example ```ts
* import { partition } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { partition } from "https://deno.land/x/911@0.1.4/src/collection.ts";
*
* partition([1, 2, 3, 4], i => i % 2 != 0); // [[1, 3], [2, 4]]
* ```
Expand Down Expand Up @@ -222,7 +222,7 @@ export function partition<T>(
* Example:
*
* ```ts
* import { partitionBy } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { partitionBy } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import { assertEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
*
* const numbers = [ 5, 6, 7, 8, 9 ]
Expand Down Expand Up @@ -311,7 +311,7 @@ export function at<T>(array: readonly T[] | [], index: number): T | undefined {
* Generate a range array of numbers. The `stop` is exclusive.
* @category Collection
* @example ```ts
* import { range } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { range } from "https://deno.land/x/911@0.1.4/src/collection.ts";
*
* range(0, 5); // [0, 1, 2, 3, 4]
* range(0, 5, 2); // [0, 2, 4]
Expand Down Expand Up @@ -348,7 +348,7 @@ export function range(...args: any): number[] {
* @param from Index to move from
* @param to Index to move to
* @example ```ts
* import { move } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { move } from "https://deno.land/x/911@0.1.4/src/collection.ts";
*
* move([1, 2, 3, 4], 1, 3); // [1, 3, 2, 4]
* ```
Expand All @@ -364,7 +364,7 @@ export function move<T>(arr: T[], from: number, to: number): T[] {
* @param arr Array to clamp to
* @param n Number to clamp
* @example ```ts
* import { clampArrayRange } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { clampArrayRange } from "https://deno.land/x/911@0.1.4/src/collection.ts";
*
* clampArrayRange([1, 2, 3, 4], 0); // 1
* clampArrayRange([1, 2, 3, 4], 2); // 2
Expand All @@ -381,7 +381,7 @@ export function clampArrayRange<T extends any>(n: number, arr: readonly T[]) {
* @param arr Array to clamp
* @param max Number to clamp the array length to
* @example ```ts
* import { clampArrayTo } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { clampArrayTo } from "https://deno.land/x/911@0.1.4/src/collection.ts";
*
* clampArrayTo([1, 2, 3, 4], 0); // []
* clampArrayTo([1, 2, 3, 4], 2); // [1, 2]
Expand All @@ -403,7 +403,7 @@ export function clampArrayTo<T extends any>(
* @param arr Array to clamp
* @param min Number to clamp the array length to
* @example ```ts
* import { clampArrayFrom } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { clampArrayFrom } from "https://deno.land/x/911@0.1.4/src/collection.ts";
*
* clampArrayFrom([1, 2, 3, 4], 0); // [1, 2, 3, 4]
* clampArrayFrom([1, 2, 3, 4], 1); // [2, 3, 4]
Expand Down Expand Up @@ -656,7 +656,7 @@ export function assign<T extends {}, V>(target: T, ...sources: V[]): any {
* @param predicate the predicate to use to filter the keys
* @returns a new object with only the keys that match the predicate
* @example ```ts
* import { filterKeys } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { filterKeys } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
*
* const menu = {
Expand Down Expand Up @@ -692,7 +692,7 @@ export function filterKeys<T>(
* that have a value that does not match the given predicate
* @category Collection
* @example ```ts
* import { filterValues } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { filterValues } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
*
* type Person = { age: number };
Expand Down Expand Up @@ -730,7 +730,7 @@ export function filterValues<T>(
* that do not match the given predicate.
* @category Collection
* @example ```ts
* import { filterEntries } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { filterEntries } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import {
* assertEquals
* } from "https://deno.land/std/testing/asserts.ts";
Expand Down Expand Up @@ -774,7 +774,7 @@ export function filterEntries<T>(
*
* @category Collection
* @example ```ts
* import { mapKeys } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { mapKeys } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
*
* const counts = { a: 5, b: 3, c: 8 };
Expand Down Expand Up @@ -807,7 +807,7 @@ export function mapKeys<T>(
* @example ```ts
* import {
* mapValues
* } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import {
* assertEquals
* } from "https://deno.land/std/testing/asserts.ts";
Expand Down Expand Up @@ -843,7 +843,7 @@ export function mapValues<T, O>(
* a new record containing the results.
* @category Collection
* @example ```ts
* import { mapEntries } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { mapEntries } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import {
* assertEquals
* } from "https://deno.land/std/testing/asserts.ts";
Expand Down Expand Up @@ -890,7 +890,7 @@ export function mapEntries<T, O>(
* @returns A new record containing only the non-nullish and non-empty values.
* @category Collection
* @example ```ts
* import { removeEmptyValues } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { removeEmptyValues } from "https://deno.land/x/911@0.1.4/src/collection.ts";
*
* const obj = { a: 1, b: '', c: null, d: undefined };
* removeEmptyValues(obj); // { a: 1 }
Expand All @@ -917,7 +917,7 @@ export function removeEmptyValues(
* @returns A new array containing only elements not shared between the two.
* @category Collection
* @example ```ts
* import { diff } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { diff } from "https://deno.land/x/911@0.1.4/src/collection.ts";
*
* diff([1, 2, 3, 4], [1, 2, 3]); // [4]
* ```
Expand All @@ -930,8 +930,8 @@ export function diff(arrA: string[], arrB: string[]): string[] {
* Splits the given array into chunks of the given size and returns them
* @category Collection
* @example ```ts
* import { chunk } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { assertEquals } from "https://deno.land/x/911@0.1.3/src/asserts.ts";
* import { chunk } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import { assertEquals } from "https://deno.land/x/911@0.1.4/src/asserts.ts";
*
* const words = [
* 'lorem',
Expand Down Expand Up @@ -978,7 +978,7 @@ export function chunk<T>(array: readonly T[], size: number): T[][] {
* elements, the latest one will be used (overriding the ones before it).
* @category Collection
* @example ```ts
* import { associateBy } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { associateBy } from "https://deno.land/x/911@0.1.4/src/collection.ts";
*
* const users = [
* { id: 'a2e', userName: 'Anna' },
Expand Down Expand Up @@ -1011,7 +1011,7 @@ export function associateBy<T>(
* the latest on will be used (overriding the ones before it).
* @category Collection
* @example ```ts
* import { associateWith } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { associateWith } from "https://deno.land/x/911@0.1.4/src/collection.ts";
*
* const names = [ 'Kim', 'Lara', 'Jonathan' ]
* const namesToLength = associateWith(names, it => it.length)
Expand Down Expand Up @@ -1105,7 +1105,7 @@ export function sortBy<T extends Record<string, any>>(
*
* @category Collection
* @example ```ts
* import { union } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { union } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import { assertEquals } from "https://deno.land/std@0.152.0/testing/asserts.ts";
*
* const soupIngredients = [ 'Pepper', 'Carrots', 'Leek' ]
Expand All @@ -1130,7 +1130,7 @@ export function union<T>(...arrays: (readonly T[])[]): T[] {
*
* @category Collection
* @example ```ts
* import { intersect } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { intersect } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import { assertEquals } from "https://deno.land/std@0.152.0/testing/asserts.ts";
*
* const lisaInterests = [ 'Cooking', 'Music', 'Hiking' ]
Expand Down Expand Up @@ -1161,7 +1161,7 @@ export function intersect<T>(...arrays: (readonly T[])[]): T[] {
* @returns reference to the same array
* @category Collection
* @example ```ts
* import { filterInPlace } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { filterInPlace } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import { assertEquals } from "https://deno.land/std@0.152.0/testing/asserts.ts";
* const numbers = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
* filterInPlace(numbers, it => it % 2 === 0)
Expand Down Expand Up @@ -1192,7 +1192,7 @@ export function filterInPlace<T>(
* @returns a new object
* @category Collection
* @example ```ts
* import { pick } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { pick } from "https://deno.land/x/911@0.1.4/src/collection.ts";
*
* const obj1 = { a: 1, b: 4, c: 8 };
* const obj2 = pick(obj1, ["a", "c"]);
Expand All @@ -1217,7 +1217,7 @@ export function pick<
* Returns the first element having the smallest value according to the provided comparator or undefined if there are no elements
*
* @example ```ts
* import { minWith } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { minWith } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import { assertEquals } from "https://deno.land/std@0.152.0/testing/asserts.ts";
*
* const people = ["Kim", "Anna", "John"];
Expand Down Expand Up @@ -1249,7 +1249,7 @@ export function minWith<T>(
* Returns the first element that is the smallest value of the given function or undefined if there are no elements.
*
* @example ```ts
* import { minBy } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { minBy } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import { assertEquals } from "https://deno.land/std@0.152.0/testing/asserts.ts"
*
* const people = [
Expand Down Expand Up @@ -1512,7 +1512,7 @@ export function maxBy<T>(
* Example:
*
* ```ts
* import { distinct } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { distinct } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import { assertEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
*
* const numbers = [ 3, 2, 5, 2, 5 ]
Expand All @@ -1536,7 +1536,7 @@ export function distinct<T>(array: readonly T[]): T[] {
* Example:
*
* ```ts
* import { distinctBy } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { distinctBy } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import { assertEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
*
* const names = [ 'Anna', 'Kim', 'Arnold', 'Kate' ]
Expand Down Expand Up @@ -1571,7 +1571,7 @@ export function distinctBy<T, D>(
* Applies the given aggregator to each group in the given Grouping, returning the results together with the respective group keys
*
* ```ts
* import { aggregateGroups } from "https://deno.land/x/911@0.1.3/src/collection.ts";
* import { aggregateGroups } from "https://deno.land/x/911@0.1.4/src/collection.ts";
* import { assertEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
*
* const foodProperties = {
Expand Down
6 changes: 3 additions & 3 deletions src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export interface ServeStaticOptions {
* can disable caching by setting `cache: false` in the options object.
*
* @example ```ts
* import { serve, serveStatic } from "https://deno.land/x/911@0.1.3/mod.ts"
* import { serve, serveStatic } from "https://deno.land/x/911@0.1.4/mod.ts"
*
* serve({
* // It is required that the path ends with `:filename+`
Expand Down Expand Up @@ -254,7 +254,7 @@ export function serveStatic(
*
* @example
* ```js
* import { serve, json } from "https://deno.land/x/911@0.1.3/mod.ts"
* import { serve, json } from "https://deno.land/x/911@0.1.4/mod.ts"
*
* serve({
* "/": () => json({ message: "hello world"}),
Expand All @@ -268,7 +268,7 @@ export function serveStatic(
*
* @example
* ```jsx
* import { serve, jsx, h } from "https://deno.land/x/911@0.1.3/mod.ts"
* import { serve, jsx, h } from "https://deno.land/x/911@0.1.4/mod.ts"
*
* const Greet = ({name}) => <div>Hello, {name}</div>;
*
Expand Down
2 changes: 1 addition & 1 deletion src/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export declare type JSONInit = {
* @param init optional configurations for `Response` and `JSON`
* @returns
* @example ```ts
* import { json } from "https://deno.land/x/911@0.1.3/mod.ts";
* import { json } from "https://deno.land/x/911@0.1.4/mod.ts";
* import { STATUS_TEXT } from "https://deno.land/std/http/http_status.ts";
*
* const response = json({
Expand Down
Loading

0 comments on commit 5804d93

Please sign in to comment.