Comments (12)
Should probably update debug
to display maps correctly.
from sassylists.
chunk()
: fail (makes no sense)
count-values()
: OK (makes no sense and looks ugly)
debug()
: OK
first()
: OK
insert-nth()
: fail
is-symmetrical()
: makes no sense
last()
: OK
last-index()
: fail (returns null)
loop()
: OK
prepend()
: OK (looks weird)
purge()
: makes no sense
random-value()
: fail
remove()
: fail
remove-duplicates()
: can't be duplicate keys in maps
remove-nth()
: OK
replace()
: fail
replace-nth()
: fail
reverse()
: OK
slice()
: OK
sort()
: OK
sum()
: returns 0
to-string()
: OK
from sassylists.
Added 3 functions: map-sort-keys()
, map-sort-values()
and map-find-keys()
.
from sassylists.
@hugogiraudel Map related functions should probably be in https://github.com/Team-Sass/Sassy-Maps instead of Lists
Additionally, debugging maps works as of RC2
from sassylists.
Good idea, problem is they rely on the sort()
function from SassyLists. Not sure you can do anything with those 3 functions without the sort one.
from sassylists.
As much as I kinda hate to say it, duplicate the sort function?
from sassylists.
I don't think this is a good idea. I'd rather have a clean map sort function for Sassy-Maps. Both map-sort-keys()
and map-sort-values()
are based on the sort()
function that was initially meant to order lists, not maps.
Working out a fresh from start map function meant for maps and maps only is probably a better idea. What do you think?
from sassylists.
That works too. I figured your sort function had been optimized for maps, but if it hasn't, yah, working out a fresh one works
from sassylists.
Basically here is what I do to sort a map based on its keys (map-sort-keys
):
- I create a list out of the keys
- I order the list
- I find back the value from the initial map for each key
- I make a map out of it and return it
To sort a map based of its values (map-sort-values
), it's slightly more tricky since there can be multiple keys sharing the same values, so I need the helper function map-find-keys
:
- I create a list out of the values
- I order the list
- I find back the keys matching each value and exclude them in a temporary list
- I make a map out of it and return it
Kind of a big process but since the sort()
function is probably the most complicated one from SassyLists, I didn't want to duplicate it just to deal with maps.
On topic, I'm not sure how to do it with less code if we want to deal with maps only for Sassy-Maps, but I'll have a look at it if you want.
from sassylists.
I'm not sure, we should move this discussion to Sassy Maps
from sassylists.
Let's go. I let you open an issue. )
from sassylists.
Won't fix.
from sassylists.
Related Issues (20)
- Add comma-list HOT 1
- typo in _prepend.scss HOT 2
- Implement range HOT 1
- Update to-map HOT 1
- Move to @error
- Wrong doc or wrong parameters in sl-remove HOT 1
- Include pop / shift HOT 1
- SassyLists & LibSass compatibility ? HOT 11
- Support reduction HOT 4
- Add 2.2.4 release
- Random value is broken
- Add better docs on install HOT 3
- Documentation link is broken HOT 1
- Official website is offline HOT 6
- Move tests to True
- NPM build is broken HOT 11
- Tests do not pass HOT 2
- Release/publish to npm HOT 1
- Sass 4.0 `call()` deprecation warning
- "Invalid CSS after" at `sl-str-compare` tests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sassylists.