Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/typedObjects.js

Issue 29323484: Issue 507 - Implement lightweight array.slice() method (Closed)
Patch Set: Created Aug. 12, 2015, 4:41 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | lib/typedObjects/arrayTypes.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 * garbage collected. In addition, it has the following properties and methods: 148 * garbage collected. In addition, it has the following properties and methods:
149 * 149 *
150 * get(index): retrieves the array element at specified index. 150 * get(index): retrieves the array element at specified index.
151 * set(index, value): sets the array element at specified index. 151 * set(index, value): sets the array element at specified index.
152 * length: number of elements in the array, by default 0. Increase the length 152 * length: number of elements in the array, by default 0. Increase the length
153 * to match your data size. 153 * to match your data size.
154 * size: size of the allocated buffer in array elements, will be at least 154 * size: size of the allocated buffer in array elements, will be at least
155 * equal to length. Normally you won't need to set the size explicitly. 155 * equal to length. Normally you won't need to set the size explicitly.
156 * However, the size won't decrease automatically if the array gets 156 * However, the size won't decrease automatically if the array gets
157 * smaller so you might want to set it in order to shrink the array. 157 * smaller so you might want to set it in order to shrink the array.
158 * splice(), push(), pop(), unshift(), shift(): these work the same as the 158 * slice(), splice(), push(), pop(), unshift(), shift(): these work the
159 * corresponding methods on JavaScript's Array class. Note however that 159 * same as the corresponding methods on JavaScript's Array class.
160 * using pop() and shift() with arrays of objects is dangerous if you 160 * Note however that using pop() and shift() with arrays of objects is
161 * want to work with their return value: this operation will call 161 * dangerous if you want to work with their return value: this operation
162 * release() on the resulting object before returning which might result 162 * will call release() on the resulting object before returning which
163 * in it being garbage collected. You should call retain() on the array 163 * might result in it being garbage collected. You should call retain()
164 * element before calling pop() or shift(). 164 * on the array element before calling pop() or shift().
165 * 165 *
166 * String type 166 * String type
167 * ----------- 167 * -----------
168 * 168 *
169 * There is a special array type called string: 169 * There is a special array type called string:
170 * 170 *
171 * var str1 = string(); // empty string 171 * var str1 = string(); // empty string
172 * var str2 = string(2); // "\0\0" 172 * var str2 = string(2); // "\0\0"
173 * var str3 = string("foo"); // "foo" 173 * var str3 = string("foo"); // "foo"
174 * var str4 = string(str3, 1, 2); // "oo" 174 * var str4 = string(str3, 1, 2); // "oo"
(...skipping 12 matching lines...) Expand all
187 function forwardExports(module) 187 function forwardExports(module)
188 { 188 {
189 let moduleExports = require(module); 189 let moduleExports = require(module);
190 for (let key in moduleExports) 190 for (let key in moduleExports)
191 exports[key] = moduleExports[key]; 191 exports[key] = moduleExports[key];
192 } 192 }
193 193
194 forwardExports("typedObjects/primitiveTypes"); 194 forwardExports("typedObjects/primitiveTypes");
195 forwardExports("typedObjects/objectTypes"); 195 forwardExports("typedObjects/objectTypes");
196 forwardExports("typedObjects/stringType"); 196 forwardExports("typedObjects/stringType");
OLDNEW
« no previous file with comments | « no previous file | lib/typedObjects/arrayTypes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld