Skip to content

Commit

Permalink
docs: move clamp into math category
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanga-Ganapathy committed Mar 26, 2024
1 parent 5f84851 commit 84dfec9
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 15 deletions.
41 changes: 36 additions & 5 deletions apps/docs/components/PlaygroundREPL.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,45 @@ const NodeREPL = dynamic(
{ ssr: false }
);

const code = `const { range, diff, camelCase } = require('@opentf/std');
const code = `const {
isNum,
pascalCase,
sort,
clone,
isEql,
isEqlArr,
diff,
} = require("@opentf/std");
log(diff(
log(isNum(NaN));
log(pascalCase("pascal case"));
log(sort([1, 10, 21, 2], "desc"));
const obj = {
a: 1,
b: "abc",
c: new Map([["key", "val"]]),
};
log(clone(obj));
const mapA = new Map([
["a", 1],
["b", 2],
]);
const mapB = new Map([
["b", 2],
["a", 1],
]);
log(isEql(mapA, mapB));
log(isEqlArr([1, 2, 3], [2, 3, 1]));
diff([
['apple', 'mango', 'orange'],
['mango', 'apple']
));
log(range(1, 8));
log(camelCase('i phone'));
])
`;

const setupCode = `const _ = require('lodash');
Expand Down
1 change: 1 addition & 0 deletions apps/docs/pages/Maths/_meta.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"clamp": "clamp",
"percentage": "percentage",
"percentageOf": "percentageOf"
}
File renamed without changes.
1 change: 0 additions & 1 deletion apps/docs/pages/Number/_meta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"clamp": "clamp",
"isNegZero": "isNegZero",
"isZero": "isZero",
"toNum": "toNum"
Expand Down
18 changes: 9 additions & 9 deletions packages/std/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,28 @@ import {
isEql,
isEqlArr,
sleep,
} from "@opentf/std";
} from '@opentf/std';

isNum(NaN); //=> false

pascalCase("pascal case"); //=> PascalCase
pascalCase('pascal case'); //=> PascalCase

sort([1, 10, 21, 2], "desc"); //=> [ 21, 10, 2, 1 ]
sort([1, 10, 21, 2], 'desc'); //=> [ 21, 10, 2, 1 ]

const obj = {
a: 1,
b: "abc",
c: new Map([["key", "val"]]),
b: 'abc',
c: new Map([['key', 'val']]),
};
clone(obj); // It returns deeply cloned value.

const mapA = new Map([
["a", 1],
["b", 2],
['a', 1],
['b', 2],
]);
const mapB = new Map([
["b", 2],
["a", 1],
['b', 2],
['a', 1],
]);
isEql(mapA, mapB); //=> false

Expand Down

0 comments on commit 84dfec9

Please sign in to comment.