Page 5 of 7
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 21 Apr 2021, 16:40
by Chunjee
At work I don't have dropbox or other 'share my library folder to multiple computers' tool.
I have been meaning to try another project with more dependencies to explore the idea. biga.ahk and most others in my npm profile are basically self-contained.
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 27 Apr 2021, 18:36
by Chunjee
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 03 May 2021, 16:05
by Chunjee
v0.42.1
fixes:
.findIndex
.isString
v0.42.2
fixes:
.find
performance enhancements:
.dropWhile .count .filter .find .groupBy .map .partition .reject .some .meanBy .findKey .mapKeys .mapValues .findIndex .dropRight
new:
.isCallable
Code: Select all
boundFunc := Func("strLen").bind()
A.isCallable(boundFunc)
; => true
IsFunc(boundFunc)
; => false
A.isCallable(A.isString)
; => true
A.isCallable(A.matchesProperty("a", 1)
; => true
A.isCallable([1,2,3])
; => false
Please enjoy it
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 03 May 2021, 18:27
by Chunjee
For all the methods that can call on a function iteratee; I previously had two or three different checks to see what kind it might be. For example there was a simple isFunc() for straightforward functions, a fn.name check for method calls, and then shorthands turn into boundFuncs were their own challenge. But now basically all of these are discoverable with .isCallable
So the innerworkings have been simplified, meaning they are less prone to edge cases and probably slightly faster.
One complication is that some outputs could be confused by situations where the iteratee is called with the value, key, and collection. for example .trim the 2nd parameter is the characters to trim, and the key would not be useful in that situation and I have "guarded" it. I will be exploring all the methods that need to be guarded and the best way to accomplish that for all necessary methods.
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 07 May 2021, 19:15
by Chunjee
v0.42.3
fixes:
.findIndex type checking
.find type checking
.keyBy will only use .property shorthand
.difference will remove all occurrences of value
performance enhancements:
.keyBy
.sortBy
.filter
.diffrence was only removing from the array once; whereas it will now remove all occurrences in accordance with the documentation "Creates an array of array values not included in the other given arrays."
Previously:
Code: Select all
A.difference([50, 50, 90], [50])
; => [50, 90]
Now:
Code: Select all
A.difference([50, 50, 90], [50])
; => [90]
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 12 May 2021, 16:48
by Chunjee
Added a dark theme to the documentation at
https://biga-ahk.github.io/biga.ahk
The default is still light which was updated marginally.
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 14 May 2021, 16:17
by Chunjee
Pretty chill way to generate an array of random numbers. Without a lot of extra helper functions, variables, outputvars, or while loops; you can control: how many, lower limit, upper limit
Code: Select all
boundFunc := A.random.bind(A, 1, 1000)
array := A.times(5, boundFunc)
; => [395, 364, 809, 904, 449]
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 21 May 2021, 17:08
by Chunjee
v0.43.0
new:
.invert
.invertBy
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 23 May 2021, 17:30
by MrDoge
I converted a modded version of biga.ahk to AHK_H v2 (you may want to create a v2 branch on github)
I wanted the conversion to be totally done automatically, but I had to make a few mods (I used biga.ahk to break and improve
ahk_parser.js, so ty)
please test it
og:
Biga.ahk
modded:
Biga_mid.ahk
converted:
Biga.ah2
script that uses it:
use biga.ah2
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 24 May 2021, 12:00
by Chunjee
Thank you that is very much appreciated! I think that is worth linking in the README so that those using v2 can more easily find it.
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 25 May 2021, 19:01
by Chunjee
v0.44.0
new:
.isInteger
fixes:
.parseInt more handling of numberlike strings ("10,100", "10 10")
.includes work with object values
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 28 May 2021, 09:59
by Chunjee
v0.44.1
performance:
.isCallable should be slightly faster
fixes:
.sample and
.sampleSize will now work with string input. Meaning you can now just write
A.sample("123") instead of
A.sample(strSplit("123"))
There was a bug when using a guarded message (currently only
.trim) when an instance of the class had not been initialized.
Now the base class will be checked so that any extending class or fork will work.
Getting closer to a good system to handle more guarded methods.
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 06 Jul 2021, 13:20
by Chunjee
v0.45.0
new:
.isBoolean
.sumBy
Please enjoy it
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 21 Jul 2021, 16:12
by Chunjee
v0.46.0
new:
.maxBy
.minBy
.pickBy
.countBy
fixes:
.words
Some Documentation typos
Count the word frequency in a long string:
Code: Select all
sentence := "If I remain careful, I can repeat what I am compelled to do, over and over again."
; find how many times each word appears in the sentence
wordOccurances := A.countBy(A.words(sentence), A.toLower)
; => {"again": 1, "am": 1, "and": 1, "can": 1, "careful": 1, "compelled": 1, "do": 1, "i": 3, "if": 1, "over": 2, "remain": 1, "repeat": 1, "to": 1, "what": 1}
Please enjoy it
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 22 Jul 2021, 04:05
by ozzii
Thank you for this class and the updates
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 28 Jul 2021, 11:40
by Chunjee
v0.47.0
new:
.identity
.stubArray
.stubFalse
.stubObject
.stubString
.stubTrue
fixes:
.countBy
.every
.findIndex
.findLastIndex
.keyBy
.mapKeys
.mapValues
.maxBy
.meanBy
.minBy
.partition
.pickBy
.sortBy
.sumBy
.times
performance:
.forEach
.invertBy
.keyBy
In the documentation you may have seen "predicate:=.identity" but prior to today this default didn't work on account of
.identity not existing. Most of the fixes listed above had to do with making this work for all those methods; but other methods didn't require any code change and are not listed.
Added 24 new unit tests across 22 different methods to ensure
.identity always works as a default parameter. This brings the total tests to 632
.identity is a curious method; it just returns the value supplied; not every useful on it's own but since many methods call functions; it can be useful to pass back the called data without any changes.
Create and fill an array:
Code: Select all
A.times(10, A.identity)
; => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Since
.times uses the
.identity as a default iteratee; it can be done the same simply with:
Code: Select all
A.times(10)
; => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Re: [Class] biga.ahk (utilities mirroring Lodash)
Posted: 14 Aug 2021, 12:21
by Chunjee
Chunjee wrote: ↑02 Oct 2019, 13:16
in v0.3.4 the #Include is now structured
Code: Select all
class biga {
; {{methods}}
}
class A extends biga {
; no changes
}
Which means a "superobject" named
A will be available at the global scope without creating an instance of biga(). This will continue to exist as a convenience but as a normal practice I would recommend creating an instance of any class you use.
I think removing this superglobal
A would be a good idea; which was already in my plan at or around v1.0.0
If you disagree please let me know and why.
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 19 Aug 2021, 20:29
by tuzi
Why would I miss this lib for such a long time. It's so good!
I love it. Thank you for share it!
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 20 Aug 2021, 23:37
by Chunjee
v0.48.0
new:
.get
fixes:
.inRange
The superglobal
A has been removed
Code: Select all
object := {"a": [{ "b": { "c": 3} }]}
A.get(object, "a[1].b.c")
; => 3
A.get(object, ["a", "1", "b", "c"])
; => 3
A.get(object, "a.b.c", "default") ; returns default parameter since no value found at "a.b.c"
; => "default"
Re: [Class] biga.ahk (immutable utility library for arrays, strings, etc)
Posted: 23 Aug 2021, 18:35
by Chunjee
The library is available for use via the Ace bot and the
.ahk command on Discord. Include by using
#Include <biga>
- image.png (38.69 KiB) Viewed 3609 times