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

@kakasoo/sortable

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kakasoo/sortable - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

.github/workflows/update_version.yml

7

dist/index.d.ts

@@ -0,1 +1,2 @@

import { DeepStrictObjectKeys } from "@kakasoo/deep-strict-types";
import { StringType } from "@kakasoo/proto-typescript";

@@ -5,2 +6,8 @@ import { StringToDeepObject } from "./types";

export declare function getSortable<Key extends string, Direction extends "asc" | "desc">(key: Key, direction: Direction): StringToDeepObject<Split<Key>, Direction>;
/**
* Create getSortable Function by using interface and type.
*
* @returns getSortable {@link getSortable sortableFn} function
*/
export declare const createSortable: <T extends object>() => <Key extends DeepStrictObjectKeys<T>, Direction extends "asc" | "desc">(key: Key, direction: Direction) => StringToDeepObject<Split<Key>, Direction>;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createSortable = void 0;
exports.getSortable = getSortable;

@@ -20,1 +21,8 @@ const proto_typescript_1 = require("@kakasoo/proto-typescript");

}
/**
* Create getSortable Function by using interface and type.
*
* @returns getSortable {@link getSortable sortableFn} function
*/
const createSortable = () => (key, direction) => getSortable(key, direction);
exports.createSortable = createSortable;

2

package.json
{
"name": "@kakasoo/sortable",
"version": "1.0.5",
"version": "1.0.6",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",

# sortable
## getSortable
```bash

@@ -43,1 +45,20 @@ $ npm i @kakasoo/sortable

```
## createSortable
```ts
interface Example {
user: {
name: string;
createdAt: string;
};
}
// #1
const sortable = createSortable<Example>();
sortable("user.createdAt", "asc"); // It guarantees type inference.
// #2
// also you can use like this:
createSortable<Example>()("user.createdAt", "asc");
```

@@ -0,1 +1,2 @@

import { DeepStrictObjectKeys } from "@kakasoo/deep-strict-types";
import { StringPrototype, StringType } from "@kakasoo/proto-typescript";

@@ -26,1 +27,14 @@ import { StringToDeepObject } from "./types";

}
/**
* Create getSortable Function by using interface and type.
*
* @returns getSortable {@link getSortable sortableFn} function
*/
export const createSortable =
<T extends object>() =>
<Key extends DeepStrictObjectKeys<T>, Direction extends "asc" | "desc">(
key: Key,
direction: Direction
) =>
getSortable<Key, Direction>(key, direction);
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