Skip to content

Commit

Permalink
Add-packages (#6)
Browse files Browse the repository at this point in the history
* Push

* Add changeset

* Fix tsup
  • Loading branch information
PuruVJ authored Jun 25, 2024
1 parent 5581450 commit 004daa9
Show file tree
Hide file tree
Showing 12 changed files with 194 additions and 99 deletions.
15 changes: 15 additions & 0 deletions .changeset/dry-elephants-work.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
'all-of-just': major
---

`all-of-just/collection` has been renamed to `all-of-just/collections`(Plural 's' at the end). This was a gaping inconsistency.

Same goes for `collection*` exports from `al-of-just`. For e.g, `collectionClone` is now `collectionsClone`.

### Added new packages.

Added 3 new pages:

- just-order-by (arrays)
- just-pipe (functions)
- just-has (objects)
10 changes: 9 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,13 @@
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"arrowParens": "always"
"arrowParens": "always",
"overrides": [
{
"files": "*.md",
"options": {
"useTabs": false
}
}
]
}
18 changes: 16 additions & 2 deletions packages/demo/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
import { randomInteger } from 'all-of-just/numbers';
import { compare } from 'all-of-just/collections';
import { has } from 'all-of-just/objects';

console.log(randomInteger(1, 10));
console.log(
compare(
new Map([
[1, 5],
[1, 0],
]),
new Map([
[1, 5],
[1, 0],
]),
),
);

console.log(has({ a: 1 }, 'x'));
194 changes: 110 additions & 84 deletions packages/pkg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,23 @@ So, to you use a function in one of these modules, all you got to do is import t
```ts
// just-clone
// A part of `Collection` module
import { collectionClone } from 'all-of-just';
import { collectionsClone } from 'all-of-just';
```

Again, we want the equivalent of `just-clone` here. `clone` method is part of `Collection` module, so we import `collectionClone`.
Again, we want the equivalent of `just-clone` here. `clone` method is part of `Collection` module, so we import `collectionsClone`.

Here's all the functions below 👇

```js
import {
// `Collection` module
collectionClone,
collectionCompare,
collectionDiff,
collectionDiffApply,
collectionFlush,
collectionPluck,
// `Collections` module
collectionsClone,
collectionsCompare,
collectionsDiff,
collectionsDiffApply,
collectionsFlush,
collectionsPluck,

// `Objects` module
objectsEntries,
objectsExtend,
Expand All @@ -72,7 +73,9 @@ import {
objectsSafeSet,
objectsTypeof,
objectsValues,
objectsDeepMapValues
objectsDeepMapValues,
objectsHas,

// Arrays Module
arraysCartesianProduct,
arraysCompact,
Expand All @@ -95,6 +98,8 @@ import {
arraysUnion,
arraysUnique,
arraysZip,
arraysOrderBy,

// Statistics module
statisticsMean,
statisticsMedian,
Expand All @@ -103,6 +108,7 @@ import {
statisticsSkewness,
statisticsStandardDeviation,
statisticsVariance,

// Strings module
stringsCamelCase,
stringsCapitalize,
Expand All @@ -116,10 +122,13 @@ import {
stringsSquash,
stringsTemplate,
stringsTruncate,

// Numbers module
numbersClamp,
numbersModulo,
numbersIsPrime,
numbersRandomInteger,

// Functions modules
functionsCompose,
functionsCurry,
Expand All @@ -132,6 +141,7 @@ import {
functionsPartial,
functionsRandom,
functionsThrottle,
functionsPipe,
} from 'all-of-just';
```

Expand All @@ -142,107 +152,123 @@ If you find these confusing, head over to the official [Docs](https://github.com
The convention of `[module][Function]` may not be preferable. In that case, you can use the function directly from the submodules.

```js
import { clone } from 'all-of-just/collection';
import { clone } from 'all-of-just/collections';
```

This is equivalent to

```js
import { collectionClone } from 'all-of-just';
import { collectionsClone } from 'all-of-just';
```

You don't have to type the module name before the actual function.

Available modules:

<!-- prettier-ignore -->
```ts
import { clone, compare, diff, diffApply, flush, pluck } from 'all-of-just/collection';
import {
clone,
compare,
diff,
diffApply,
flush,
pluck
} from 'all-of-just/collections';

import {
isCircular,
isEmpty,
entries,
extend,
filterObject,
flipObject,
mapKeys,
mapObject,
mapValues,
merge,
typeOf,
omit,
pick,
isPrimitive,
reduceObject,
safeGet,
safeSet,
values,
deepMapValues,
isCircular,
isEmpty,
entries,
extend,
filterObject,
flipObject,
mapKeys,
mapObject,
mapValues,
merge,
typeOf,
omit,
pick,
isPrimitive,
reduceObject,
safeGet,
safeSet,
values,
deepMapValues,
has
} from 'all-of-just/objects';

import {
cartesianProduct,
compact,
flattenIt,
groupBy,
index,
insert,
intersect,
last,
partition,
permutations,
random,
range,
remove,
shuffle,
sortBy,
split,
splitAt,
tail,
union,
unique,
zip,
cartesianProduct,
compact,
flattenIt,
groupBy,
index,
insert,
intersect,
last,
partition,
permutations,
random,
range,
remove,
shuffle,
sortBy,
split,
splitAt,
tail,
union,
unique,
zip,
orderBy
} from 'all-of-just/arrays';

import {
mean,
median,
mode,
percentile,
skewness,
standardDeviation,
variance,
mean,
median,
mode,
percentile,
skewness,
standardDeviation,
variance
} from 'all-of-just/statistics';

import {
camelCase,
capitalize,
kebabCase,
leftPad,
pascalCase,
prune,
replaceAll,
rightPad,
snakeCase,
squash,
template,
truncate,
camelCase,
capitalize,
kebabCase,
leftPad,
pascalCase,
prune,
replaceAll,
rightPad,
snakeCase,
squash,
template,
truncate
} from 'all-of-just/strings';

import { clamp, modulo, isPrime, randomInteger } from 'all-of-just/numbers';
import {
clamp,
modulo,
sPrime,
andomInteger
} from 'all-of-just/numbers';

import {
compose,
curry,
debounce,
demethodize,
flip,
memoize,
memoizeLast,
once,
partial,
random,
throttle,
compose,
curry,
debounce,
demethodize,
flip,
memoize,
memoizeLast,
once,
partial,
random,
throttle,
pipe
} from 'all-of-just/functions';
```

Expand Down
11 changes: 7 additions & 4 deletions packages/pkg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
"module": "./dist/arrays.js",
"import": "./dist/arrays.js"
},
"./collection": {
"types": "./dist/collection.d.ts",
"module": "./dist/collection.js",
"import": "./dist/collection.js"
"./collections": {
"types": "./dist/collections.d.ts",
"module": "./dist/collections.js",
"import": "./dist/collections.js"
},
"./functions": {
"types": "./dist/functions.d.ts",
Expand Down Expand Up @@ -98,6 +98,7 @@
"just-flip-object": "^2.3.0",
"just-flush": "^2.3.0",
"just-group-by": "^2.2.0",
"just-has": "^2.3.0",
"just-index": "^4.2.0",
"just-insert": "^3.2.0",
"just-intersect": "^4.3.0",
Expand All @@ -120,12 +121,14 @@
"just-modulo": "^2.2.0",
"just-omit": "^2.2.0",
"just-once": "^2.2.0",
"just-order-by": "^1.0.0",
"just-partial-it": "^3.4.0",
"just-partition": "^2.2.0",
"just-pascal-case": "^3.2.0",
"just-percentile": "^4.2.0",
"just-permutations": "^2.2.1",
"just-pick": "^4.2.0",
"just-pipe": "^1.0.0",
"just-pluck-it": "^2.3.0",
"just-prune": "^2.2.0",
"just-random": "^3.2.0",
Expand Down
1 change: 1 addition & 0 deletions packages/pkg/src/arrays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export { default as index } from 'just-index';
export { default as insert } from 'just-insert';
export { default as intersect } from 'just-intersect';
export { default as last } from 'just-last';
export { default as orderBy } from 'just-order-by';
export { default as partition } from 'just-partition';
export { default as permutations } from 'just-permutations';
export { default as random } from 'just-random';
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions packages/pkg/src/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export { default as memoize } from 'just-memoize';
export { default as memoizeLast } from 'just-memoize-last';
export { default as once } from 'just-once';
export { default as partial } from 'just-partial-it';
export { default as pipe } from 'just-pipe';
export { default as random } from 'just-random';
export { default as throttle } from 'just-throttle';
Loading

0 comments on commit 004daa9

Please sign in to comment.