blob: 15a88438c5cadd7d191affe8563bec05370967e2 [file] [log] [blame]
Simon Hunt1eecfa22014-12-16 14:46:29 -08001/*
2 * Copyright 2014 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 ONOS GUI -- General Purpose Functions
19
20 @author Simon Hunt
21 */
22(function (onos) {
23 'use strict';
24
25 onos.factory('FnService', [function () {
26 return {
27 isF: function (f) {
28 return $.isFunction(f) ? f : null;
29 },
30 isA: function (a) {
31 return $.isArray(a) ? a : null;
32 },
33 isS: function (s) {
34 return typeof s === 'string' ? s : null;
35 },
36 isO: function (o) {
37 return $.isPlainObject(o) ? o : null;
38 }
39 };
40 }]);
41
42}(ONOS));