Skip to content

Commit 7117270

Browse files
author
fabianmoronzirfas
committed
feat(filter): added filters to remove unwanted strings
1 parent 6fbd837 commit 7117270

File tree

7 files changed

+29
-21
lines changed

7 files changed

+29
-21
lines changed

.bin/json-transform.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const Tag = require('./lib/tag');
77
const Category = require('./lib/category');
88
const _ = require('lodash');
99
const generator = require('./lib/generator');
10+
const Filters = require('./lib/filters');
1011

1112

1213
let data = [];
@@ -108,6 +109,14 @@ api.forEach((e, i, arr)=> {
108109
data.push(entry);
109110
});
110111

112+
// Some filtering
113+
let filter = new Filters();
114+
data.forEach((element)=>{
115+
116+
console.log(element);
117+
element.name = filter.dotNull(element.name);
118+
});
119+
111120
data = generator(data);
112121
// taken from here
113122
// http://stackoverflow.com/questions/23600897/using-lodash-groupby-how-to-add-your-own-keys-for-grouped-output

.bin/lib/filters.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var exports = module.exports = {};
2+
3+
function Filters () {
4+
5+
this.dotNull = function(str) {
6+
if(str.endsWith('.null') === true) {
7+
str = str.split('.null')[0];
8+
}
9+
return str;
10+
};
11+
}
12+
13+
module.exports = Filters;

.bin/lib/generator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function generator(data) {
1717
});
1818

1919
element.codetitle = `b.${element.name}(${params})`;
20-
console.log(element);
20+
// console.log(element);
2121

2222
}else if (element.kind.toString() === 'constant') {
2323
element.codetitle = `b.${element.name}`;

_data/categories.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4084,7 +4084,7 @@
40844084
"codetitle": "b.noise(x, [y], [z])"
40854085
},
40864086
{
4087-
"name": "noiseDetail.null",
4087+
"name": "noiseDetail",
40884088
"description": "Adjusts the character and level of detail produced by the Perlin noise function. Similar to harmonics in physics, noise is computed over several octaves. Lower octaves contribute more to the output signal and as such define the overal intensity of the noise, whereas higher octaves create finer grained details in the noise sequence. By default, noise is computed over 4 octaves with each octave contributing exactly half than its predecessor, starting at 50% strength for the 1st octave. This falloff amount can be changed by adding an additional function parameter. Eg. a falloff factor of 0.75 means each octave will now have 75% impact (25% less) of the previous lower octave. Any value between 0.0 and 1.0 is valid, however note that values greater than 0.5 might result in greater than 1.0 values returned by noise().",
40894089
"returns": null,
40904090
"category": "Math",
@@ -4109,7 +4109,7 @@
41094109
],
41104110
"kind": "function",
41114111
"tags": [],
4112-
"codetitle": "b.noiseDetail.null(octaves, fallout)"
4112+
"codetitle": "b.noiseDetail(octaves, fallout)"
41134113
},
41144114
{
41154115
"name": "noiseSeed",

_data/sub-categories.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5549,7 +5549,7 @@
55495549
"codetitle": "b.noise(x, [y], [z])"
55505550
},
55515551
{
5552-
"name": "noiseDetail.null",
5552+
"name": "noiseDetail",
55535553
"description": "Adjusts the character and level of detail produced by the Perlin noise function. Similar to harmonics in physics, noise is computed over several octaves. Lower octaves contribute more to the output signal and as such define the overal intensity of the noise, whereas higher octaves create finer grained details in the noise sequence. By default, noise is computed over 4 octaves with each octave contributing exactly half than its predecessor, starting at 50% strength for the 1st octave. This falloff amount can be changed by adding an additional function parameter. Eg. a falloff factor of 0.75 means each octave will now have 75% impact (25% less) of the previous lower octave. Any value between 0.0 and 1.0 is valid, however note that values greater than 0.5 might result in greater than 1.0 values returned by noise().",
55545554
"returns": null,
55555555
"category": "Math",
@@ -5574,7 +5574,7 @@
55745574
],
55755575
"kind": "function",
55765576
"tags": [],
5577-
"codetitle": "b.noiseDetail.null(octaves, fallout)"
5577+
"codetitle": "b.noiseDetail(octaves, fallout)"
55785578
},
55795579
{
55805580
"name": "noiseSeed",

math/noiseDetail.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ category: Math
77
subcategory: Random
88
returns: null
99
parameters:
10-
- {name: octaves, description: 'number of octaves to be used by the noise() function', optional: false, type: [Number]}
11-
- {name: fallout, description: 'falloff factor for each octave', optional: false, type: [Number]}
10+
- {name: octaves, description: 'Number of octaves to be used by the noise() function.', optional: false, type: [Number]}
11+
- {name: fallout, description: 'Falloff factor for each octave.', optional: false, type: [Number]}
1212
kind: function
1313

1414
---

math/noiseDetail.null.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)