- Added
objOf
function- Creates a new object based on the key value pair provided
fuzzySearch
has beenDeprecated
as of this version and will be removed inv4.0.0
amend
now uses Object spread rather thanObject.assign
for that small performance boost- When using
Object.assign
with an empty object, Object spread is consistently faster
- When using
- Converted map to use a
while
loop assoc combo - Moved
*.js
->*.spec.js
for unit tests - Expanded upon some more tests to get to 100% coverage
- Added new
memoizeWith
function - Added new types for
memoizeWith
- Added new unit tests for
memoizeWith
update
now usesadjust
under the hood which gives it all the same rules- Meaning it will also return the list back with an out of bounds index
- Added some a new test to
find
to test Set Data types - Added new
adjust
function which applies a function to a supplied array data at a provided index - Added new
keys
function which takes the keys of a provided object and gives them back as an array
values
now uses the built inkeys
function instead ofObject.keys
draft
now uses the built inkeys
function instead ofObject.keys
- Converted
any
,omit
,omitBy
,plan
,sift
,whole
, andwithDefaults
to usekeys
instead ofObject.keys
- Greatly expanded the unit testing around
values
- Expanded the unit tests for
groupBy
- Expanded the unit tests for
gt
andgte
- Expanded the unit tests for
difference
- Added an extra unit test for
plan
- Documentation link in readme now goes to kyanites website instead of 404ing
- Added new
takeLast
function- Which takes from the end of an array instead of the beginning
- Added new
dropLast
function- Returns a list containing all but the last n elements of the given list
- Added new
pick
function- Picks only the requested keys from a provided object
- Updated
types
forpathOr
so that it can be specified if needed (still defaults toany
)
- Updated
drop
to useMath.max
when deciding a starting index- This shouldn't affect the output of
drop
which is why its not a breaking change - It does however allow usage in other functions to work as expected
- This shouldn't affect the output of
- Updated Dependencies
- Converted kyanite to a full blown javascript module
- This may cause support issues for IE 11
- Converted from UMD to CJS support
- This may cause support issues for IE 11
- The minified scripts now use
K
instead ofkyanite
as the TS files specificy - Removed unminified version of the library in favor of breaking down supporting of multiple formats
- Removed "local copy" future support for direct html script tags
- Export script completely re written
- Updated all dev dependencies
- Rollup build stuff to be easier to use on my end and offer more stable support when I run builds
- Removed LGTM badge
- Fixed build badge
- Added preset to babel compiler
- Dev dependency updates
- Removed unused dependency
- Removed
mean
type error test since this isn't really needed
reject
was in the wrong category
- Updated dev dependencies
- Unreachable overloads in types
- Removed duplicated overloads in types
- Replaced
tap-spec
withtap-on
- Replaced CircleCI with github Actions
- Replaced README badge
- Added new
pathSatisfies
function, which runs a path to a value which is then passed through a function to see if it satisfies that condition and returns value of predicate - Added new
propSatisfies
function, which pulls a prop from an object and runs a function on it, returns value of predicate
- Created an internal
reducer
that is used by other functions, this should help reduce any circular dependencies with that function - Created an internal
reduced
that should help reduce any circular dependencies issues internally - Tweaked typings for
path
function to use a newPath
type
- The documentation for
difference
was outdated and incorrect
- Added new
omitBy
function which works like omit but uses a predicatefunction
instead of a key list - Added new
fromPairs
function which takes an array of arrays that contain key value pairs
- Tweaked a bit of the typings to allow more strict control
- Updated pinet to v1.1.1 for improved documantation functionality
- You can use the enter key with search now to find the function!
- The dist folder is no longer located on Github but it STILL exists with npm (it's built on upload to npm)
- Removed commitizen and standard-version (It just wasn't working out with how far along this project already is and how I usually do changes/logs)
- Updated all dev dependencies
- Removed david-dm badges because it doesn't seem like david-dm is ever coming back
- Some linting errors with new version of standardjs
- Dropped unused scripts
All notable changes to this project will be documented in this file. See standard-version for commit guidelines.
1.4.1 (2020-07-02)
- Removed module property from
package.json
so webpack should bundle it properly using the ie compatible build
- 🎸 Added values type definition (80ad6aa)
1.4.0 (2020-05-28)
- findindex: made findindex IE 11 compatible and switched to using it (0ec2cac), closes #149
- ie11: added compatibility for IE11 (0cc33db), closes #149
- ie11: converted functions using Object.values over to just values (71d5512), closes #149
- values: created new values function (c540b11), closes #149
1.3.0 (2020-03-31)
- converge: added a converge function (6d61d84)
- function: prop and propOr can now handle null values (c46091d), closes #144
- tail: added new tail function (9dba3be)
- xor: added new xor function (8c4a4fb)
1.2.0 (2020-02-27)
- functions: added T, F, tail, and cond Functions (22a300d)
- types: added new functions to types file (b0a9a98)
- More typing improvements, most of the function params should now default to any, making the library easier to use in typescript lang
- More tests and examples for
reduce
- Added a
pluck
function which returns a new array by plucking the same named property off all objects in the array supplied
- Documentation types for
map
- Improved some of the typings for functions
- Added more examples to
isNil
- Typo in
isNil
examples
size
was removed you can usecount
insteadfactors
no longer handles negative numbers (see improved section)- This can be accounted for with using the
negate
function
- This can be accounted for with using the
apply
only take a single param instead of an array of params now- You can use
applyN
instead if you wish to use the old functionality
- You can use
- Added a
withDefaults
function which will populate an object with default values if they don't exist within the data provided - Added a
multiples
function- Stress testing seems to point that it can handle up to 300 million limits in about 1.4s, but anything 400mil+ breaks the stack heap
- If you need to go that high may be wise to look into an arithmatic library
- Added
applyN
which is taking overapply
's old functionality
- All dependencies upgraded and audit fixes added
- Added some extra unit tests
- Large optimizations for
factors
re wrote the function and it should be able to handle extremely large numbers now- You won't see a huge performance boost on normal numbers within the hundred thousands maybe a few miliseconds this change was mostly to enhance factors so it can handle big integers better
- Note: This does not mean the new
BigInt
data type
- Switched over to use the pinet engine for building the docs
- Cleaned up
isPrime
slightly, debating if the trial division approach is still best or not
- CI breaking the CNAME definitions
- Removed
memoizeWith
since it was more of a POC from ramda's code base- I will most likely look into re adding it with my own code if the need is there right now I just don't see it
- Added
startsWith
function, which should work just likeendsWith
but with the beginning of a list.
isPrime
should handle edge cases like 0 a correctly now and return false instead of 0 (#121)endsWith
signature to reflect list instead of Array
find
has gone back to returningundefined
instead ofnull
for not found values
- Added
fold
function which runs areduce
without an initial accumulator - Added the
propOr
Function which returns the value of a property from an object or the provided default value - CircleCI will now handle publishing the documentation to the
gh-pages
branch
- Documentation for functions showing up
deprecated
when they were actually not - Documentation for
join
moved it to theArray
Category, and fixed a typo in it's example - Documentation for
apply
showed incorrect curry examples
min
is now using thefold
function- Finally improved the documentation process so now documentation changes won't flood the PRs!
- Added
propEq
function which takes a object property value and compares it against a given value to see if it's equal - Added
notEq
function which checks if the provided values are not equal to each other
- The documentation for
and
should now reflect correctly on the return and params
pathOr
andpath
breaking onnull
value
ascend
anddescend
are no longer curried since they're meant to be sort based functionality and will always be called with their 2 params- The reasoning behind this is primarily performance, when using the function as intended there is a significant drop in performance
- Note:
ascendBy
anddescendBy
have kept their curried status
- Added a
median
function which gets the median of an array of numbers - Added a
mod
function which behaves like a modulo would in actual mathematics - Added
somePass
function which takes an array of functions and passes a value through them until one passes or the end is reached - Added
everyPass
function which takes an array of functions and passes a value through until one fails or the end is reached - Added
chunk
function which chunks an array of data into smaller arrays
pipe
&pipeP
are now using the Kyanitereduce
giving them a small performance boost
- Fixed a lot of signature displays through out the docs
- Documentation Fixes:
addIndex
description tweaksmemoizeWith
added RamdaJs credit since it's based mostly off their versionlt
,lte
,gt
, andgte
all had invalid examples in their documentation. This is addressed nowfind
anddeepEq
examples were incorrect
- Added
sum
function which takes an array of numbers and adds them together- TS type added
- Added
product
function which takes an array of numbers and multiplies them together- TS type added
- Switched over to Circleci and Codecov
- TS types
- Added
addIndex
type - Added
memoizeWith
type
- Added
addIndex
Documentationslice
Documentation
- Added a
addIndex
function which can be used onmap
,filter
, orreduce
like functions to have them return the index and full list back to your callback function - Re added the
amend
function (for now?) - Added
memoizeWith
function
factors
output has changed to be inclusive, it also works with negative numbers now- Example:
factors(-36) // => [1, 2, 3, 4, 6, 9, 12, 18, 36]
- You can easily get negative factors with
negate
andmap
- e.g:
map(negate, factors(-36)) // => [-1, -2, -3, -4, -6, -9, -12, -18, -36]
- e.g:
- Example:
empty
(andisEmpty
until its removed) will now throw a type error for unsupported typesempty
supports the same types ascount
as well asnull
andundefined
- e.g:
empty(1) // => TypeError: Unsupported type: Number
juxt
functionality changes. It's now a 2 param curried function that takes arrays for data- e.g:
juxt([Math.min, Math.max], [3, 4, 9, -3]) // => [-3, 9]
- Also moved it to be in the array category
- e.g:
ap
re written to be a proper S combinator function- e.g:
ap(x => y => x + y, z => z * 2, 2) // => 6
- e.g:
- Removed
amend
function since it's really just a limitedObject.assign
no real use for it
reduce
now supports iterable types likeMap
andSet
- Added
inc
Function which increases a number by 1 - Added
dec
Function which decreases a number by 1 - Added
isZero
Function which checks if the number passed in is equal to the number zero - Added
size
Function which takes a map or set data type and returns its size- Note: It is currently categorized under
Function
which may change in the future as I add more Map|Set friendly functions
- Note: It is currently categorized under
- Added
count
Function which takes any collection based data and counts the values within - Added
reduced
Function which should be used withreduce
orreduceRight
as a short circuit for the function (see improved) has
is now generic forArray
,String
,Object
,Map
, andSet
data types- Added
within
Function which acts likebetween
but is exclusive of the numbers provided
isEmpty
now supportsMaps
andSets
- Slight increase in
partition
performance - Slight increase in
omit
performance - Added import example onto each function, so it's visible within the examples
factors
had some typos in its docs- Cleaned up
always
documentation - Cleaned up
identity
documentation examples - Cleaned up
type
to be more lightweight - Completely re wrote
reduce
andreduceRight
- No breaking changes
- Both functions now support
reduced
which will short circuit out of the iteration and return the value - This is a good strategy for performance boosts
reduce
,reduceRight
, andreduced
are all using the@@transducer
protocol- Moved
every
,some
,reject
,filter
, andfind
to use this new flow giving them decent performance improvements - Tweaked
height
function for a tiny performance boost
- Updated Dev Dependency
npm-run-all
to fix the critical security vulnerability - Homepage url to point to https://kyanite.dusty.codes
- Added TypeScript Declarations file to bring in typings for functions
- Added
pathOr
function which works like path but allows a value to be returned rather than justundefined
- Added
test
function which runs a regex test against a provided string - Added
match
function which will match a string against some regex and build an array of matching strings
- README organization to help alleviate confusion
- Documentation for
partition
,max
,min
,maxBy
, andminBy
to be a bit easier to understand
range
will no longer show up under theFunction
category- Docs for
find
so that the return is accurate - Docs for
omit
so that the description is accurate and makes sense, also made the param more verbose - Docs for
path
to correct the description - Docs for
or
to have the correct types associated with the values - Docs for
concat
to correct it's signature List
type docs to depict String & Array signatures or "List" signatures
omit
documentation to show correct input
- Added
over
function which applies a function over a object value
- Dropped IE support
- Dropped modularity support please see issue #61 for more info
- In short, with the recent rollup versions currying is better supported for tree shaking
- All deprecated functions
is
,compact
,compress
,empty
,deepClone
,contains
,strip
,clone
,head
,tail
,pluck
, andwords
assign
,entries
, andvalues
Since we dropped IE support you shouldn't need these functionsunzip
- Rare use case limited usabilitydefaults
- Rare use case, you can achieve similar withObject.assign
and small tweaking
sub
tosubtract
mul
tomultiply
div
todivide
identical
toeq
isEqual
todeepEq
reduce
now expects a flipped reducer function(x, acc)
rather than(acc, x)
add
No longer does type coercion to the values passed infind
andfindIndex
now use the built in higher order functions- Moved
last
andfirst
into the list type rather than array - Flipped the way
subtract
does math instead ofsubtract(2, 1) === 2 - 1
it will now besubtract(1, 2) === 2 - 1
mean
has gone back to returningNaN
if given an empty array and will throw aRef Error
if given no paramsrange
will not return a type error if given a string- Re wrote
isEqual
again, making it far more flexible again as well as far more performant omit
now requires you to send an array of keys even if it's just onedifference
no longer cares about array order, and accepts an array of arraysapply
now always requires an array for values
- Huge performance gains, added internal curry backend since functions rely on each other so much
- Replaced
uglify-js
withterser
- Moved
mean
to Number type rather than Array type - Also cleaned up
mean
- Cleaned up and fixed the
mean
documentation - Cleaned up
complement
andreject
documentation - Param rename in
pipe
to be more verbose/accurate - Cleaned up
sortBy
- Cleaned up
gcd
- Cleaned up
factors
- Moved
length
to list type isEqual
's documentation needed more examplesisEqual
is able to handleSet
data typesisEmpty
usesisNil
now instead of!x
isOdd
andisEven
both cleaned up nicely- Moved
range
to number type height
improvements to use.values
vs.keys
- Added
flip
function which flips the params sent to a given function - Added
eqBy
function which compares two values after applying a function to both - Added
negate
function which adds a negative to a given number - Added
composeP
function which works likecompose
but with Promises - Added
pipeP
function which works likepipe
but with Promises - Added
replace
function which takes a string and replaces a value within it - Added
countBy
function which takes an array and counts the values - Added
amend
function which amends a new object into an old to update data - Added
clamp
function which clamps a number between 2 others - Added
defaultTo
function which returns a value unless it isNaN
,undefined
, ornull
then it returns a default - Added
reduceRight
function which works likereduce
but starts from the right of the array
is
There isn't a solid enough use case for this aside from maybe a test suite, this is also pretty messy data wise- Try using
type
instead
- Try using
identical
As it is going to become theeq
function in v0.10.0compact
usefilter
insteadcompress
usesift
insteadwords
The use case is basically just usingsplit
anyway
- Incorrect documentation on
compose
- Typo in
includes
documentation
clone
: There is no real need for this since every function already shallow clones data, and a deep clone is shaky ground at besthead
: Bad use case, objects are in no particular ordertail
: Bad use case, objects are in no particular order
- Added description to
compose
function
- The documentation for
any
andwhole
didn't make a lot of sense round
description needed a slight tweak- Made
add
,div
,mul
, andsub
descriptions a bit more strict
Notice: All deprecated functions will be removed in the v0.10.0 release
isEqual
now takes order of arrays into consideration and will return false if arrays do not match in orderwhen
is no longer a maybe return and should give back the original data passed in. It also supports only a single param passed in- New
List
type for similar functions that apply to a List of characters (string) and a List of items (Array)slice
has been moved to this typeincludes
has been moved to this typeconcat
has been moved to this typereversed
has been moved to this typenth
has been moved to this type
concat
flow changed a little bit to work more like built in concat- In order to achieve array type simply use
concatMap
like so:concatMap(x => x, [[1, 2], [3, 4], [5, 6]])
- In order to achieve array type simply use
range
now requires you to pass 2 params to it, it is curried out of the box as well.- The parameters for
gt
,gte
,lt
andlte
have been flipped to meet the proper data last structure
pluck
: Shaky code stack, and lack of use cases thatprops
andprop
can't handlestrip
: No real use cases to benefit from thisempty
: No real use cases to benefit from thiscontains
: Useincludes
within the list type
filter
had incorrect data types within its documentationwhen
documentation typos and no longer hard to read
- Added
always
function which takes 2 params and always returns the first one. Good for pipes since its curried - Added
compose
function (finally) - Added
unless
function which takes 3 params, and acts the opposite ofwhen
- Added
split
function which takes a char and a string and splits the string based on the char - Added
takeWhile
function which will take values from an array based on a function boolean - Added
dropWhile
function which will drop values from an array based on a function boolean - Added
apply
function which takes an array of data and applys a function to it - Added
either
function which takes 2 functions and a value and if either function returns truthy will return true - Added
endsWith
function which checks if the passed in list ends with the given value
- Documentation for
includes
andidentity
functions - Removed unused code (
circular
andisObject
) - Added handling for an edge case with
Object.keys
inside ofisEqual
- Added
isPrime
function which accepts a number and determines if its prime or not - Added
factors
function which accepts a number and finds its factors
- Tweaked
range
handling and flow to work better withfactors
- Case where passing a string number to range might produce weird results
- No longer packaging unwanted items like coverage results
- Slightly the build process of the module (pre-publish/release anyway)
- Added 2nd level Modularity you can now request sections of the library by type
- Example:
import KO from 'kyanite/object
See theModular By Datatype
section of the readme
- Example:
- Documentation spelling error for
path
- Documentation is now Consistent to the linter and the rest of the module
assign
is now curried and expects a minimum of 2 values passed in
deepClone
: Useclone
instead, to mimic the deep clone functionality do this:clone({ a: 1 }, true)
- Added new
clone
function, it can create a shallow clone for Objects however accepts a 2nd param to use deep clone capabilities - New
unzip
function which takes an object and breaks down into two arrays one of keys and one of values
- Re wrote the assign function using
Object.keys
to remove the need forfor in
looping and checkinghasOwnProperty
- Slight tweaks to
has
andassign
unit tests - Added function names to descriptions of tests to verify what is testing what
- Further unit test improvements
- The documentation for
when
was missing a description, this has been addressed
- Replaced null check within
defaults
withisNil
to keep non strict to a minimum
- Swapped param usage for
div
functionality- Ex:
div(4, 2) // => 2
should now bediv(2, 4) // => 2
- Ex:
- Added number
pow
function which takes an exponent and base number and rises the number to the exponents value - Added number
rem
function which finds the remainder of two numbers - Added number
isOdd
function which checks if the provided number is odd or not - Added number
isEven
function which checks if the provided number is even or not - Added string
toUpper
function which transforms a string to all upper case - Added string
toLower
function which transforms a string to all lower case
- Removed unreachable code block from equals functionality
- Coverage for
tail
andhead
functions
- Completely re wrote
sift
to act as a for real filter, instead of anotheromit
- Complete re work of
isEqual
in an attempt to make it much more lightweight- IMPORTANT: This method will no longer handle/care about recursive data in objects so if you are comparing potential circular/recursive data you will get a memory stack error
- It can still compare Primitive types, as well as Arrays, Objects, Dates, RegExp, and memory like Promises
- Dropped support for items like Object based Booleans/Strings (
new Boolean
), Maps, Errors, And a lot of the really super rare edge cases
- Compatibility patch for using
isEqual
in IE - Documentation bug not showing arguments for functions
- fuzzySearch param naming in documentation was inconsistent
- Added a new
draft
function for objects which essentially applies a provided function to all of the values within an object (essentially an object map) - Re categorized
fuzzySearch
as a String function rather than a normal function
isEqual
gained a lot of improvements to performance, this is also dependent on the size/format of the data being comparedisEqual
file size has dropped by a lot with the new re write
- Tweaked how
max
was running it's comparisons - Tweaked how
min
was running it's comparisons
- Added
head
function for objects, which pulls the first value from it - Added
tail
function for objects, which pulls the last value from it - Added
maxBy
function which applies a function to each value before comparing the max - Added
minBy
function which applies a function to each value before comparing the min - Added
zip
function which takes two arrays and turns them into an object key value pair
fuzzySearch
algorithm is stable again and extremely more accurate than before- I may need to look into a better solution than I currently have for it however
- Added more complex testing strings to
fuzzySearch
tests
- Renamed
gets
toprops
to meep the convention consistent - Renamed
includes
tocontains
for strings (swapped with array) - Renamed
contains
toincludes
for arrays (swapped with string) - Removed
deepClone
becauseassign
ultimately generates a brand new object when ran
- Added
join
string function which accepts a string and an array to generate a joined string - Added
branch
function which takes 3 functions and a value, and will run either the 2nd or 3rd function based on if the first passes - Added
ap
function which takes an array of functions to be applied to an array of data, concating the results together - Added
on
function which takes 2 functions and 2 values, applies the 2nd function to both values and then applies the first function onto those
- Converted the function used by compact to just be
identity
- Added some slight test additions to
pipe
- Tweaked documentation automation to make sure the main site is always up to date
- Re organized the
src
andtest
folder contents into seperate folders based on category- This is no way affects usage, you can still do
import isEmpty from 'kyanite/isEmpty'
it's more to make it easier to work with and avoid duplication
- This is no way affects usage, you can still do
findIndex
returns a maybe, so instead of a -1 if no index is found it will returnundefined
- The
src
folder is now included on install, so if you want to use the es6 versions of the module, you can import them fromkyanite/src/type/function
- An example might be for curry it'd be:
import curry from 'kyanite/src/function/curry'
- An example might be for curry it'd be:
- A few documentation fixes which also involved some missing information/categories
- Added
encase
which encases the provided function with try catch to safely execute the function - Added
drop
which takes an array and drops the requested number of values from the front - Added
take
which pulls values from an array up until the point specified (the opposite of drop) - Added
sortWith
which takes an array of functions and goes through the array when it encounters ties with the data while sorting it
- Added
findIndex
function which takes a function and array and returns the first value from the array that passes the function - Added
groupBy
function which groups the values of an array into common properties of an object - Added
sortBy
function which sorts an array based on the values when ran through a function - Added
descendBy
function which accepts a function to run against values for sorting in descending order - Added
ascendBy
function which accepts a function to run against values for sorting in ascending order
- Added
ascend
function which can be used with sort for ascending order - Added
descend
function which can be used with sort for descending order - Added
both
function which accepts 2 functions and a value, returns true if both functions pass, otherwise returns false
- Added ability to handle string numbers to
add
function
fuzzySearch
params have been swapped, so now itsfuzzySearch(needle, haystack)
instead- Renamed
removeAt
to justremove
- Renamed
replaceAt
to justupdate
flatten
has been removed, consider usingconcat
andconcatMap
insteaduniq
now only looks for an array, useuniqBy
in order to use the old functionality- Removed
clone
sinceassign
is essentially the same thing with more capabilities - Function params passed to
juxt
should now be contained within a single array - Changed the return of
mean
so it returns 0 instead ofNaN
for bad arguments passed in isEmpty
now handles values such asnull
,undefined
,NaN
, andBooleans
it will returntrue
for ALL of theseempty
no longer throws an error for non "emptyables". Instead it returnsundefined
- Addressed copy and paste errors for
prepend
docs - Addressed several documentation errors
- Some more tweaks to internal documentation scripts
- Replaced
ava
and converted back totape
(Yay!) max
now useslast
internally instead ofnth
should improve is seperate build size/performancemin
now usesfirst
internally instead ofnth
should improve is seperate build size/performance- Removed
functionName
internal since it's no longer being used - Improved build size of
isEqual
by removing impossible logic - Added onto
identical
documentation with more examples - Re-wrote
assign
for better optimization,
- Added
path
function to safely navigate objects that may or may not have properties - Added
sift
function which works a lot likefilter
but withObject
data types - Added
whole
function which works a lot likeevery
but withObject
data types - Added
any
function which works a lot likesome
but withObject
data types - Added
insert
function which inserts a data value into a specified index of an array - Added
height
function which works like length, however it handles object data types - Added
gets
function which goes through an object to pull values requested in an array - Added
plan
function which takes a schema object of functions to apply to a matching object of data - Added
gt
function which compares the passed in values to determine if one is greater than the other - Added
gte
function which compares the passed in values to determine if one is greater than or equal to the other - Added
lt
function which compares the passed in values to determine if one is less than the other - Added
lte
function which compares the passed in values to determine if one is less than or equal to the other - Added
when
function which uses a logic function to trigger an action function if the arguments are true - Added
concat
function which concats the values of an array to a new array - Added
concatMap
function which applies a function to the values of an array and concats them - Added
compact
function which takes an array and removes all falsy values from it - Added
uniqBy
function which does what the originaluniq
was built to do