Skip to content

Commit

Permalink
unsafe → coerce
Browse files Browse the repository at this point in the history
  • Loading branch information
mobily committed Dec 22, 2021
1 parent 9af733a commit bc30729
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Array/Array.res
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ let uniqBy = (xs, uniqFn) => {

while index.contents < length(xs) {
let value = Belt.Array.getUnsafe(xs, index.contents)
let alreadyAdded = some(arr, (. x) => uniqFn(unsafe(x)) == uniqFn(value))
let alreadyAdded = some(arr, (. x) => uniqFn(coerce(x)) == uniqFn(value))

if !alreadyAdded {
Js.Array2.push(arr, value)->ignore
Expand Down Expand Up @@ -527,7 +527,7 @@ let flat = xs =>
if Js.Array2.isArray(value) {
Belt.Array.forEachU(value, (. element) => Js.Array2.push(acc, element)->ignore)
} else {
Js.Array2.push(acc, unsafe(value))->ignore
Js.Array2.push(acc, coerce(value))->ignore
}
acc
})
Expand All @@ -538,7 +538,7 @@ let rec flatten = (xs, arr) => {
while index.contents < length(xs) {
let value = Belt.Array.getUnsafe(xs, index.contents)
if Js.Array2.isArray(value) {
flatten(unsafe(value), arr)->ignore
flatten(coerce(value), arr)->ignore
} else {
Js.Array2.push(arr, value)->ignore
}
Expand Down
2 changes: 1 addition & 1 deletion tools/rescript-externals/Externals.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
external unsafe: 'a => 'b = "%identity"
external coerce: 'a => 'b = "%identity"
external raw_comment: string => 'a = "#raw_stmt"

@val
Expand Down

0 comments on commit bc30729

Please sign in to comment.