الفرق بين المراجعتين ل"Sass/type of"

من موسوعة حسوب
اذهب إلى التنقل اذهب إلى البحث
(أنشأ الصفحة ب'<noinclude>{{DISPLAYTITLE: الدالة <code>()type_of</code> في Sass}}</noinclude> تحدّد الدالة <code>type_of()‎</code> ما إذا كان Sass/mixin...')
 
سطر 1: سطر 1:
 
<noinclude>{{DISPLAYTITLE: الدالة <code>()type_of</code> في Sass}}</noinclude>
 
<noinclude>{{DISPLAYTITLE: الدالة <code>()type_of</code> في Sass}}</noinclude>
تحدّد الدالة <code>type_of()‎</code>  ما إذا كان [[Sass/mixins|مخلوطٌ]] (mixin) ما موجودًا.
+
تعيد الدالة <code>type_of()‎</code>  نوع قيمة معينة.
  
 
== البنية العامة ==
 
== البنية العامة ==
 
<syntaxhighlight lang="sass">
 
<syntaxhighlight lang="sass">
type_of($name)
+
type_of($value)
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== المعاملات ==
 
== المعاملات ==
  
=== <code>‎$name</code> ===
+
=== <code>‎$value</code> ===
اسم [[Sass/mixins|المخلوط]] الذي نتحقق من وجوده.
+
القيمة التي سيُعاد نوعها.
  
 
== القيم المعادة ==
 
== القيم المعادة ==
قيمة منطقية تحدد ما إذا كان [[Sass/mixins|المخلوط]] مُعرّفًا.
+
سلسلة نصية غير  مقتبسة تحتوي اسم النوع.
  
 
==  أمثلة ==
 
==  أمثلة ==
 
مثال عن استخدام الدالة <code>type_of()‎</code>:<syntaxhighlight lang="sass">
 
مثال عن استخدام الدالة <code>type_of()‎</code>:<syntaxhighlight lang="sass">
mixin-exists(nonexistent) // false
+
type-of(100px) // number
 
+
type-of(asdf)  // string
@mixin red-text { color: red; }
+
type-of("asdf") // string
mixin-exists(red-text) // true
+
type-of(true)  // bool
 +
type-of(#fff)  // color
 +
type-of(blue)  // color
 +
type-of(null)  // null
 +
type-of(a b c)  // list
 +
type-of((a: 1, b: 2)) // map
 +
type-of(get-function("foo")) // function
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== انظر أيضًا ==
 
== انظر أيضًا ==
 
* الدالة <code>[[Sass/function exists|function_exists()]]</code>‎: تحدد ما إذا كانت دالة ما موجودة.
 
* الدالة <code>[[Sass/function exists|function_exists()]]</code>‎: تحدد ما إذا كانت دالة ما موجودة.
 +
* الدالة <code>[[Sass/inspect|inspect()]]</code>‎: تعيد سلسلة نصّية تحتوي قيمة تمثيلها في <code>[[Sass]]</code>.
 
* الدالة <code>[[Sass/global variable exists|global_variable_exists()]]</code>‎: تحدد ما إذا كان متغير ما موجود في النطاق العام.
 
* الدالة <code>[[Sass/global variable exists|global_variable_exists()]]</code>‎: تحدد ما إذا كان متغير ما موجود في النطاق العام.
 
* الدالة <code>[[Sass/feature exists|feature_exists()]]</code>‎: تحدد ما إذا كانت ميزة معينةٌ موجودةٌ في وقت تشغيل <code>[[Sass]]</code>.
 
* الدالة <code>[[Sass/feature exists|feature_exists()]]</code>‎: تحدد ما إذا كانت ميزة معينةٌ موجودةٌ في وقت تشغيل <code>[[Sass]]</code>.

مراجعة 13:18، 22 أبريل 2018

تعيد الدالة type_of()‎ نوع قيمة معينة.

البنية العامة

type_of($value)

المعاملات

‎$value

القيمة التي سيُعاد نوعها.

القيم المعادة

سلسلة نصية غير مقتبسة تحتوي اسم النوع.

أمثلة

مثال عن استخدام الدالة type_of()‎:

type-of(100px)  // number
type-of(asdf)   // string
type-of("asdf") // string
type-of(true)   // bool
type-of(#fff)   // color
type-of(blue)   // color
type-of(null)   // null
type-of(a b c)  // list
type-of((a: 1, b: 2)) // map
type-of(get-function("foo")) // function

انظر أيضًا

  • الدالة function_exists()‎: تحدد ما إذا كانت دالة ما موجودة.
  • الدالة inspect()‎: تعيد سلسلة نصّية تحتوي قيمة تمثيلها في Sass.
  • الدالة global_variable_exists()‎: تحدد ما إذا كان متغير ما موجود في النطاق العام.
  • الدالة feature_exists()‎: تحدد ما إذا كانت ميزة معينةٌ موجودةٌ في وقت تشغيل Sass.

مصادر