Skip to content

Commit 5a68131

Browse files
committed
Add Typescript definitions
1 parent de70290 commit 5a68131

File tree

15 files changed

+434
-0
lines changed

15 files changed

+434
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 2.0
20+
21+
/**
22+
* Returns an array of an object's inherited enumerable and non-enumerable property names.
23+
*
24+
* ## Notes
25+
*
26+
* - Name order is not guaranteed, as object key enumeration is not specified according to the ECMAScript specification. In practice, however, most engines use insertion order to sort an object's keys, thus allowing for deterministic extraction.
27+
* - If provided `null` or `undefined`, the function returns an empty array.
28+
*
29+
* @param value - input object
30+
* @param level - inheritance level
31+
* @throws second argument must be a positive integer
32+
* @returns a list of inherited enumerable and non-enumerable property names
33+
*
34+
* @example
35+
* var keys = inheritedPropertyNames( [] );
36+
*/
37+
declare function inheritedPropertyNames( value: any, level?: number ): Array<string>; // tslint:disable-line: max-line-length
38+
39+
40+
// EXPORTS //
41+
42+
export = inheritedPropertyNames;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import inheritedPropertyNames = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns an array of strings...
25+
{
26+
inheritedPropertyNames( { 'beep': 'boop', 'foo': 3.14 } ); // $ExpectType string[]
27+
inheritedPropertyNames( { 'beep': 'boop', 'foo': 3.14 }, 1 ); // $ExpectType string[]
28+
}
29+
30+
// The compiler throws an error if the function is provided a second argument which is not a number...
31+
{
32+
inheritedPropertyNames( [], 'abc' ); // $ExpectError
33+
inheritedPropertyNames( [], false ); // $ExpectError
34+
inheritedPropertyNames( [], true ); // $ExpectError
35+
inheritedPropertyNames( [], [] ); // $ExpectError
36+
inheritedPropertyNames( [], {} ); // $ExpectError
37+
inheritedPropertyNames( [], ( x: number ): number => x ); // $ExpectError
38+
}
39+
40+
// The compiler throws an error if the function is provided insufficient arguments...
41+
{
42+
inheritedPropertyNames(); // $ExpectError
43+
inheritedPropertyNames( [], 2, 2 ); // $ExpectError
44+
}

lib/node_modules/@stdlib/utils/inherited-property-names/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"lib": "./lib",
2222
"test": "./test"
2323
},
24+
"types": "./docs/types",
2425
"scripts": {},
2526
"homepage": "https://github.com/stdlib-js/stdlib",
2627
"repository": {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 2.0
20+
21+
/**
22+
* Returns an array of an object's inherited symbol properties.
23+
*
24+
* ## Notes
25+
*
26+
* - If provided `null` or `undefined`, the function returns an empty array.
27+
*
28+
* @param value - input object
29+
* @param level - inheritance level
30+
* @throws second argument must be a positive integer
31+
* @returns a list of inherited symbol properties
32+
*
33+
* @example
34+
* var symbols = inheritedPropertySymbols( [] );
35+
*/
36+
declare function inheritedPropertySymbols( value: any, level?: number ): Array<string>; // tslint:disable-line: max-line-length
37+
38+
39+
// EXPORTS //
40+
41+
export = inheritedPropertySymbols;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import inheritedPropertySymbols = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns an array of strings...
25+
{
26+
inheritedPropertySymbols( { 'beep': 'boop', 'foo': 3.14 } ); // $ExpectType string[]
27+
inheritedPropertySymbols( { 'beep': 'boop', 'foo': 3.14 }, 1 ); // $ExpectType string[]
28+
}
29+
30+
// The compiler throws an error if the function is provided a second argument which is not a number...
31+
{
32+
inheritedPropertySymbols( [], 'abc' ); // $ExpectError
33+
inheritedPropertySymbols( [], false ); // $ExpectError
34+
inheritedPropertySymbols( [], true ); // $ExpectError
35+
inheritedPropertySymbols( [], [] ); // $ExpectError
36+
inheritedPropertySymbols( [], {} ); // $ExpectError
37+
inheritedPropertySymbols( [], ( x: number ): number => x ); // $ExpectError
38+
}
39+
40+
// The compiler throws an error if the function is provided insufficient arguments...
41+
{
42+
inheritedPropertySymbols(); // $ExpectError
43+
inheritedPropertySymbols( [], 2, 2 ); // $ExpectError
44+
}

lib/node_modules/@stdlib/utils/inherited-property-symbols/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"lib": "./lib",
2222
"test": "./test"
2323
},
24+
"types": "./docs/types",
2425
"scripts": {},
2526
"homepage": "https://github.com/stdlib-js/stdlib",
2627
"repository": {
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 2.0
20+
21+
/**
22+
* Returns an array of an object's inherited writable property names and symbols.
23+
*
24+
* ## Notes
25+
*
26+
* - Property order is not guaranteed, as object property enumeration is not specified according to the ECMAScript specification. In practice, however, most engines use insertion order to sort an object's properties, thus allowing for deterministic extraction.
27+
* - If provided `null` or `undefined`, the function returns an empty array.
28+
*
29+
* @param value - input object
30+
* @param level - inheritance level
31+
* @throws second argument must be a positive integer
32+
* @returns a list of inherited writable property names and symbols
33+
*
34+
* @example
35+
* var props = inheritedWritableProperties( {} );
36+
*/
37+
declare function inheritedWritableProperties( value: any, level?: number ): Array<string>; // tslint:disable-line: max-line-length
38+
39+
40+
// EXPORTS //
41+
42+
export = inheritedWritableProperties;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import inheritedWritableProperties = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns an array of strings...
25+
{
26+
inheritedWritableProperties( { 'beep': 'boop', 'foo': 3.14 } ); // $ExpectType string[]
27+
inheritedWritableProperties( { 'beep': 'boop', 'foo': 3.14 }, 1 ); // $ExpectType string[]
28+
}
29+
30+
// The compiler throws an error if the function is provided a second argument which is not a number...
31+
{
32+
inheritedWritableProperties( [], 'abc' ); // $ExpectError
33+
inheritedWritableProperties( [], false ); // $ExpectError
34+
inheritedWritableProperties( [], true ); // $ExpectError
35+
inheritedWritableProperties( [], [] ); // $ExpectError
36+
inheritedWritableProperties( [], {} ); // $ExpectError
37+
inheritedWritableProperties( [], ( x: number ): number => x ); // $ExpectError
38+
}
39+
40+
// The compiler throws an error if the function is provided insufficient arguments...
41+
{
42+
inheritedWritableProperties(); // $ExpectError
43+
inheritedWritableProperties( [], 2, 2 ); // $ExpectError
44+
}

lib/node_modules/@stdlib/utils/inherited-writable-properties/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"lib": "./lib",
2222
"test": "./test"
2323
},
24+
"types": "./docs/types",
2425
"scripts": {},
2526
"homepage": "https://github.com/stdlib-js/stdlib",
2627
"repository": {
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 2.0
20+
21+
/**
22+
* Returns an array of an object's inherited writable property names.
23+
*
24+
* ## Notes
25+
*
26+
* - Name order is not guaranteed, as object key enumeration is not specified according to the ECMAScript specification. In practice, however, most engines use insertion order to sort an object's keys, thus allowing for deterministic extraction.
27+
* - If provided `null` or `undefined`, the function returns an empty array.
28+
*
29+
* @param value - input object
30+
* @param level - inheritance level
31+
* @throws second argument must be a positive integer
32+
* @returns a list of inherited writable property names
33+
*
34+
* @example
35+
* var keys = inheritedWritablePropertyNames( {} );
36+
*/
37+
declare function inheritedWritablePropertyNames( value: any, level?: number ): Array<string>; // tslint:disable-line: max-line-length
38+
39+
40+
// EXPORTS //
41+
42+
export = inheritedWritablePropertyNames;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import inheritedWritablePropertyNames = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns an array of strings...
25+
{
26+
inheritedWritablePropertyNames( { 'beep': 'boop', 'foo': 3.14 } ); // $ExpectType string[]
27+
inheritedWritablePropertyNames( { 'beep': 'boop', 'foo': 3.14 }, 1 ); // $ExpectType string[]
28+
}
29+
30+
// The compiler throws an error if the function is provided a second argument which is not a number...
31+
{
32+
inheritedWritablePropertyNames( [], 'abc' ); // $ExpectError
33+
inheritedWritablePropertyNames( [], false ); // $ExpectError
34+
inheritedWritablePropertyNames( [], true ); // $ExpectError
35+
inheritedWritablePropertyNames( [], [] ); // $ExpectError
36+
inheritedWritablePropertyNames( [], {} ); // $ExpectError
37+
inheritedWritablePropertyNames( [], ( x: number ): number => x ); // $ExpectError
38+
}
39+
40+
// The compiler throws an error if the function is provided insufficient arguments...
41+
{
42+
inheritedWritablePropertyNames(); // $ExpectError
43+
inheritedWritablePropertyNames( [], 2, 2 ); // $ExpectError
44+
}

lib/node_modules/@stdlib/utils/inherited-writable-property-names/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"lib": "./lib",
2222
"test": "./test"
2323
},
24+
"types": "./docs/types",
2425
"scripts": {},
2526
"homepage": "https://github.com/stdlib-js/stdlib",
2627
"repository": {

0 commit comments

Comments
 (0)