File tree Expand file tree Collapse file tree 3 files changed +91
-0
lines changed
lib/node_modules/@stdlib/assert/is-arguments Expand file tree Collapse file tree 3 files changed +91
-0
lines changed Original file line number Diff line number Diff line change 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+ * Tests whether a value is an `arguments` object.
23+ *
24+ * @param value - value to test
25+ * @returns boolean indicating whether a value is an `arguments` object
26+ *
27+ * @example
28+ * function foo() {
29+ * return arguments;
30+ * }
31+ *
32+ * var bool = isArguments( foo() );
33+ * // returns true
34+ *
35+ * @example
36+ * var bool = isArguments( [] );
37+ * // returns false
38+ */
39+ declare function isArguments ( value : any ) : boolean ;
40+
41+
42+ // EXPORTS //
43+
44+ export = isArguments ;
Original file line number Diff line number Diff line change 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 isArguments = require( './index' ) ;
20+
21+
22+ // FUNCTIONS //
23+
24+ /**
25+ * Returns the `arguments` object of the function.
26+ *
27+ * @returns arguments
28+ */
29+ function foo ( ) : any {
30+ return arguments ;
31+ }
32+
33+
34+ // TESTS //
35+
36+ // The function returns a boolean...
37+ {
38+ isArguments ( foo ( ) ) ; // $ExpectType boolean
39+ isArguments ( [ ] ) ; // $ExpectType boolean
40+ }
41+
42+ // The compiler throws an error if the function is provided an unsupported number of arguments...
43+ {
44+ isArguments ( ) ; // $ExpectError
45+ isArguments ( foo ( ) , 123 ) ; // $ExpectError
46+ }
Original file line number Diff line number Diff line change 2121 "lib" : " ./lib" ,
2222 "test" : " ./test"
2323 },
24+ "types" : " ./docs/types" ,
2425 "scripts" : {},
2526 "homepage" : " https://github.com/stdlib-js/stdlib" ,
2627 "repository" : {
You can’t perform that action at this time.
0 commit comments