Skip to content

Commit

Permalink
🤖 config(xo): Configure import/order.
Browse files Browse the repository at this point in the history
These changes were automatically generated by a transform whose code can be found at:
  - https://github.com/make-github-pseudonymous-again/rejuvenate/blob/31b7e48f29789fa2e2ad9e16013ff277c3bbca57/src/transforms/xo:config-import-order.js
Please contact the author of the transform if you believe there was an error.
  • Loading branch information
a-flying-potato authored and make-github-pseudonymous-again committed Mar 3, 2024
1 parent 76504b2 commit 68c50d3
Show file tree
Hide file tree
Showing 5 changed files with 1,022 additions and 632 deletions.
40 changes: 38 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"pinst": "3.0.0",
"power-assert": "1.6.1",
"regenerator-runtime": "0.14.1",
"xo": "0.52.4"
"xo": "0.57.0"
},
"ava": {
"files": [
Expand Down Expand Up @@ -216,7 +216,43 @@
"unicorn/prefer-node-protocol": "off",
"unicorn/filename-case": "off",
"unicorn/prefer-math-trunc": "off",
"unicorn/prevent-abbreviations": "off"
"unicorn/prevent-abbreviations": "off",
"import/order": [
"error",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"type"
],
"pathGroups": [
{
"pattern": "ava",
"group": "external",
"position": "before"
},
{
"pattern": "#module",
"group": "index",
"position": "after"
}
],
"pathGroupsExcludedImportTypes": [],
"distinctGroup": true,
"newlines-between": "always",
"alphabetize": {
"order": "asc",
"orderImportKind": "asc",
"caseInsensitive": false
},
"warnOnUnassignedImports": true
}
]
},
"overrides": [
{
Expand Down
37 changes: 23 additions & 14 deletions src/fill.js
Original file line number Diff line number Diff line change
@@ -1,64 +1,73 @@
import _fill from './_fill.js';
import nextUint8 from './nextUint8.js';
import nextUint16 from './nextUint16.js';
import nextInt32 from './nextInt32.js';
import nextFloat32 from './nextFloat32.js';
import nextFloat64 from './nextFloat64.js';
import nextBigInt64 from './nextBigInt64.js';
import nextBigUint64 from './nextBigUint64.js';
import nextFloat32 from './nextFloat32.js';
import nextFloat64 from './nextFloat64.js';
import nextInt32 from './nextInt32.js';
import nextUint16 from './nextUint16.js';
import nextUint8 from './nextUint8.js';

const fill = (prng, array, i, j) => {
switch (array.constructor) {
case ArrayBuffer:
case ArrayBuffer: {
return _fill(nextUint8, new Uint8Array(array), i, j);
}

case Int8Array:
case Uint8Array:
case Uint8ClampedArray:
case Uint8ClampedArray: {
return _fill(
nextUint8,
prng,
new Uint8Array(array.buffer, array.byteOffset, array.byteLength),
i,
j,
);
}

case Int16Array:
case Uint16Array:
case Uint16Array: {
return _fill(
nextUint16,
prng,
new Uint16Array(array.buffer, array.byteOffset, array.length),
i,
j,
);
}

case Int32Array:
case Uint32Array:
case Uint32Array: {
return _fill(
nextInt32,
prng,
new Int32Array(array.buffer, array.byteOffset, array.length),
i,
j,
);
}

case Float32Array:
case Float32Array: {
return _fill(nextFloat32, prng, array, i, j);
}

case Float64Array:
case Float64Array: {
return _fill(nextFloat64, prng, array, i, j);
}

case BigInt64Array:
case BigInt64Array: {
return _fill(nextBigInt64, prng, array, i, j);
}

case BigUint64Array:
case BigUint64Array: {
return _fill(nextBigUint64, prng, array, i, j);
}

default:
default: {
throw new Error(
`fill(prng, array, ...): array with constructor '${array.constructor.name}' not implemented`,
);
}
}
};

Expand Down
1 change: 1 addition & 0 deletions src/xoroshiro128plus.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import assert from 'assert';

import {rotl64, get64, add64, xor64, shl64} from '@arithmetic-type/uint64';

export default function xoroshiro128plus(seed, options) {
Expand Down
5 changes: 3 additions & 2 deletions test/src/splitmix64.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import test from 'ava';
import {range} from '@iterable-iterator/range';
import {map} from '@iterable-iterator/map';

import {get64} from '@arithmetic-type/uint64';
import {map} from '@iterable-iterator/map';
import {range} from '@iterable-iterator/range';

import {splitmix64, nextUint64, nextFloat64} from '#module';

test('https://rosettacode.org/wiki/Pseudo-random_numbers/Splitmix64 #1', (t) => {
Expand Down
Loading

0 comments on commit 68c50d3

Please sign in to comment.