Skip to content

Commit

Permalink
Remove docs and typings for nonexistent $pick()
Browse files Browse the repository at this point in the history
  • Loading branch information
lehni committed Nov 26, 2023
1 parent a8d6290 commit 27d7eab
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 52 deletions.
49 changes: 0 additions & 49 deletions doc/api/model/instance-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -1086,52 +1086,3 @@ const json = person

console.log(_.has(json, 'lastName')); // --> false
```

## $pick()

```js
modelInstance.$pick(keys);
```

Picks a set of properties.

##### Arguments

| Argument | Type | Description |
| -------- | -------------------------------------------------------- | ------------ |
| keys | string<br>string[]<br>Object&lt;string,&nbsp;boolean&gt; | keys to pick |

##### Return value

| Type | Description |
| -------------------- | ------------------- |
| [Model](/api/model/) | `this` for chaining |

##### Examples

```js
const json = person
.fromJson({ firstName: 'Jennifer', lastName: 'Lawrence', age: 24 })
.$pick('firstName', 'age')
.toJSON();

console.log(_.has(json, 'lastName')); // --> false
```

```js
const json = person
.fromJson({ firstName: 'Jennifer', lastName: 'Lawrence', age: 24 })
.$pick(['firstName', 'age'])
.toJSON();

console.log(_.has(json, 'lastName')); // --> false
```

```js
const json = person
.fromJson({ firstName: 'Jennifer', lastName: 'Lawrence', age: 24 })
.$pick({ firstName: true, age: true })
.toJSON();

console.log(_.has(json, 'lastName')); // --> false
```
2 changes: 0 additions & 2 deletions tests/ts/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,6 @@ const exampleDatabaseJsonPerson: Person = examplePerson.$setDatabaseJson({
});
const omitPersonFromKey: Person = examplePerson.$omit('lastName');
const omitPersonFromObj: Person = examplePerson.$omit({ firstName: true });
const pickPersonFromKey: Person = examplePerson.$pick('lastName');
const pickPersonFromObj: Person = examplePerson.$pick({ firstName: true });
const clonePerson: Person = examplePerson.$clone();
const setRelatedPerson: Person = examplePerson.$setRelated(
'parent',
Expand Down
1 change: 0 additions & 1 deletion typings/objection/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,6 @@ declare namespace Objection {

$set(obj: Pojo): this;
$omit(keys: string | string[] | { [key: string]: boolean }): this;
$pick(keys: string | string[] | { [key: string]: boolean }): this;
$clone(opt?: CloneOptions): this;
$traverse(filterConstructor: typeof Model, traverser: TraverserFunction): this;
$traverse(traverser: TraverserFunction): this;
Expand Down

0 comments on commit 27d7eab

Please sign in to comment.