Skip to content

Commit

Permalink
break: use named dset export
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Jan 28, 2021
1 parent 630df8a commit 7ac17ed
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bench/immutable.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const assert = require('uvu/assert');
const { Suite } = require('benchmark');
const { klona } = require('klona/json');
const dset = require('../dist/dset');
const { dset } = require('../dist/dset');

const contenders = {
'clean-set': require('clean-set'),
Expand Down
2 changes: 1 addition & 1 deletion bench/mutable.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const contenders = {
'deep-set': require('deep-set'),
'set-value': require('set-value'),
'lodash/set': require('lodash/set'),
'dset': require('../dist/dset'),
'dset': require('../dist/dset').dset,
};

console.log('Validation: ');
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default function <T extends object, V>(obj: T, keys: string | ArrayLike<string>, value: V): void;
export function dset<T extends object, V>(obj: T, keys: string | ArrayLike<string>, value: V): void;
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $ npm install --save dset
## Usage

```js
const dset = require('dset');
import { dset } from 'dset';

let foo = { a:1, b:2 };
let bar = { foo:123, bar:[4, 5, 6], baz:{} };
Expand Down Expand Up @@ -56,8 +56,8 @@ If you need immutable writes, please visit [`clean-set`](https://github.com/fwil
Alternatively, you may pair `dset` with [`klona`](https://github.com/lukeed/klona), a 366B utility to clone your source(s). Here's an example pairing:

```js
import klona from 'klona';
import dset from 'dset';
import { klona } from 'klona';
import { dset } from 'dset';

export function deepset(obj, path, val) {
let copy = klona(obj);
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function (obj, keys, val) {
export function dset(obj, keys, val) {
keys.split && (keys=keys.split('.'));
var i=0, l=keys.length, t=obj, x, k;
for (; i < l;) {
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import dset from '../src';
import { dset } from '../src';

const API = suite('API');

Expand Down

0 comments on commit 7ac17ed

Please sign in to comment.