1 In September 2025, "demodulatingswan" sent me a jq version of the customizer!
2
3 There are two versions:
4
5 * customizer.jq - Matches the style of customizer.rb
6 * customizer_golfed.jq - Much shorter, for those familiar with jq
7
8 Usage:
9
10 jq -c -f customizer.jq data.json > myemoj.json
11
12 Both scripts will produce the exact same myemoj.json file.
13
14 Something to note about customizer.jq: To match the Ruby version close as
15 possible, every filter could have been written in this style:
16
17 map(
18 if .version > 13
19 then empty
20 end
21 )
22
23 but using `select` is more common in `jq` I think, so I've negated all
24 conditions, like this:
25
26 map(select(
27 .version <= 13
28 ))
29
30 Dave's note: The "golfed" version is _way_ shorter, but still quite readable as
31 long as you know what the expected outcome is. I think it does a lot to
32 highlight the power of a DSL like jq over a general-purpose language for
33 specialized tasks.
34
35 UPDATE: demodulatingswan followed up with a golfed version of the Ruby
36 customizer as well! Which demonstrates how terse code can be when written in
37 the functional style. (And how certain paradigms can often translate cleanly
38 across languages.) Here it is in its entirety:
39
40 #!/usr/bin/env ruby
41 require 'json'
42
43 json_in = ARGF.read
44
45 if json_in.length < 1
46 puts "Oops, need JSON data. Pipe in or supply filename."
47 exit 1
48 end
49
50 list = JSON.parse(json_in)
51
52 puts JSON.generate(
53 list.reject {|e|
54 [
55 *[
56 /^regional indicator/,
57 /facing right/,
58 /keycap:/,
59 /family:/,
60 /(person|(wo)?man):? /,
61 /^Japanese/,
62 ].map {|re| e["label"].match?(re) },
63 [2, 9].include?(e["group"]),
64 e["version"] > 13,
65 ].any?
66 }.map {|e| e.slice("label", "emoji", "group", "tags") }
67 )